Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate workspace to nx 19.x #242

Merged
merged 10 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
"rules": {
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
"rules": {
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
Expand Down
21 changes: 21 additions & 0 deletions .github/actions/setup-monorepo/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Set Up Monorepo
description: Set up nx monorepo for CI workflows

runs:
using: 'composite'
steps:
- name: Use PNPM 8.x
uses: pnpm/action-setup@v3
with:
version: 8
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'

- name: Install Node.js Dependencies
shell: bash
run: pnpm install

- uses: nrwl/nx-set-shas@v4
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: nrwl/nx-set-shas@v3
- run: npm ci
- uses: ./.github/actions/setup-monorepo

- run: npx nx format:check
- run: npx nx affected -t lint test build
- run: pnpm nx format:check
- run: pnpm nx affected -t lint test build
- run: |
echo "NO_COVERAGE_RUN=$(if [ -z "$(npx nx print-affected --select=projects)" ]; then echo "true"; else echo "false";fi)" >> $GITHUB_ENV
echo "NO_COVERAGE_RUN=$(if [ -z "$(pnpm nx print-affected --select=projects)" ]; then echo "true"; else echo "false";fi)" >> $GITHUB_ENV
- name: Merge coverage
if: env.NO_COVERAGE_RUN != 'true'
run: |
Expand All @@ -43,4 +42,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HUSKY: '0'
run: |
npx nx affected --target release --parallel=false
pnpm nx affected --target release --parallel=false
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ Thumbs.db
# Reports
reports/

.nx/cache
.nx/cache
.nx/workspace-data
5 changes: 1 addition & 4 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
pnpm commitlint --edit "$1"
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
pnpm lint-staged
3 changes: 0 additions & 3 deletions .husky/prepare-commit-msg

This file was deleted.

4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
/dist
/coverage

/.nx/cache
/.nx/cache
/.nx/workspace-data
pnpm-lock.yaml
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ npm i
To build all the packages, run:

```bash
npx nx run-many --target=build --all
pnpm nx run-many --target=build --all
```

## Running Unit Tests
Expand Down Expand Up @@ -70,7 +70,7 @@ npm link
- Create a new nx workspace or use an existing one:

```bash
npx create-nx-workspace@latest
pnpm create-nx-workspace@latest
```

- Install the linked package (make sure you are in the root of the nx workspace):
Expand Down
11 changes: 1 addition & 10 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
const {
utils: { getProjects },
} = require('@commitlint/config-nx-scopes');

module.exports = {
extends: ['@commitlint/config-conventional', '@commitlint/config-nx-scopes'],
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': async (ctx) => [
2,
'always',
[...(await getProjects(ctx)), 'workspace'],
],
'body-max-line-length': [0, 'always'],
},
};
3 changes: 0 additions & 3 deletions e2e/data-migration-e2e/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ export default defineConfig({
minWorkers: 1,
maxWorkers: 1,
globals: true,
cache: {
dir: '../../node_modules/.vitest',
},
environment: 'node',
include: ['tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],

Expand Down
3 changes: 0 additions & 3 deletions e2e/nx-python-e2e/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ export default defineConfig({
minWorkers: 1,
maxWorkers: 1,
globals: true,
cache: {
dir: '../../node_modules/.vitest',
},
environment: 'node',
include: ['tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],

Expand Down
7 changes: 3 additions & 4 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
module.exports = {
'{packages,tools}/**/*.{ts,js,json,md,html,css,scss}': [
'npx nx affected --target lint --uncommitted --fix true',
'npx nx format:write --uncommitted',
'git add',
'pnpm nx affected --target lint --uncommitted --fix true',
'pnpm nx format:write --uncommitted',
],
'*.{js,md,json}': ['npx nx format:write --uncommitted', 'git add'],
'*.{js,md,json}': ['pnpm nx format:write --uncommitted'],
};
Loading
Loading