Skip to content

Commit 7a82e57

Browse files
committed
feat: React frontend app scaffoldinga + Shared UI
1 parent f64f529 commit 7a82e57

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3901
-588
lines changed

.dockerignore

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.moon/cache
2+
build/
3+
tmp/
4+
dist/
5+
docs
6+
target/
7+
.next/
8+
.output/
9+
.fleet/
10+
.husky/
11+
.github/
12+
.rollup.cache/
13+
.vite-inspect/
14+
.vscode/
15+
.DS_Store
16+
.DS_Store?
17+
Dockerfile
18+
node_modules
19+
npm-debug.log
20+
docker-compose*.yml
21+
compose-*.yml
22+
*tsbuildinfo*
23+
degit.json
24+
*.log
25+
*.md
26+
.env*
27+
_docs/
28+
backend/public/*
29+
!backend/public/.gitkeep

.env.example

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DATABASE_URL=libsql://localhost:8080?tls=0
2+
3+
SMTP_HOST=localhost
4+
SMTP_PORT=1025
5+
SMTP_USERNAME=null
6+
SMTP_PASSWORD=null
7+
SMTP_USE_SSL=false
8+
SMTP_EMAIL_FROM="Admin Sistem <[email protected]>"

.moon/tasks.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# https://moonrepo.dev/docs/config/tasks
2+
# yaml-language-server: $schema=https://moonrepo.dev/schemas/tasks.json
3+
$schema: 'https://moonrepo.dev/schemas/tasks.json'
4+
5+
# Global file groups, this will be inherited by all projects.
6+
# @see: https://moonrepo.dev/docs/config/project#filegroups
7+
fileGroups:
8+
js-configs:
9+
- '*.config.{js,cjs,mjs,ts}'
10+
- '*.json'
11+
js-sources:
12+
- 'src/**/*'
13+
- 'types/**/*'
14+
tests:
15+
- 'tests/**/*'
16+
- '**/__tests__/**/*'
17+
assets:
18+
- 'assets/**/*'
19+
- 'images/**/*'
20+
- 'static/**/*'
21+
- 'public/**/*'
22+
- '**/*.{scss,css}'
23+
24+
taskOptions:
25+
runDepsInParallel: false
26+
27+
# Defines task deps that are implicitly inserted into all inherited tasks within a project.
28+
# This is extremely useful for pre-building projects that are used extensively throughout
29+
# the repo, or always building project dependencies.
30+
# implicitDeps:
31+
# - '^:format'

.moon/toolchain.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,21 @@ node:
1212
version: '20'
1313
packageManager: 'pnpm' # Defines which package manager to utilize.
1414
addEnginesConstraint: false # Add `node.version` as a constraint in the root `package.json` `engines`.
15-
dedupeOnLockfileChange: true # Dedupe dependencies after the lockfile has changed.
16-
syncPackageManagerField: false # Sync the currently configured package manager and its version to the packageManager field in the root package.json.
15+
dedupeOnLockfileChange: true # Dedupe dependencies after the lockfile has changed, keep the workspace tree as clean and lean as possible.
16+
syncPackageManagerField: true # Sync the currently configured package manager and its version to the packageManager field in the root package.json.
17+
rootPackageOnly: true # Single version policy patterns by only allowing dependencies in the root `package.json`.
1718
syncProjectWorkspaceDependencies: true # Sync a project's `dependsOn` as dependencies within the project's `package.json`.
1819
syncVersionManagerConfig: null # Sync `node.version` to a 3rd-party version manager's config file.
20+
# dependencyVersionFormat: link # Uses link:../relative/path and symlinks package contents.
21+
dependencyVersionFormat: workspace # Uses workspace:*, which resolves to "1.2.3". Requires package workspaces.
1922
pnpm:
20-
version: '9' # The version of the package manager to use.
23+
version: '9.7.1' # The version of the package manager to use.
24+
25+
typescript:
26+
includeSharedTypes: false # The shared types folder must be named types and must exist relative to the root setting
27+
# projectConfigFileName: 'tsconfig.build.json' # Defines the file name of the tsconfig.json found in the project root.
28+
# rootConfigFileName: 'tsconfig.workspace.json' # File name of the config file found in the root that houses shared compiler options.
29+
# rootOptionsConfigFileName: 'tsconfig.base.json' # File name of the config file found in the root that houses shared compiler options.
2130

2231
# Configures Rust within the toolchain.
2332
# rust:

.moon/workspace.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ vcs:
66
manager: 'git'
77
provider: gitlab
88
defaultBranch: 'main'
9+
# @see: https://moonrepo.dev/docs/config/workspace#hooks
10+
hooks:
11+
pre-commit:
12+
- 'moon run :lint :format --affected --status=staged'
13+
# - 'another-command'
914

1015
hasher:
1116
optimization: 'performance'
@@ -24,13 +29,14 @@ runner:
2429
# path to the project folder as the map value. File paths are relative from the workspace root,
2530
# and cannot reference projects located outside the workspace boundary.
2631
projects:
27-
- 'apps/*'
28-
- 'packages/*'
29-
30-
generator:
31-
templates:
32-
- './templates'
32+
globs:
33+
- 'apps/*'
34+
- 'packages/*'
3335

3436
# When enabled, will check for a newer moon version and send anonymous usage data to the
3537
# moonrepo team. This data is used to improve the quality and reliability of the tool.
3638
telemetry: false
39+
40+
generator:
41+
templates:
42+
- './templates'

.npmrc

+17-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
update-notifier = false
1+
# @see: https://pnpm.io/npmrc#update-notifier
2+
update-notifier=false
3+
4+
# @see: https://pnpm.io/npmrc#link-workspace-packages
5+
# @see: https://pnpm.io/npmrc#prefer-workspace-packages
6+
link-workspace-packages=false
7+
prefer-workspace-packages=false
8+
9+
# @see: https://pnpm.io/npmrc#hoist
10+
hoist=true
11+
hoist-workspace-packages=true
12+
13+
# Use `hoisted` to set a flat node_modules without symlinks is created.
14+
# Set symlink to false to disable symlinks.
15+
# https://pnpm.io/npmrc#node-linker
16+
node-linker=isolated
17+
symlink=true

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ dependencies, and references are correctly aligned with your project's unique id
3434
This includes updating any configuration files, package names, and other references
3535
throughout the codebase where `myorg` is used.
3636

37+
Optinally, you'll need to install [Static Web Server][static-web-server] to preview
38+
generated websites or Single-Page Applications (SPAs).
39+
3740
### Golang application
3841

3942
Currently, Go is not supported as an official moonrepo toolchain. You need to manually
@@ -141,3 +144,4 @@ Keeping documentation current helps others understand, use, and contribute to th
141144
[zog-templates]: https://github.com/zero-one-group/templates
142145
[moon-toolchain]: https://moonrepo.dev/docs/concepts/toolchain
143146
[go-docs]: https://go.dev/doc/install
147+
[static-web-server]: https://static-web-server.net/download-and-install/

apps/vite-react-tailwind/.gitignore

-24
This file was deleted.

apps/vite-react-tailwind/README.md

-7
This file was deleted.

apps/vite-react-tailwind/biome.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
3+
"extends": ["../../biome.json"]
4+
}

apps/vite-react-tailwind/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Moon React SPA Template</title>
7+
<title>React Application</title>
88
</head>
99
<body>
1010
<div id="root"></div>

apps/vite-react-tailwind/moon.yml

+33-5
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,52 @@ $schema: 'https://moonrepo.dev/schemas/project.json'
55
type: application
66
language: typescript
77
platform: node
8-
98
stack: frontend
9+
tags: ['app']
10+
11+
# Overrides the name (identifier) of the project
12+
id: 'react-app'
1013

1114
project:
1215
name: vite-react-tailwind
13-
description: 'React SPA application'
16+
description: 'Frontend application'
17+
18+
dependsOn:
19+
- 'shared-ui'
20+
21+
# File groups defined in .moon/tasks.yml will be inherited by all projects.
22+
# @see: https://moonrepo.dev/docs/config/project#filegroups
23+
# fileGroups:
1424

1525
tasks:
1626
dev:
1727
command: 'pnpm run dev'
18-
args: []
28+
inputs:
29+
- '@group(js-configs)'
30+
- '@group(js-sources)'
31+
- '@group(assets)'
32+
outputs:
33+
- 'dist/**/*.js'
34+
- 'public/**/*'
35+
- '!public/.gitkeep'
36+
options:
37+
envFile: '/.env'
1938

2039
build:
2140
command: 'pnpm run build'
22-
args: []
41+
inputs:
42+
- '@group(js-configs)'
43+
- '@group(js-sources)'
44+
- '@group(assets)'
45+
outputs:
46+
- 'dist/**/*.js'
47+
- 'public/**/*'
48+
- '!public/.gitkeep'
2349

2450
start:
2551
command: 'static-web-server'
26-
args: ['-d', 'dist', '--page404', 'index.html', '-a', '127.0.0.1', '-p', '3000']
52+
args: ['-d', 'dist', '--page404', 'index.html', '-a', '127.0.0.1', '-p', '8000']
53+
env:
54+
NODE_ENV: 'production'
2755
options:
2856
cache: false

apps/vite-react-tailwind/package.json

+39-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,56 @@
11
{
22
"name": "vite-react-tailwind",
3+
"version": "0.0.1",
4+
"description": "Frontend application",
35
"private": true,
4-
"version": "0.0.0",
56
"type": "module",
67
"scripts": {
78
"dev": "vite",
8-
"build": "tsc -b && vite build",
9+
"build": "vite build",
910
"preview": "vite preview",
10-
"lint": "biome lint --write .",
11-
"format": "biome check --write . && biome format . --write"
11+
"lint": "biome lint . --write",
12+
"check": "biome check . --write",
13+
"format": "biome format . --write",
14+
"cleanup": "pnpm dlx rimraf dist node_modules pnpm-lock.yaml",
15+
"analyze-bundle": "pnpm dlx vite-bundle-visualizer"
1216
},
1317
"dependencies": {
18+
"@modular-forms/react": "^0.8.1",
19+
"@myorg/shared-ui": "workspace:*",
20+
"@nanostores/persistent": "^0.10.2",
21+
"@nanostores/query": "^0.3.4",
22+
"@nanostores/react": "^0.7.3",
23+
"clsx": "^2.1.1",
24+
"consola": "^3.2.3",
25+
"nanostores": "^0.11.2",
26+
"ofetch": "^1.3.4",
27+
"react-cookie": "^7.2.0",
28+
"react-dom": "^18.3.1",
29+
"react-error-boundary": "^4.0.13",
30+
"react-router-dom": "^6.26.1",
1431
"react": "^18.3.1",
15-
"react-dom": "^18.3.1"
32+
"sonner": "^1.5.0",
33+
"tailwind-merge": "^2.5.2",
34+
"universal-cookie": "^7.2.0",
35+
"valibot": "^0.38.0"
1636
},
1737
"devDependencies": {
18-
"@types/react": "^18.3.3",
38+
"@biomejs/biome": "1.8.3",
39+
"@tailwindcss/aspect-ratio": "^0.4.2",
40+
"@tailwindcss/forms": "^0.5.7",
41+
"@tailwindcss/typography": "^0.5.14",
42+
"@types/node": "^22.4.0",
1943
"@types/react-dom": "^18.3.0",
44+
"@types/react": "^18.3.3",
2045
"@vitejs/plugin-react": "^4.3.1",
46+
"autoprefixer": "^10.4.20",
47+
"postcss": "^8.4.41",
48+
"tailwind-debug-breakpoints": "^1.0.3",
49+
"tailwindcss-animate": "^1.0.7",
50+
"tailwindcss": "^3.4.10",
2151
"typescript": "^5.5.4",
22-
"vite": "^5.3.5",
23-
"vitest": "^2.0.5"
52+
"vite-plugin-inspect": "^0.8.5",
53+
"vite-tsconfig-paths": "^5.0.1",
54+
"vite": "^5.4.1"
2455
}
2556
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "myorg",
3+
"icons": [
4+
{
5+
"src": "/favicon.svg",
6+
"sizes": "36x36",
7+
"type": "image/svg+xml",
8+
"density": "0.75"
9+
},
10+
{
11+
"src": "/favicon.svg",
12+
"sizes": "48x48",
13+
"type": "image/svg+xml",
14+
"density": "1.0"
15+
},
16+
{
17+
"src": "/favicon.svg",
18+
"sizes": "72x72",
19+
"type": "image/svg+xml",
20+
"density": "1.5"
21+
},
22+
{
23+
"src": "/favicon.svg",
24+
"sizes": "96x96",
25+
"type": "image/svg+xml",
26+
"density": "2.0"
27+
},
28+
{
29+
"src": "/favicon.svg",
30+
"sizes": "144x144",
31+
"type": "image/svg+xml",
32+
"density": "3.0"
33+
},
34+
{
35+
"src": "/favicon.svg",
36+
"sizes": "192x192",
37+
"type": "image/svg+xml",
38+
"density": "4.0"
39+
}
40+
]
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Disallow: /

0 commit comments

Comments
 (0)