Skip to content

Commit b335b83

Browse files
authored
chore: add compatibility for Nx 16 (#3589)
1 parent 7989709 commit b335b83

23 files changed

+255
-78
lines changed

@commitlint/config-nx-scopes/fixtures/basic/nx.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"defaultBase": "main"
55
},
66
"cli": {
7-
"defaultCollection": "@nrwl/react"
7+
"defaultCollection": "@nx/react"
88
},
99
"tasksRunnerOptions": {
1010
"default": {
11-
"runner": "@nrwl/nx-cloud",
11+
"runner": "nx-cloud",
1212
"options": {
1313
"cacheableOperations": [
1414
"build",
@@ -20,7 +20,7 @@
2020
}
2121
},
2222
"generators": {
23-
"@nrwl/react": {
23+
"@nx/react": {
2424
"application": {
2525
"style": "css",
2626
"linter": "eslint",

@commitlint/config-nx-scopes/fixtures/basic/nx/a/project.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"projectType": "library",
55
"targets": {
66
"lint": {
7-
"executor": "@nrwl/linter:eslint",
7+
"executor": "@nx/linter:eslint",
88
"outputs": [
99
"{options.outputFile}"
1010
],
@@ -15,7 +15,7 @@
1515
}
1616
},
1717
"test": {
18-
"executor": "@nrwl/jest:jest",
18+
"executor": "@nx/jest:jest",
1919
"outputs": [
2020
"coverage/nx/a"
2121
],

@commitlint/config-nx-scopes/fixtures/basic/nx/b/project.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"projectType": "library",
55
"targets": {
66
"lint": {
7-
"executor": "@nrwl/linter:eslint",
7+
"executor": "@nx/linter:eslint",
88
"outputs": [
99
"{options.outputFile}"
1010
],
@@ -15,7 +15,7 @@
1515
}
1616
},
1717
"test": {
18-
"executor": "@nrwl/jest:jest",
18+
"executor": "@nx/jest:jest",
1919
"outputs": [
2020
"coverage/nx/b"
2121
],

@commitlint/config-nx-scopes/fixtures/basic/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"name": "basic",
33
"version": "1.0.0",
44
"devDependencies": {
5-
"nx": "^14.0.0"
5+
"nx": "^16.0.0"
66
}
77
}

@commitlint/config-nx-scopes/fixtures/empty/nx.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
"affected": {
44
"defaultBase": "main"
55
},
6-
"cli": {
7-
"defaultCollection": "@nrwl/workspace"
8-
},
96
"implicitDependencies": {
107
"package.json": {
118
"dependencies": "*",
@@ -15,7 +12,7 @@
1512
},
1613
"tasksRunnerOptions": {
1714
"default": {
18-
"runner": "@nrwl/workspace/tasks-runners/default",
15+
"runner": "nx/tasks-runners/default",
1916
"options": {
2017
"cacheableOperations": [
2118
"build",

@commitlint/config-nx-scopes/fixtures/empty/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"name": "empty",
33
"version": "1.0.0",
44
"devDependencies": {
5-
"nx": "^14.0.0"
5+
"nx": "^16.0.0"
66
}
77
}

@commitlint/config-nx-scopes/fixtures/empty/workspace.json

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"npmScope": "secretarium",
3+
"affected": {
4+
"defaultBase": "main"
5+
},
6+
"cli": {
7+
"defaultCollection": "@nrwl/react"
8+
},
9+
"tasksRunnerOptions": {
10+
"default": {
11+
"runner": "@nrwl/nx-cloud",
12+
"options": {
13+
"cacheableOperations": [
14+
"build",
15+
"lint",
16+
"test",
17+
"e2e"
18+
]
19+
}
20+
}
21+
},
22+
"generators": {
23+
"@nrwl/react": {
24+
"application": {
25+
"style": "css",
26+
"linter": "eslint",
27+
"babel": true
28+
},
29+
"component": {
30+
"style": "css"
31+
},
32+
"library": {
33+
"style": "css",
34+
"linter": "eslint"
35+
}
36+
}
37+
},
38+
"defaultProject": "c"
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "c",
3+
"version": "1.0.0"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"root": "nx/c",
3+
"sourceRoot": "nx/c/src",
4+
"projectType": "library",
5+
"targets": {
6+
"lint": {
7+
"executor": "@nrwl/linter:eslint",
8+
"outputs": [
9+
"{options.outputFile}"
10+
],
11+
"options": {
12+
"lintFilePatterns": [
13+
"nx/c/**/*.ts"
14+
]
15+
}
16+
},
17+
"test": {
18+
"executor": "@nrwl/jest:jest",
19+
"outputs": [
20+
"coverage/nx/c"
21+
],
22+
"options": {
23+
"jestConfig": "nx/c/jest.config.js",
24+
"passWithNoTests": true
25+
}
26+
}
27+
},
28+
"tags": []
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "d",
3+
"version": "1.0.0"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"root": "nx/d",
3+
"sourceRoot": "nx/d/src",
4+
"projectType": "library",
5+
"targets": {
6+
"lint": {
7+
"executor": "@nrwl/linter:eslint",
8+
"outputs": [
9+
"{options.outputFile}"
10+
],
11+
"options": {
12+
"lintFilePatterns": [
13+
"nx/d/**/*.ts"
14+
]
15+
}
16+
},
17+
"test": {
18+
"executor": "@nrwl/jest:jest",
19+
"outputs": [
20+
"coverage/nx/d"
21+
],
22+
"options": {
23+
"jestConfig": "nx/d/jest.config.js",
24+
"passWithNoTests": true
25+
}
26+
}
27+
},
28+
"tags": []
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "basic",
3+
"version": "1.0.0",
4+
"devDependencies": {
5+
"nx": "^14.0.0"
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": 2,
33
"projects": {
4-
"a": "nx/a",
5-
"b": "nx/b"
4+
"c": "nx/c",
5+
"d": "nx/d"
66
}
77
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"npmScope": "secretarium",
3+
"affected": {
4+
"defaultBase": "main"
5+
},
6+
"cli": {
7+
"defaultCollection": "@nrwl/react"
8+
},
9+
"tasksRunnerOptions": {
10+
"default": {
11+
"runner": "@nrwl/nx-cloud",
12+
"options": {
13+
"cacheableOperations": [
14+
"build",
15+
"lint",
16+
"test",
17+
"e2e"
18+
]
19+
}
20+
}
21+
},
22+
"generators": {
23+
"@nrwl/react": {
24+
"application": {
25+
"style": "css",
26+
"linter": "eslint",
27+
"babel": true
28+
},
29+
"component": {
30+
"style": "css"
31+
},
32+
"library": {
33+
"style": "css",
34+
"linter": "eslint"
35+
}
36+
}
37+
},
38+
"defaultProject": "e"
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "e",
3+
"version": "1.0.0"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"root": "nx/e",
3+
"sourceRoot": "nx/e/src",
4+
"projectType": "library",
5+
"targets": {
6+
"lint": {
7+
"executor": "@nrwl/linter:eslint",
8+
"outputs": [
9+
"{options.outputFile}"
10+
],
11+
"options": {
12+
"lintFilePatterns": [
13+
"nx/e/**/*.ts"
14+
]
15+
}
16+
},
17+
"test": {
18+
"executor": "@nrwl/jest:jest",
19+
"outputs": [
20+
"coverage/nx/e"
21+
],
22+
"options": {
23+
"jestConfig": "nx/e/jest.config.js",
24+
"passWithNoTests": true
25+
}
26+
}
27+
},
28+
"tags": []
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "f",
3+
"version": "1.0.0"
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"root": "nx/f",
3+
"sourceRoot": "nx/f/src",
4+
"projectType": "library",
5+
"targets": {
6+
"lint": {
7+
"executor": "@nrwl/linter:eslint",
8+
"outputs": [
9+
"{options.outputFile}"
10+
],
11+
"options": {
12+
"lintFilePatterns": [
13+
"nx/f/**/*.ts"
14+
]
15+
}
16+
},
17+
"test": {
18+
"executor": "@nrwl/jest:jest",
19+
"outputs": [
20+
"coverage/nx/f"
21+
],
22+
"options": {
23+
"jestConfig": "nx/f/jest.config.js",
24+
"passWithNoTests": true
25+
}
26+
}
27+
},
28+
"tags": []
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "basic",
3+
"version": "1.0.0",
4+
"devDependencies": {
5+
"nx": "^15.0.0"
6+
}
7+
}

@commitlint/config-nx-scopes/index.test.js

+16
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,19 @@ test('returns expected value for basic nx repository', async () => {
5858
const [, , value] = await fn({cwd});
5959
expect(value).toEqual(['a', 'b']);
6060
});
61+
62+
test('expect correct result from Nx 14', async () => {
63+
const {'scope-enum': fn} = config.rules;
64+
const cwd = await npm.bootstrap('fixtures/nx14', __dirname);
65+
66+
const [, , value] = await fn({cwd});
67+
expect(value).toEqual(['c', 'd']);
68+
});
69+
70+
test('expect correct result from Nx 15', async () => {
71+
const {'scope-enum': fn} = config.rules;
72+
const cwd = await npm.bootstrap('fixtures/nx15', __dirname);
73+
74+
const [, , value] = await fn({cwd});
75+
expect(value).toEqual(['e', 'f']);
76+
});

0 commit comments

Comments
 (0)