Skip to content
This repository has been archived by the owner on Mar 2, 2025. It is now read-only.

Commit

Permalink
feat: update NX
Browse files Browse the repository at this point in the history
BREAKING CHANGE: update to Nx 17
  • Loading branch information
IKatsuba committed Apr 6, 2024
1 parent 2c9ccf9 commit 06ac8b4
Show file tree
Hide file tree
Showing 22 changed files with 2,345 additions and 2,593 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ testem.log
Thumbs.db

.env

.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 apps/api-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": "apps/api-e2e/jest.config.ts",
"runInBand": true
"runInBand": true,
"passWithNoTests": false
},
"dependsOn": ["lib:build"]
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/api-e2e/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
}
},
"tags": [],
Expand Down
14 changes: 10 additions & 4 deletions apps/api-e2e/tests/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ describe('api e2e', () => {
default: {
runner: 'nx-cloud',
options: {
cacheableOperations: ['build', 'lint', 'test', 'e2e'],
accessToken: expect.any(String),
url: 'http://localhost:3000/',
},
Expand All @@ -51,11 +50,18 @@ describe('api e2e', () => {

const libName = uniq('lib');

await runNxCommandAsync(`g @nx/js:library ${libName} --buildable`);
await runNxCommandAsync(
`g @nx/js:library ${libName} --bundler=tsc --no-interactive`
);

await runNxCommandAsync(`build ${libName}`);
await runNxCommandAsync(`build ${libName}`, {
env: {
...process.env,
NX_DAEMON: 'false',
},
});

rmSync(tmpProjPath('node_modules/.cache'), {
rmSync(tmpProjPath('.nx'), {
recursive: true,
force: true,
});
Expand Down
2 changes: 1 addition & 1 deletion apps/api-e2e/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function createTestProject() {
});

execSync(
`npx --yes create-nx-workspace@16 ${projectName} --preset apps --no-nxCloud --no-interactive`,
`npx --yes create-nx-workspace@17 ${projectName} --preset apps --nxCloud=skip --no-interactive`,
{
cwd: dirname(projectDirectory),
stdio: 'inherit',
Expand Down
13 changes: 5 additions & 8 deletions apps/api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"compiler": "tsc",
"outputPath": "dist/apps/api",
"main": "apps/api/src/main.ts",
"tsConfig": "apps/api/tsconfig.app.json"
"tsConfig": "apps/api/tsconfig.app.json",
"webpackConfig": "apps/api/webpack.config.js"
},
"configurations": {
"production": {
Expand Down Expand Up @@ -55,18 +56,14 @@
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/api/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/api/jest.config.ts",
"passWithNoTests": true
"jestConfig": "apps/api/jest.config.ts"
}
}
},
Expand Down
8 changes: 8 additions & 0 deletions apps/api/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { composePlugins, withNx } = require('@nx/webpack');

// Nx plugins for webpack.
module.exports = composePlugins(withNx(), (config) => {
// Note: This was added by an Nx migration. Webpack builds are required to have a corresponding Webpack config file.
// See: https://nx.dev/recipes/webpack/webpack-config-setup
return config;
});
10 changes: 3 additions & 7 deletions libs/api/auth/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api/auth/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/api/auth/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/api/auth/jest.config.ts"
}
}
},
Expand Down
10 changes: 3 additions & 7 deletions libs/api/db/entities/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api/db/entities/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/api/db/entities/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/api/db/entities/jest.config.ts"
}
}
},
Expand Down
10 changes: 3 additions & 7 deletions libs/api/http/executions/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api/http/executions/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/api/http/executions/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/api/http/executions/jest.config.ts"
}
}
},
Expand Down
10 changes: 3 additions & 7 deletions libs/api/http/org-and-workspace/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api/http/org-and-workspace/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/api/http/org-and-workspace/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/api/http/org-and-workspace/jest.config.ts"
}
}
},
Expand Down
10 changes: 3 additions & 7 deletions libs/api/http/ping/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api/http/ping/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/api/http/ping/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/api/http/ping/jest.config.ts"
}
}
},
Expand Down
10 changes: 3 additions & 7 deletions libs/api/http/report-client-error/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api/http/report-client-error/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/api/http/report-client-error/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/api/http/report-client-error/jest.config.ts"
}
}
},
Expand Down
10 changes: 3 additions & 7 deletions libs/api/http/runs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api/http/runs/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/api/http/runs/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/api/http/runs/jest.config.ts"
}
}
},
Expand Down
10 changes: 3 additions & 7 deletions libs/api/http/save-metrics/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api/http/save-metrics/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/api/http/save-metrics/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/api/http/save-metrics/jest.config.ts"
}
}
},
Expand Down
10 changes: 3 additions & 7 deletions libs/api/http/stats/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api/http/stats/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/api/http/stats/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/api/http/stats/jest.config.ts"
}
}
},
Expand Down
10 changes: 3 additions & 7 deletions libs/api/models/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api/models/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/api/models/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/api/models/jest.config.ts"
}
}
},
Expand Down
16 changes: 3 additions & 13 deletions libs/api/stats/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,14 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api/stats/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/api/stats/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
"jestConfig": "libs/api/stats/jest.config.ts"
}
}
},
Expand Down
10 changes: 3 additions & 7 deletions libs/api/storage/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
"projectType": "library",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["libs/api/storage/**/*.ts"]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "libs/api/storage/jest.config.ts",
"passWithNoTests": true
"jestConfig": "libs/api/storage/jest.config.ts"
}
}
},
Expand Down
Loading

0 comments on commit 06ac8b4

Please sign in to comment.