Skip to content

Commit

Permalink
chore: migrate to nx 16.1
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoVazquez committed May 5, 2023
1 parent d525ab2 commit 34d51ac
Show file tree
Hide file tree
Showing 28 changed files with 2,163 additions and 2,321 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
11 changes: 6 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx", "etc", "rxjs", "rxjs-angular", "sonarjs", "ordered-imports"],
"plugins": ["@nx", "etc", "rxjs", "rxjs-angular", "sonarjs", "ordered-imports"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["{e2e,packages}/**/tsconfig.*?.json", "e2e/**/*-e2e/tsconfig.json"]
Expand All @@ -11,10 +11,11 @@
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"excludedFiles": ["*.spec.ts"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allowCircularSelfDependency": true,
"allow": [],
"depConstraints": [
{
Expand Down Expand Up @@ -44,18 +45,18 @@
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": "off"
"@nx/enforce-module-boundaries": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Once that's completed we can create our application with the corresponding gener

Finally we MUST revert the changes made to the `nx.json` file.

In cases where the application generator creates a companion e2e project, we need to move it to the `e2e` folder. This is done using the `@nrwl/workspace:move` generator.
In cases where the application generator creates a companion e2e project, we need to move it to the `e2e` folder. This is done using the `@nx/workspace:move` generator.

```bash
nx generate move [<grouping-folder>/]<e2e-project-directory-name> --project-name=<e2e-project-name>
Expand Down
4 changes: 2 additions & 2 deletions decorate-angular-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ const cp = require('child_process');
const isWindows = os.platform() === 'win32';
let output;
try {
output = require('@nrwl/workspace').output;
output = require('@nx/workspace').output;
} catch (e) {
console.warn(
'Angular CLI could not be decorated to enable computation caching. Please ensure @nrwl/workspace is installed.'
'Angular CLI could not be decorated to enable computation caching. Please ensure @nx/workspace is installed.'
);
process.exit(0);
}
Expand Down
13 changes: 11 additions & 2 deletions e2e/examples/lumberjack-app-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
import { defineConfig } from 'cypress';

export default defineConfig({
e2e: nxE2EPreset(__dirname),
e2e: {
...nxE2EPreset(__dirname),
/**
* TODO(@nx/cypress): In Cypress v12,the testIsolation option is turned on by default.
* This can cause tests to start breaking where not indended.
* You should consider enabling this once you verify tests do not depend on each other
* More Info: https://docs.cypress.io/guides/references/migration-guide#Test-Isolation
**/
testIsolation: false,
},
});
8 changes: 4 additions & 4 deletions e2e/examples/lumberjack-app-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"executor": "@nx/cypress:cypress",
"dependsOn": [
{
"projects": "dependencies",
"target": "build"
"target": "build",
"dependencies": true
}
],
"options": {
Expand All @@ -24,7 +24,7 @@
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["e2e/examples/lumberjack-app-e2e/**/*.{js,ts}"]
Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getJestProjects } from '@nrwl/jest';
import { getJestProjects } from '@nx/jest';

export default {
projects: getJestProjects(),
Expand Down
17 changes: 15 additions & 2 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
const nxPreset = require('@nrwl/jest/preset').default;
const nxPreset = require('@nx/jest/preset').default;

/**
* We need to reset the mocks for each test to prevent the mocks being reused and affect the next test.
*
* For example in the lumberjack.service.spec.ts file some test were keeping the count of calls from previous usages of the spy.
* */
module.exports = { ...nxPreset, resetMocks: true };
module.exports = {
...nxPreset,
resetMocks: true,
/* TODO: Update to latest Jest snapshotFormat
* By default Nx has kept the older style of Jest Snapshot formats
* to prevent breaking of any existing tests with snapshots.
* It's recommend you update to the latest format.
* You can do this by removing snapshotFormat property
* and running tests with --update-snapshot flag.
* Example: "nx affected --targets=test --update-snapshot"
* More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format
*/
snapshotFormat: { escapeString: true, printBasicPrototype: true },
};
215 changes: 215 additions & 0 deletions migrations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
{
"migrations": [
{
"version": "15.7.0-beta.0",
"description": "Split global configuration files into individual project.json files. This migration has been added automatically to the beginning of your migration set to retroactively make them work with the new version of Nx.",
"cli": "nx",
"implementation": "./src/migrations/update-15-7-0/split-configuration-into-project-json-files",
"package": "@nx/workspace",
"name": "15-7-0-split-configuration-into-project-json-files"
},
{
"cli": "nx",
"version": "15.8.2-beta.0",
"description": "Updates the nx wrapper.",
"implementation": "./src/migrations/update-15-8-2/update-nxw",
"package": "nx",
"name": "15.8.2-update-nx-wrapper"
},
{
"cli": "nx",
"version": "16.0.0-beta.0",
"description": "Remove @nrwl/cli.",
"implementation": "./src/migrations/update-16-0-0/remove-nrwl-cli",
"package": "nx",
"name": "16.0.0-remove-nrwl-cli"
},
{
"cli": "nx",
"version": "16.0.0-beta.9",
"description": "Replace `dependsOn.projects` and `inputs` definitions with new configuration format.",
"implementation": "./src/migrations/update-16-0-0/update-depends-on-to-tokens",
"package": "nx",
"name": "16.0.0-tokens-for-depends-on"
},
{
"cli": "nx",
"version": "16.0.0-beta.0",
"description": "Replace @nrwl/nx-cloud with nx-cloud",
"implementation": "./src/migrations/update-16-0-0/update-nx-cloud-runner",
"package": "nx",
"name": "16.0.0-update-nx-cloud-runner"
},
{
"cli": "nx",
"version": "16.0.0-beta.1",
"description": "Replace @nx/devkit with @nx/devkit",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
"package": "@nx/devkit",
"name": "update-16-0-0-add-nx-packages"
},
{
"version": "15.7.0-beta.0",
"description": "Split global configuration files (e.g., workspace.json) into individual project.json files.",
"cli": "nx",
"implementation": "./src/migrations/update-15-7-0/split-configuration-into-project-json-files",
"package": "@nx/workspace",
"name": "15-7-0-split-configuration-into-project-json-files"
},
{
"cli": "nx",
"version": "16.0.0-beta.1",
"description": "Replace @nx/workspace with @nx/workspace",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
"package": "@nx/workspace",
"name": "update-16-0-0-add-nx-packages"
},
{
"version": "16.0.0-beta.4",
"description": "Generates a plugin called 'workspace-plugin' containing your workspace generators.",
"cli": "nx",
"implementation": "./src/migrations/update-16-0-0/move-workspace-generators-to-local-plugin",
"package": "@nx/workspace",
"name": "16-0-0-move-workspace-generators-into-local-plugin"
},
{
"version": "16.0.0-beta.9",
"description": "Fix .babelrc presets if it contains an invalid entry for @nx/web/babel.",
"cli": "nx",
"implementation": "./src/migrations/update-16-0-0/fix-invalid-babelrc",
"package": "@nx/workspace",
"name": "16-0-0-fix-invalid-babelrc"
},
{
"cli": "nx",
"version": "15.5.0-beta.0",
"description": "Update to Cypress v12. Cypress 12 contains a handful of breaking changes that might causes tests to start failing that nx cannot directly fix. Read more Cypress 12 changes: https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-12-0.This migration will only run if you are already using Cypress v11.",
"factory": "./src/migrations/update-15-5-0/update-to-cypress-12",
"package": "@nx/cypress",
"name": "update-to-cypress-12"
},
{
"cli": "nx",
"version": "16.0.0-beta.1",
"description": "Replace @nx/cypress with @nx/cypress",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
"package": "@nx/cypress",
"name": "update-16-0-0-add-nx-packages"
},
{
"cli": "nx",
"version": "15.7.1-beta.0",
"description": "Add node_modules to root eslint ignore",
"factory": "./src/migrations/update-15-7-1/add-eslint-ignore",
"package": "@nx/linter",
"name": "add-eslint-ignore"
},
{
"cli": "nx",
"version": "16.0.0-beta.1",
"description": "Replace @nx/linter with @nx/linter",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
"package": "@nx/linter",
"name": "update-16-0-0-add-nx-packages"
},
{
"cli": "nx",
"version": "16.0.0-beta.1",
"description": "Replace @nx/eslint-plugin with @nx/eslint-plugin",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
"package": "@nx/eslint-plugin",
"name": "update-16-0-0-add-nx-packages"
},
{
"version": "15.8.0-beta.0",
"cli": "nx",
"description": "Update jest configs to support jest 29 changes (https://jestjs.io/docs/upgrading-to-jest29)",
"factory": "./src/migrations/update-15-8-0/update-configs-jest-29",
"package": "@nx/jest",
"name": "update-configs-jest-29"
},
{
"version": "15.8.0-beta.0",
"cli": "nx",
"description": "Update jest test files to support jest 29 changes (https://jestjs.io/docs/upgrading-to-jest29)",
"factory": "./src/migrations/update-15-8-0/update-tests-jest-29",
"package": "@nx/jest",
"name": "update-tests-jest-29"
},
{
"cli": "nx",
"version": "16.0.0-beta.1",
"description": "Replace @nx/jest with @nx/jest",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
"package": "@nx/jest",
"name": "update-16-0-0-add-nx-packages"
},
{
"cli": "nx",
"version": "15.7.0-beta.1",
"description": "Install the required angular-devkit packages as we do not directly depend on them anymore",
"factory": "./src/migrations/update-15-7-0/install-required-packages",
"package": "@nx/angular",
"name": "install-required-packages"
},
{
"cli": "nx",
"version": "15.9.0-beta.3",
"description": "Update the tsconfig.spec.json to use target es2016 for jest-preset-angular v13",
"factory": "./src/migrations/update-15-9-0/update-testing-tsconfig",
"package": "@nx/angular",
"name": "update-tsconfig-spec-jest"
},
{
"cli": "nx",
"version": "15.9.0-beta.9",
"description": "Update the file-server executor to use @nrwl/web:file-server",
"factory": "./src/migrations/update-15-9-0/update-file-server-executor",
"package": "@nx/angular",
"name": "update-file-server-executor"
},
{
"cli": "nx",
"version": "16.0.0-beta.1",
"description": "Replace the deprecated library generator 'simpleModuleName' option from generator defaults with 'simpleName'",
"factory": "./src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option",
"package": "@nx/angular",
"name": "remove-library-generator-simple-module-name-option"
},
{
"cli": "nx",
"version": "16.0.0-beta.1",
"description": "Replace @nx/angular with @nx/angular",
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages",
"package": "@nx/angular",
"name": "update-16-0-0-add-nx-packages"
},
{
"cli": "nx",
"version": "16.0.0-beta.6",
"description": "Remove protractor as default e2eTestRunner from nxJson and project configurations",
"implementation": "./src/migrations/update-16-0-0/remove-protractor-defaults",
"package": "@nx/angular",
"name": "remove-protractor-defaults-from-generators"
},
{
"cli": "nx",
"version": "16.0.0-beta.6",
"description": "Remove karma as default unitTestRunner from nxJson and project configurations",
"implementation": "./src/migrations/update-16-0-0/remove-karma-defaults",
"package": "@nx/angular",
"name": "remove-karma-defaults-from-generators"
},
{
"cli": "nx",
"version": "16.1.0-beta.1",
"requires": {
"@angular/core": ">=15.0.0"
},
"description": "Remove exported `@angular/platform-server` `renderModule` method. The `renderModule` method is now exported by the Angular CLI.",
"factory": "./src/migrations/update-16-1-0/remove-render-module-platform-server-exports",
"package": "@nx/angular",
"name": "remove-render-module-platform-server-exports"
}
]
}
Loading

0 comments on commit 34d51ac

Please sign in to comment.