Skip to content

Commit 0327592

Browse files
feat: Nx 20 support (#79)
1 parent 33fe1ab commit 0327592

File tree

79 files changed

+2596
-2921
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2596
-2921
lines changed

.editorconfig

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ indent_style = space
77
indent_size = 2
88
insert_final_newline = true
99
trim_trailing_whitespace = true
10+
max_line_length = 160
1011

1112
[*.md]
1213
max_line_length = off

.eslintrc.json

+7
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@
3636
"@typescript-eslint/no-extra-semi": "error",
3737
"no-extra-semi": "off"
3838
}
39+
},
40+
{
41+
"files": ["*.json"],
42+
"parser": "jsonc-eslint-parser",
43+
"rules": {
44+
"@nx/dependency-checks": ["error", {}]
45+
}
3946
}
4047
]
4148
}

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ testem.log
4040
Thumbs.db
4141

4242
.nx/cache
43-
.nx/workspace-data
43+
.nx/workspace-data
44+
.angular
45+
.env

.prettierignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
/coverage
55

66
/.nx/cache
7-
/.nx/workspace-data
7+
/.nx/workspace-data
8+
.angular

.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"singleQuote": true,
3-
"printWidth": 300
3+
"printWidth": 160
44
}

.vscode/extensions.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
{
2-
"recommendations": [
3-
"ms-vscode.vscode-typescript-tslint-plugin",
4-
"esbenp.prettier-vscode",
5-
"firsttris.vscode-jest-runner"
6-
]
2+
"recommendations": ["ms-vscode.vscode-typescript-tslint-plugin", "esbenp.prettier-vscode", "firsttris.vscode-jest-runner"]
73
}

e2e/nx-e2e/jest.config.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module.exports = {
22
displayName: 'nx-e2e',
33
preset: '../../jest.preset.js',
4-
globals: {
5-
'ts-jest': {
6-
tsConfig: '<rootDir>/tsconfig.spec.json',
7-
},
8-
},
94
transform: {
10-
'^.+\\.[tj]s$': 'ts-jest',
5+
'^.+\\.[tj]s$': [
6+
'ts-jest',
7+
{
8+
tsConfig: '<rootDir>/tsconfig.spec.json',
9+
},
10+
],
1111
},
1212
moduleFileExtensions: ['ts', 'js', 'html'],
1313
coverageDirectory: '../../coverage/e2e/nx-e2e',

migrations.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"migrations": [
3-
{ "cli": "nx", "version": "19.2.0-beta.2", "description": "Updates the default workspace data directory to .nx/workspace-data", "implementation": "./src/migrations/update-19-2-0/move-workspace-data-directory", "package": "nx", "name": "19-2-0-move-graph-cache-directory" },
4-
{ "cli": "nx", "version": "19.2.2-beta.0", "description": "Updates the nx wrapper.", "implementation": "./src/migrations/update-17-3-0/update-nxw", "package": "nx", "name": "19-2-2-update-nx-wrapper" },
5-
{ "version": "19.2.4-beta.0", "description": "Set project name in nx.json explicitly", "implementation": "./src/migrations/update-19-2-4/set-project-name", "x-repair-skip": true, "package": "nx", "name": "19-2-4-set-project-name" },
6-
{ "cli": "nx", "version": "19.5.0-beta.1", "requires": { "@angular/core": ">=18.1.0" }, "description": "Update the @angular/cli package version to ~18.1.0.", "factory": "./src/migrations/update-19-5-0/update-angular-cli", "package": "@nx/angular", "name": "update-angular-cli-version-18-1-0" },
7-
{ "cli": "nx", "version": "19.6.0-beta.4", "description": "Ensure Module Federation DTS is turned off by default.", "factory": "./src/migrations/update-19-6-0/turn-off-dts-by-default", "package": "@nx/angular", "name": "update-19-6-0" },
8-
{ "cli": "nx", "version": "19.6.0-beta.7", "requires": { "@angular/core": ">=18.2.0" }, "description": "Update the @angular/cli package version to ~18.2.0.", "factory": "./src/migrations/update-19-6-0/update-angular-cli", "package": "@nx/angular", "name": "update-angular-cli-version-18-2-0" },
9-
{ "cli": "nx", "version": "19.6.1-beta.0", "description": "Ensure Target Defaults are set correctly for Module Federation.", "factory": "./src/migrations/update-19-6-1/ensure-depends-on-for-mf", "package": "@nx/angular", "name": "update-19-6-1-ensure-module-federation-target-defaults" },
10-
{ "version": "18.1.0", "description": "Updates calls to afterRender with an explicit phase to the new API", "factory": "./migrations/after-render-phase/bundle", "package": "@angular/core", "name": "migration-after-render-phase" }
3+
{
4+
"version": "20.0.1",
5+
"description": "Set `useLegacyCache` to true for migrating workspaces",
6+
"implementation": "./src/migrations/update-20-0-1/use-legacy-cache",
7+
"x-repair-skip": true,
8+
"package": "nx",
9+
"name": "use-legacy-cache"
10+
}
1111
]
1212
}

nx.json

+9-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,16 @@
3131
"namedInputs": {
3232
"default": ["{projectRoot}/**/*", "sharedGlobals"],
3333
"sharedGlobals": ["{workspaceRoot}/workspace.json", "{workspaceRoot}/tsconfig.base.json", "{workspaceRoot}/tslint.json", "{workspaceRoot}/nx.json"],
34-
"production": ["default", "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", "!{projectRoot}/tsconfig.spec.json", "!{projectRoot}/jest.config.[jt]s", "!{projectRoot}/src/test-setup.[jt]s"]
34+
"production": [
35+
"default",
36+
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
37+
"!{projectRoot}/tsconfig.spec.json",
38+
"!{projectRoot}/jest.config.[jt]s",
39+
"!{projectRoot}/src/test-setup.[jt]s"
40+
]
3541
},
3642
"parallel": 1,
3743
"useInferencePlugins": false,
38-
"defaultBase": "master"
44+
"defaultBase": "main",
45+
"useLegacyCache": true
3946
}

package.json

+22-25
Original file line numberDiff line numberDiff line change
@@ -25,48 +25,45 @@
2525
"help": "nx help",
2626
"doctoc": "doctoc packages/nx/README.md",
2727
"workspace-generator": "nx workspace-generator",
28-
"clean": "npx rimraf node_modules package-lock.json yarn.lock",
28+
"clean": "npx rimraf node_modules package-lock.json yarn.lock && yarn",
2929
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
3030
"reset.changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
3131
},
3232
"private": true,
3333
"devDependencies": {
34-
"@angular-devkit/schematics": "18.2.4",
35-
"@angular/core": "18.2.4",
34+
"@angular-devkit/core": "~18.2.0",
35+
"@nx/angular": "20.0.3",
36+
"@nx/devkit": "20.0.3",
37+
"@nx/eslint": "20.0.3",
38+
"@nx/eslint-plugin": "20.0.3",
39+
"@nx/express": "20.0.3",
40+
"@nx/jest": "20.0.3",
41+
"@nx/js": "20.0.3",
42+
"@nx/plugin": "20.0.3",
43+
"@nx/web": "20.0.3",
44+
"@nx/workspace": "20.0.3",
3645
"@types/fs-extra": "^11.0.3",
3746
"@types/jest": "29.5.13",
3847
"@types/node": "^20.0.0",
3948
"@types/plist": "^3.0.2",
4049
"@types/xml2js": "^0.4.9",
41-
"@typescript-eslint/eslint-plugin": "7.18.0",
42-
"@typescript-eslint/parser": "7.18.0",
43-
"conventional-changelog-cli": "^4.1.0",
50+
"conventional-changelog-cli": "^5.0.0",
4451
"cz-conventional-changelog": "^3.3.0",
4552
"doctoc": "^2.0.0",
4653
"dotenv": "~16.4.0",
4754
"eslint": "8.57.0",
4855
"eslint-config-prettier": "9.1.0",
4956
"fs-extra": "^11.2.0",
5057
"jest": "29.7.0",
51-
"jsonc-parser": "3.2.1",
52-
"nx": "19.7.3",
58+
"nx": "20.0.3",
59+
"nx-cloud": "19.1.0",
5360
"plist": "^3.1.0",
54-
"prettier": "^2.7.1",
55-
"ts-jest": "29.1.3",
61+
"prettier": "^3.3.0",
62+
"ts-jest": "29.2.5",
5663
"ts-node": "10.9.2",
57-
"tslib": "^2.6.2",
58-
"typescript": "5.5.4",
59-
"xml2js": "^0.6.2",
60-
"nx-cloud": "19.1.0",
61-
"@nx/devkit": "19.7.3",
62-
"@nx/workspace": "19.7.3",
63-
"@nx/plugin": "19.7.3",
64-
"@nx/web": "19.7.3",
65-
"@nx/js": "19.7.3",
66-
"@nx/eslint-plugin": "19.7.3",
67-
"@nx/jest": "19.7.3",
68-
"@nx/express": "19.7.3",
69-
"@nx/angular": "19.7.3",
70-
"@nx/eslint": "19.7.3"
71-
}
64+
"tslib": "^2.8.0",
65+
"typescript": "^5.6.0",
66+
"xml2js": "^0.6.2"
67+
},
68+
"dependencies": {}
7269
}

packages/nx/executors.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
"description": "test executor"
2525
}
2626
}
27-
}
27+
}

packages/nx/generators.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@
5858
"hidden": true
5959
}
6060
}
61-
}
61+
}

packages/nx/jest.config.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
export default {
33
displayName: 'nx',
44
preset: '../../jest.preset.js',
5-
globals: {
6-
'ts-jest': { tsconfig: '<rootDir>/tsconfig.spec.json' },
7-
},
85
transform: {
9-
'^.+\\.[tj]sx?$': 'ts-jest',
6+
'^.+\\.[tj]sx?$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
107
},
118
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
129
coverageDirectory: '../../coverage/packages/nx',

packages/nx/package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/nx",
3-
"version": "19.0.1",
3+
"version": "20.0.0-alpha.0",
44
"description": "NativeScript Plugin for Nx",
55
"repository": {
66
"type": "git",
@@ -29,13 +29,14 @@
2929
},
3030
"dependencies": {
3131
"fs-extra": "^11.2.0",
32-
"ignore": "^5.3.0",
3332
"plist": "^3.1.0",
3433
"xml2js": "~0.6.0"
3534
},
3635
"peerDependencies": {
37-
"@nx/devkit": ">=19.0.0 <20.0.0",
38-
"@nx/js": ">=19.0.0 <20.0.0",
39-
"@nx/jest": ">=19.0.0 <20.0.0"
36+
"@nx/devkit": "^20.0.0",
37+
"@nx/eslint": "^20.0.0",
38+
"@nx/js": "^20.0.0",
39+
"@nx/workspace": "^20.0.0",
40+
"nx": "^20.0.0"
4041
}
41-
}
42+
}

packages/nx/project.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
"targets": {
99
"lint": {
1010
"executor": "@nx/eslint:lint",
11-
"outputs": ["{options.outputFile}"]
11+
"outputs": ["{options.outputFile}"],
12+
"options": {
13+
"lintFilePatterns": ["packages/nx/**/*.{ts,tsx,js,jsx}", "packages/nx/package.json"]
14+
}
1215
},
1316
"test": {
1417
"executor": "@nx/jest:jest",

packages/nx/src/executors/build/schema.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,7 @@
114114
}
115115
},
116116
"additionalProperties": false,
117-
"required": [
118-
"replace",
119-
"with"
120-
]
117+
"required": ["replace", "with"]
121118
},
122119
"default": []
123120
},

packages/nx/src/executors/test/executor.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const options: TestExecutorSchema = {
99
describe('Executor: test', () => {
1010
it('sample', () => {
1111
expect(true).toBe(true);
12-
})
12+
});
1313
});
1414

1515
// xdescribe('NativeScript Test Builder', () => {

packages/nx/src/generators/app-resources/app-resources.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { Tree, generateFiles, joinPathFragments } from '@nx/devkit';
2-
import { PluginHelpers, getDefaultTemplateOptions } from '../../utils';
2+
import { getDefaultTemplateOptions } from '../../utils';
33

44
import { Schema as AppResourcesSchema } from './schema';
55

66
export function appResources(tree: Tree, options: AppResourcesSchema) {
77
generateFiles(tree, joinPathFragments(__dirname, 'files'), options.path, {
88
...getDefaultTemplateOptions(tree),
9-
name: options.name || 'App_Resources',
10-
libFolderName: PluginHelpers.getLibFoldername('nativescript'),
9+
name: options.name ?? 'App_Resources',
1110
});
1211
}
1312

0 commit comments

Comments
 (0)