Skip to content

Commit

Permalink
build: add Nx (#45)
Browse files Browse the repository at this point in the history
* build: add Nx

* fix: cross env
  • Loading branch information
fi3ework authored Jul 15, 2024
1 parent 893ea68 commit 0ff0b9c
Show file tree
Hide file tree
Showing 9 changed files with 465 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
- name: Build Test
run: |
pnpm run test:sandboxes-build
pnpm run build:sandboxes
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,4 @@ dist
dist/
storybook-static/
.DS_Store
.nx
28 changes: 28 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"namedInputs": {
"default": ["{projectRoot}/packages/src/**/*"],
"build": [
"default",
"!{projectRoot}/**/*.{md,mdx}",
"{projectRoot}/tsconfig.json",
"{projectRoot}/package.json",
"{projectRoot}/scripts/**/*"
],
"sandbox": ["{projectRoot}/.storybook/**/*"]
},
"targetDefaults": {
"build": {
"cache": true,
"inputs": ["build", "^build"],
"outputs": ["{projectRoot}/dist"]
},
"build:storybook": {
"cache": true,
"dependsOn": ["build"],
"inputs": ["build", "sandbox"],
"outputs": ["{projectRoot}/storybook-static"]
}
},
"defaultBase": "main"
}
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"version": "0.0.0",
"private": true,
"scripts": {
"build": "pnpm --filter \"./packages/**\" run prep --optimized",
"build": "cross-env NX_DAEMON=false nx run-many -t build --exclude @sandboxes/* --parallel=10",
"build:sandboxes": "cross-env NX_DAEMON=false nx run-many -t build:storybook --projects @sandboxes/* --parallel=10",
"check": "pnpm --parallel --filter \"./packages/**\" run check",
"dev": "pnpm --parallel --filter \"./packages/**\" run prep --watch",
"test:sandboxes-build": "pnpm --parallel --filter \"./sandboxes/**\" run build:storybook"
"dev": "pnpm --parallel --filter \"./packages/**\" run prep --watch"
},
"simple-git-hooks": {
"pre-commit": "npx nano-staged"
Expand All @@ -20,7 +20,9 @@
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"cross-env": "^7.0.3",
"nano-staged": "^0.8.0",
"nx": "^19.4.3",
"prettier": "^3.2.5",
"simple-git-hooks": "^2.11.1",
"sort-package-json": "^2.10.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/builder-rsbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@
"!src/**/*"
],
"scripts": {
"build": "pnpm run prep --optimized",
"check": "node --loader ../../scripts/node_modules/esbuild-register/loader.js -r ../../scripts/node_modules/esbuild-register/register.js ../../scripts/prepare/check.ts",
"prep": "node --loader ../../scripts/node_modules/esbuild-register/loader.js -r ../../scripts/node_modules/esbuild-register/register.js ../../scripts/prepare/bundle.ts",
"prepare": "pnpm run prep --optimized"
"prepare": "pnpm run build"
},
"dependencies": {
"@rsbuild/plugin-type-check": "1.0.1-beta.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/react-rsbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@
"!src/**/*"
],
"scripts": {
"build": "pnpm run prep --optimized",
"check": "node --loader ../../scripts/node_modules/esbuild-register/loader.js -r ../../scripts/node_modules/esbuild-register/register.js ../../scripts/prepare/check.ts",
"prep": "node --loader ../../scripts/node_modules/esbuild-register/loader.js -r ../../scripts/node_modules/esbuild-register/register.js ../../scripts/prepare/bundle.ts",
"prepare": "pnpm run prep --optimized"
"prepare": "pnpm run build"
},
"dependencies": {
"@storybook/react": "^8.2.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/vue3-rsbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@
"!src/**/*"
],
"scripts": {
"build": "pnpm run prep --optimized",
"check": "node --loader ../../scripts/node_modules/esbuild-register/loader.js -r ../../scripts/node_modules/esbuild-register/register.js ../../scripts/prepare/check.ts",
"prep": "node --loader ../../scripts/node_modules/esbuild-register/loader.js -r ../../scripts/node_modules/esbuild-register/register.js ../../scripts/prepare/bundle.ts",
"prepare": "pnpm run prep --optimized"
"prepare": "pnpm run build"
},
"dependencies": {
"@storybook/vue3": "^8.2.1",
Expand Down
Loading

0 comments on commit 0ff0b9c

Please sign in to comment.