Skip to content

Commit

Permalink
chore(workflow): integrate nx as monorepo solution (#4795)
Browse files Browse the repository at this point in the history
  • Loading branch information
bvanjoi authored Oct 17, 2023
1 parent 2527cbf commit 24e0e89
Show file tree
Hide file tree
Showing 17 changed files with 462 additions and 220 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build-builder-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ jobs:
node-version: 18
cache: 'pnpm'

- name: Turbo Cache
id: turbo-cache
- name: Nx Cache
id: nx-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.ref_name }}-${{ github.sha }}
path: .nx-cache
key: nx-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.ref_name }}-
turbo-
nx-${{ github.ref_name }}-
nx-
- name: Install Dependencies
run: pnpm install
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build-main-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ jobs:
node-version: 18
cache: 'pnpm'

- name: Turbo Cache
id: turbo-cache
- name: Nx Cache
id: nx-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.ref_name }}-${{ github.sha }}
path: .nx-cache
key: nx-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.ref_name }}-
turbo-
nx-${{ github.ref_name }}-
nx-
- name: Install Dependencies
run: pnpm install
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build-module-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ jobs:
node-version: 18
cache: 'pnpm'

- name: Turbo Cache
id: turbo-cache
- name: Nx Cache
id: nx-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.ref_name }}-${{ github.sha }}
path: .nx-cache
key: nx-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.ref_name }}-
turbo-
nx-${{ github.ref_name }}-
nx-
- name: Install Dependencies
run: pnpm install
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/integration-test-Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Turbo Cache
id: turbo-cache
- name: Nx Cache
id: nx-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.ref_name }}-${{ github.sha }}
path: .nx-cache
key: nx-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.ref_name }}-
turbo-
nx-${{ github.ref_name }}-
nx-
- name: Install Dependencies
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/integration-test-Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Turbo Cache
id: turbo-cache
- name: Nx Cache
id: nx-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.ref_name }}-${{ github.sha }}
path: .nx-cache
key: nx-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.ref_name }}-
turbo-
nx-${{ github.ref_name }}-
nx-
- name: Install Dependencies
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ jobs:
- name: Install npm v9
run: npm install -g npm@9

- name: Turbo Cache
id: turbo-cache
- name: Nx Cache
id: nx-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.ref_name }}-${{ github.sha }}
path: .nx-cache
key: nx-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.ref_name }}-
turbo-
nx-${{ github.ref_name }}-
nx-
- name: Install Dependencies && Build
run: pnpm install
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
node-version: "18"
cache: 'pnpm'

- name: Turbo Cache
id: turbo-cache
- name: Nx Cache
id: nx-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.ref_name }}-${{ github.sha }}
path: .nx-cache
key: nx-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.ref_name }}-
turbo-
nx-${{ github.ref_name }}-
nx-
- name: Install Dependencies
run: pnpm install --ignore-scripts
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ jobs:
- name: Install npm v9
run: npm install -g npm@9

- name: Turbo Cache
id: turbo-cache
- name: Nx Cache
id: nx-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.ref_name }}-${{ github.sha }}
path: .nx-cache
key: nx-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.ref_name }}-
turbo-
nx-${{ github.ref_name }}-
nx-
- name: Install Dependencies && Build
run: pnpm install
Expand Down Expand Up @@ -97,15 +97,15 @@ jobs:
- name: Install npm v9
run: npm install -g npm@9

- name: Turbo Cache
id: turbo-cache
- name: Nx Cache
id: nx-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.ref_name }}-${{ github.sha }}
path: .nx-cache
key: nx-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.ref_name }}-
turbo-
nx-${{ github.ref_name }}-
nx-
- name: Install Dependencies && Build
run: pnpm install
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/test-garfish-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ jobs:
with:
fetch-depth: 1

- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v2
- name: Nx Cache
id: nx-cache
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.ref_name }}-${{ github.sha }}
path: .nx-cache
key: nx-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.ref_name }}-
turbo-
nx-${{ github.ref_name }}-
nx-
- name: Install Pnpm
run: corepack enable
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Turbo Cache
id: turbo-cache
- name: Nx Cache
id: nx-cache
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
uses: actions/cache@v3
with:
path: .turbo
key: turbo-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }}
path: .nx-cache
key: nx-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.base_ref }}-${{ github.ref_name }}-
turbo-${{ github.base_ref }}-
turbo-
nx-${{ github.base_ref }}-${{ github.ref_name }}-
nx-${{ github.base_ref }}-
nx-
- name: Install Dependencies
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ website/main/build
website/**/.temp

.wireit/
.turbo/
.nx-cache/
playground/

# Local Netlify folder
Expand Down
32 changes: 32 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"targetDefaults": {
"build": {
"dependsOn": [
"^build"
],
"inputs": [
"{projectRoot}/src/**/*",
"{projectRoot}/tsconfig.json",
"{projectRoot}/package.json",
"{projectRoot}/modern.config.*",
"{projectRoot}/scripts/**/*"
]
}
},
"tasksRunnerOptions": {
"default": {
"runner": "nx-cloud",
"options": {
"cacheableOperations": [
"build"
],
"cacheDirectory": ".nx-cache",
"accessToken": "MGQ1ZmJlYmItNDg2YS00YzhjLTllOWMtYTgxYTVjN2M5NjdhfHJlYWQtd3JpdGU="
}
}
},
"affected": {
"defaultBase": "main"
}
}
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"test:e2e": "cd tests && npm run test",
"fast-lint": "sh -x ./scripts/fast-lint.sh",
"lint:package-json": "cd ./scripts/lint-package-json && pnpm start",
"prepare": "turbo run build --filter {packages/**} --cache-dir=.turbo --no-daemon && husky install",
"prepare-build": "nx run-many -t build -p @modern-js/* --maxParallel=100",
"prepare": "npm run prepare-build && husky install",
"lint": "npm run fast-lint",
"change": "modern change",
"clear": "modern clear",
Expand All @@ -41,7 +42,7 @@
"update-codesmith": "cd ./scripts/update-codesmith && pnpm start",
"update-rspress": "cd ./scripts/update-rspress && pnpm start",
"update-rsbuild": "cd ./scripts/update-rsbuild && pnpm start",
"update-turbo-cache": "turbo run build --force --filter {packages/**}"
"update-nx-cache": "nx reset && npm run prepare-build"
},
"engines": {
"node": ">=14.17.6",
Expand Down Expand Up @@ -77,13 +78,14 @@
"@scripts/build": "workspace:*",
"@types/react": "^18",
"@types/react-dom": "^18",
"@vitest/ui": "^0.33.0",
"@vitest/coverage-v8": "^0.33.0",
"@vitest/ui": "^0.33.0",
"esbuild": "0.17.19",
"eslint": "^8.28.0",
"lint-staged": "~13.1.0",
"husky": "^8.0.0",
"turbo": "1.10.2",
"lint-staged": "~13.1.0",
"nx": "16.10.0",
"nx-cloud": "^16.5.2",
"vitest": "0.33.0"
},
"pnpm": {
Expand Down
2 changes: 1 addition & 1 deletion packages/document/builder-doc/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jest.config.js
tsconfig.json
CHANGELOG.md

.turbo/
.nx-cache/
scripts/
doc_build
2 changes: 1 addition & 1 deletion packages/document/main-doc/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jest.config.js
tsconfig.json
CHANGELOG.md

.turbo/
.nx-cache/
scripts/
doc_build
Loading

0 comments on commit 24e0e89

Please sign in to comment.