Skip to content

Commit

Permalink
build: NX setup
Browse files Browse the repository at this point in the history
  • Loading branch information
pure-js committed Dec 3, 2024
1 parent d9c6711 commit fea7f1a
Show file tree
Hide file tree
Showing 7 changed files with 3,635 additions and 225 deletions.
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ dist/
# TypeScript build
tsconfig.tsbuildinfo

# Storybook build outputs
storybook-static/

# macOS
.DS_store

Expand All @@ -29,5 +32,7 @@ coverage/
/playwright-report/
/playwright/.cache/

# Storybook build outputs
storybook-static/
# NX
.nx/cache
.nx/workspace-data
vite.config.*.timestamp*
4 changes: 0 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ build
dist
coverage

# TypeScript config
tsconfig.json
tsconfig.node.json

# PNPM package manager
pnpm-lock.yaml

Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ The app allows you to browse your news feed, add new posts, edit and delete them

## Contribution

$ pnpm i
$ pnpm install
$ pnpm run dev

## Production build

$ pnpm run build

## NX

| Build system, optimized for monorepos

- Run "pnpm exec nx run-many -t build" to run the build target for every project in the workspace. Run it again to replay the cached computation. https://nx.dev/features/cache-task-results
- Run "pnpm exec nx graph" to see the graph of projects and tasks in your workspace. https://nx.dev/core-features/explore-graph
53 changes: 53 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"targetDefaults": {
"build": {
"outputs": [
"{projectRoot}/dist"
],
"cache": true
},
"build-storybook": {
"outputs": [
"{projectRoot}/storybook-static"
],
"cache": true
}
},
"defaultBase": "main",
"plugins": [
{
"plugin": "@nx/eslint/plugin",
"options": {
"targetName": "eslint:lint"
}
},
{
"plugin": "@nx/storybook/plugin",
"options": {
"serveStorybookTargetName": "serve:storybook",
"buildStorybookTargetName": "build:storybook",
"testStorybookTargetName": "test-storybook",
"staticStorybookTargetName": "static-storybook"
}
},
{
"plugin": "@nx/vite/plugin",
"options": {
"buildTargetName": "vite:build",
"testTargetName": "vite:test",
"serveTargetName": "serve",
"previewTargetName": "vite:preview",
"serveStaticTargetName": "serve-static",
"typecheckTargetName": "typecheck"
}
},
{
"plugin": "@nx/playwright/plugin",
"options": {
"targetName": "e2e"
}
}
],
"nxCloudId": "674f56e7a7a8855e5b2ffa20"
}
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
"url": "https://github.com/pure-js/local-microblogging-client/issues"
},
"devDependencies": {
"@nx/eslint": "20.1.4",
"@nx/playwright": "20.1.4",
"@nx/storybook": "20.1.4",
"@nx/vite": "20.1.4",
"@nx/web": "20.1.4",
"@playwright/test": "^1.35.1",
"@storybook/addon-essentials": "^8.0.10",
"@storybook/addon-interactions": "^8.0.10",
Expand All @@ -49,6 +54,7 @@
"@typescript-eslint/parser": "^6.21.0",
"@vanilla-extract/vite-plugin": "^4.0.18",
"@vitejs/plugin-react-swc": "~3.7.2",
"@vitest/ui": "^1.3.1",
"autoprefixer": "^10.4.13",
"browserslist": "~4.22.1",
"chromatic": "~9.0.0",
Expand All @@ -67,6 +73,7 @@
"eslint-plugin-unicorn": "^55.0.0",
"lightningcss": "^1.22.0",
"msw": "^1.3.3",
"nx": "20.1.4",
"postcss": "^8.4.41",
"postcss-nesting": "13.0.0",
"prettier": "3.4.1",
Expand Down Expand Up @@ -107,5 +114,6 @@
"plugin:storybook/recommended"
]
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"nx": {}
}
Loading

0 comments on commit fea7f1a

Please sign in to comment.