Skip to content

Commit

Permalink
feat: migrate to Nx 17 (#189)
Browse files Browse the repository at this point in the history
* feat: migrate to Nx 17

Migrate workspace to Nx 17, and migrate nx-python to use NxPluginV2 API

BREAKING CHANGE: The entire workspace needs to be migrated to Nx 17.

re #188
  • Loading branch information
lucasvieirasilva authored Dec 21, 2023
1 parent 9b87665 commit d38ea54
Show file tree
Hide file tree
Showing 32 changed files with 5,394 additions and 5,889 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
- uses: nrwl/nx-set-shas@v3
- run: npm ci

- run: npx nx workspace-lint
- run: npx nx format:check
- run: npx nx affected --target=lint --parallel=3
- run: npx nx affected --target=test --parallel=3 --ci --code-coverage --silent
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ Thumbs.db

# Reports
reports/

.nx/cache
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

/dist
/coverage

/.nx/cache
10 changes: 4 additions & 6 deletions e2e/data-migration-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "e2e/data-migration-e2e/jest.config.ts",
"runInBand": true
"runInBand": true,
"passWithNoTests": false
},
"dependsOn": ["data-migration:build"]
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["e2e/data-migration-e2e/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
}
},
"tags": [],
Expand Down
3 changes: 2 additions & 1 deletion e2e/nx-python-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"executor": "@nx/jest:jest",
"options": {
"jestConfig": "e2e/nx-python-e2e/jest.config.ts",
"runInBand": true
"runInBand": true,
"passWithNoTests": false
},
"dependsOn": ["nx-python:build"]
}
Expand Down
12 changes: 6 additions & 6 deletions e2e/nx-python-e2e/tests/__snapshots__/nx-python.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ readme = "README.md"
python = ">=3.9,<3.11"
[tool.poetry.dependencies.app1]
path = "apps/app1"
path = "app1"
develop = true
[tool.poetry.dependencies.lib1]
path = "libs/lib1"
path = "lib1"
develop = true
[tool.poetry.dependencies.lib2]
path = "libs/lib2"
path = "lib2"
develop = true
[tool.poetry.group.dev.dependencies]
Expand Down Expand Up @@ -57,15 +57,15 @@ readme = "README.md"
python = ">=3.9,<3.11"
[tool.poetry.dependencies.app1]
path = "apps/app1"
path = "app1"
develop = true
[tool.poetry.dependencies.lib1]
path = "libs/lib1"
path = "lib1"
develop = true
[tool.poetry.dependencies.lib2]
path = "libs/lib2"
path = "lib2"
develop = true
[tool.poetry.group.dev.dependencies]
Expand Down
24 changes: 10 additions & 14 deletions e2e/nx-python-e2e/tests/nx-python.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ describe('nx-python e2e', () => {

expect(() =>
checkFilesExist(
`apps/${app1}/dist/${app1.replace('-', '_')}-1.0.0-py3-none-any.whl`,
`apps/${app1}/dist/${app1}-1.0.0.tar.gz`
`${app1}/dist/${app1.replace('-', '_')}-1.0.0-py3-none-any.whl`,
`${app1}/dist/${app1}-1.0.0.tar.gz`
)
).not.toThrow();
}, 3000000);
Expand Down Expand Up @@ -69,8 +69,8 @@ describe('nx-python e2e', () => {

expect(() =>
checkFilesExist(
`apps/${app1}/dist/${app1.replace('-', '_')}-1.0.0-py3-none-any.whl`,
`apps/${app1}/dist/${app1}-1.0.0.tar.gz`
`${app1}/dist/${app1.replace('-', '_')}-1.0.0-py3-none-any.whl`,
`${app1}/dist/${app1}-1.0.0.tar.gz`
)
).not.toThrow();
}, 3000000);
Expand Down Expand Up @@ -100,8 +100,6 @@ describe('nx-python e2e', () => {
'src/app1',
'--linter',
'ruff',
'--projectNameAndRootFormat',
'as-provided',
].join(' ')
);

Expand All @@ -120,8 +118,6 @@ describe('nx-python e2e', () => {
'src/lib1',
'--linter',
'ruff',
'--projectNameAndRootFormat',
'as-provided',
].join(' ')
);

Expand Down Expand Up @@ -175,8 +171,8 @@ describe('nx-python e2e', () => {

expect(() =>
checkFilesExist(
`apps/${app1}/dist/${app1.replace('-', '_')}-1.0.0-py3-none-any.whl`,
`apps/${app1}/dist/${app1}-1.0.0.tar.gz`
`${app1}/dist/${app1.replace('-', '_')}-1.0.0-py3-none-any.whl`,
`${app1}/dist/${app1}-1.0.0.tar.gz`
)
).not.toThrow();
}, 3000000);
Expand Down Expand Up @@ -218,8 +214,8 @@ describe('nx-python e2e', () => {

expect(() =>
checkFilesExist(
`apps/${app1}/dist/${app1.replace('-', '_')}-1.0.0-py3-none-any.whl`,
`apps/${app1}/dist/${app1}-1.0.0.tar.gz`
`${app1}/dist/${app1.replace('-', '_')}-1.0.0-py3-none-any.whl`,
`${app1}/dist/${app1}-1.0.0.tar.gz`
)
).not.toThrow();

Expand Down Expand Up @@ -264,8 +260,8 @@ describe('nx-python e2e', () => {

expect(() =>
checkFilesExist(
`apps/${app1}/dist/${app1.replace('-', '_')}-1.0.0-py3-none-any.whl`,
`apps/${app1}/dist/${app1}-1.0.0.tar.gz`
`${app1}/dist/${app1.replace('-', '_')}-1.0.0-py3-none-any.whl`,
`${app1}/dist/${app1}-1.0.0.tar.gz`
)
).not.toThrow();

Expand Down
30 changes: 17 additions & 13 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"]
}
}
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
"inputs": ["production", "^production"],
"cache": true
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
"cache": true
},
"test": {
"inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"]
"@nx/jest:jest": {
"cache": true,
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
"options": {
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"workspaceLayout": {
Expand All @@ -27,6 +31,6 @@
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"sharedGlobals": ["{workspaceRoot}/release.base.config.js"],
"production": ["default"]
"production": ["default", "!{projectRoot}/src/test-setup.[jt]s"]
}
}
Loading

0 comments on commit d38ea54

Please sign in to comment.