@nx/plugin 23.2.0-beta.5 → 23.2.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/generators/create-package/create-package.js +3 -1
- package/dist/src/generators/create-package/files/e2e/__cliName__.spec.ts__tmpl__ +3 -1
- package/dist/src/generators/create-package/schema.d.ts +2 -2
- package/dist/src/generators/create-package/schema.json +2 -2
- package/dist/src/generators/create-package/utils/normalize-schema.d.ts +1 -1
- package/dist/src/generators/e2e-project/e2e.js +6 -10
- package/dist/src/generators/e2e-project/files/src/__simplePluginName__.spec.ts__tmpl__ +4 -1
- package/dist/src/generators/e2e-project/schema.d.ts +2 -2
- package/dist/src/generators/e2e-project/schema.json +2 -2
- package/dist/src/generators/plugin/schema.d.ts +2 -2
- package/dist/src/generators/plugin/schema.json +2 -2
- package/dist/src/generators/plugin/utils/normalize-schema.d.ts +1 -1
- package/dist/src/generators/preset/generator.js +8 -4
- package/dist/src/generators/preset/schema.d.ts +4 -0
- package/dist/src/generators/preset/schema.json +5 -0
- package/package.json +7 -7
|
@@ -52,7 +52,9 @@ async function addPresetGenerator(host, schema) {
|
|
|
52
52
|
path: (0, path_1.join)(projectRoot, 'src/generators/preset/generator'),
|
|
53
53
|
unitTestRunner: schema.unitTestRunner,
|
|
54
54
|
skipFormat: true,
|
|
55
|
-
|
|
55
|
+
// Lint checks are an ESLint-only feature; asking for them under any other
|
|
56
|
+
// linter makes `pluginLintCheckGenerator` log an error and do nothing.
|
|
57
|
+
skipLintChecks: schema.linter !== 'eslint',
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
return (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(projectRoot, 'package.json'))?.name;
|
|
@@ -16,6 +16,8 @@ describe('<%= cliName %>', () => {
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
// This test shells out synchronously, so its budget has to cover a cold
|
|
20
|
+
// package manager cache. Otherwise work that succeeded still fails on return.
|
|
19
21
|
it('should be installed', () => {
|
|
20
22
|
projectDirectory = createTestProject();
|
|
21
23
|
|
|
@@ -24,7 +26,7 @@ describe('<%= cliName %>', () => {
|
|
|
24
26
|
cwd: projectDirectory,
|
|
25
27
|
stdio: 'inherit',
|
|
26
28
|
});
|
|
27
|
-
});
|
|
29
|
+
}, 180_000);
|
|
28
30
|
});
|
|
29
31
|
|
|
30
32
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
2
|
|
|
3
3
|
export interface CreatePackageSchema {
|
|
4
4
|
name: string;
|
|
@@ -9,7 +9,7 @@ export interface CreatePackageSchema {
|
|
|
9
9
|
skipFormat?: boolean;
|
|
10
10
|
tags?: string;
|
|
11
11
|
unitTestRunner?: 'jest' | 'vitest' | 'none';
|
|
12
|
-
linter?:
|
|
12
|
+
linter?: LinterType;
|
|
13
13
|
compiler?: 'swc' | 'tsc';
|
|
14
14
|
|
|
15
15
|
// options to create e2e project, passed to e2e project generator
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"description": "Test runner to use for unit tests."
|
|
38
38
|
},
|
|
39
39
|
"linter": {
|
|
40
|
-
"description": "The tool to use for running lint checks.",
|
|
40
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
41
41
|
"type": "string",
|
|
42
|
-
"enum": ["none", "eslint"]
|
|
42
|
+
"enum": ["none", "eslint", "oxlint"]
|
|
43
43
|
},
|
|
44
44
|
"tags": {
|
|
45
45
|
"type": "string",
|
|
@@ -4,7 +4,6 @@ exports.e2eProjectGenerator = e2eProjectGenerator;
|
|
|
4
4
|
exports.e2eProjectGeneratorInternal = e2eProjectGeneratorInternal;
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const eslint_1 = require("@nx/eslint");
|
|
8
7
|
const jest_1 = require("@nx/jest");
|
|
9
8
|
const js_1 = require("@nx/js");
|
|
10
9
|
const internal_2 = require("@nx/js/internal");
|
|
@@ -202,17 +201,16 @@ export { default as teardown } from './stop-local-registry';
|
|
|
202
201
|
project.targets ??= {};
|
|
203
202
|
if (project.targets.e2e) {
|
|
204
203
|
const e2eTarget = project.targets.e2e;
|
|
204
|
+
// The suites share a single tmp/test-project directory, so they have to run
|
|
205
|
+
// one at a time. Vitest 4 removed `poolOptions`, and nested options do not
|
|
206
|
+
// survive the executor's argv round-trip anyway, so use the scalar options.
|
|
205
207
|
project.targets.e2e = {
|
|
206
208
|
...e2eTarget,
|
|
207
209
|
dependsOn: [`^build`],
|
|
208
210
|
options: {
|
|
209
211
|
...e2eTarget.options,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
forks: {
|
|
213
|
-
singleFork: true,
|
|
214
|
-
},
|
|
215
|
-
},
|
|
212
|
+
maxWorkers: 1,
|
|
213
|
+
isolate: false,
|
|
216
214
|
},
|
|
217
215
|
};
|
|
218
216
|
(0, devkit_1.updateProjectConfiguration)(host, options.projectName, project);
|
|
@@ -220,18 +218,16 @@ export { default as teardown } from './stop-local-registry';
|
|
|
220
218
|
return vitestTask;
|
|
221
219
|
}
|
|
222
220
|
async function addLintingToApplication(tree, options) {
|
|
223
|
-
|
|
221
|
+
return (0, internal_2.addLintingToProject)(tree, {
|
|
224
222
|
linter: options.linter,
|
|
225
223
|
project: options.projectName,
|
|
226
224
|
tsConfigPaths: [
|
|
227
225
|
(0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.app.json'),
|
|
228
226
|
],
|
|
229
227
|
unitTestRunner: options.testRunner ?? 'jest',
|
|
230
|
-
skipFormat: true,
|
|
231
228
|
enableTypedLinting: false,
|
|
232
229
|
addPlugin: options.addPlugin,
|
|
233
230
|
});
|
|
234
|
-
return lintTask;
|
|
235
231
|
}
|
|
236
232
|
function updatePluginPackageJson(tree, options) {
|
|
237
233
|
const { root } = (0, devkit_1.readProjectConfiguration)(tree, options.pluginName);
|
|
@@ -5,6 +5,9 @@ import { mkdirSync, rmSync } from 'fs';
|
|
|
5
5
|
describe('<%= pluginName %>', () => {
|
|
6
6
|
let projectDirectory: string;
|
|
7
7
|
|
|
8
|
+
// This hook shells out synchronously twice, so its budget has to cover both
|
|
9
|
+
// installs on a cold package manager cache. Otherwise work that succeeded
|
|
10
|
+
// still fails on return.
|
|
8
11
|
beforeAll(() => {
|
|
9
12
|
projectDirectory = createTestProject();
|
|
10
13
|
|
|
@@ -15,7 +18,7 @@ describe('<%= pluginName %>', () => {
|
|
|
15
18
|
stdio: 'inherit',
|
|
16
19
|
env: process.env,
|
|
17
20
|
});
|
|
18
|
-
},
|
|
21
|
+
}, 300_000);
|
|
19
22
|
|
|
20
23
|
afterAll(() => {
|
|
21
24
|
if (projectDirectory) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
2
|
|
|
3
3
|
export interface Schema {
|
|
4
4
|
pluginName: string;
|
|
@@ -7,7 +7,7 @@ export interface Schema {
|
|
|
7
7
|
pluginOutputPath?: string;
|
|
8
8
|
jestConfig?: string;
|
|
9
9
|
testRunner?: 'jest' | 'vitest';
|
|
10
|
-
linter?:
|
|
10
|
+
linter?: LinterType;
|
|
11
11
|
skipFormat?: boolean;
|
|
12
12
|
rootProject?: boolean;
|
|
13
13
|
useProjectJson?: boolean;
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"default": "jest"
|
|
38
38
|
},
|
|
39
39
|
"linter": {
|
|
40
|
-
"description": "The tool to use for running lint checks.",
|
|
40
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
41
41
|
"type": "string",
|
|
42
|
-
"enum": ["none", "eslint"]
|
|
42
|
+
"enum": ["none", "eslint", "oxlint"]
|
|
43
43
|
},
|
|
44
44
|
"minimal": {
|
|
45
45
|
"type": "boolean",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
2
|
|
|
3
3
|
export interface Schema {
|
|
4
4
|
directory: string;
|
|
@@ -11,7 +11,7 @@ export interface Schema {
|
|
|
11
11
|
e2eProjectDirectory?: string;
|
|
12
12
|
tags?: string;
|
|
13
13
|
unitTestRunner?: 'jest' | 'vitest' | 'none';
|
|
14
|
-
linter?:
|
|
14
|
+
linter?: LinterType;
|
|
15
15
|
enableTypedLinting?: boolean;
|
|
16
16
|
/**
|
|
17
17
|
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"x-priority": "important"
|
|
33
33
|
},
|
|
34
34
|
"linter": {
|
|
35
|
-
"description": "The tool to use for running lint checks.",
|
|
35
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
36
36
|
"type": "string",
|
|
37
|
-
"enum": ["none", "eslint"],
|
|
37
|
+
"enum": ["none", "eslint", "oxlint"],
|
|
38
38
|
"x-priority": "important"
|
|
39
39
|
},
|
|
40
40
|
"unitTestRunner": {
|
|
@@ -5,6 +5,7 @@ exports.presetGeneratorInternal = presetGeneratorInternal;
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const create_package_1 = require("../create-package/create-package");
|
|
7
7
|
const plugin_1 = require("../plugin/plugin");
|
|
8
|
+
const internal_1 = require("@nx/js/internal");
|
|
8
9
|
async function presetGenerator(tree, rawOptions) {
|
|
9
10
|
return await presetGeneratorInternal(tree, {
|
|
10
11
|
addPlugin: false,
|
|
@@ -14,10 +15,10 @@ async function presetGenerator(tree, rawOptions) {
|
|
|
14
15
|
}
|
|
15
16
|
async function presetGeneratorInternal(tree, rawOptions) {
|
|
16
17
|
const tasks = [];
|
|
17
|
-
const options = normalizeOptions(rawOptions);
|
|
18
|
+
const options = await normalizeOptions(tree, rawOptions);
|
|
18
19
|
const pluginTask = await (0, plugin_1.pluginGenerator)(tree, {
|
|
19
20
|
compiler: 'tsc',
|
|
20
|
-
linter:
|
|
21
|
+
linter: options.linter,
|
|
21
22
|
skipFormat: true,
|
|
22
23
|
unitTestRunner: 'jest',
|
|
23
24
|
importPath: options.pluginName,
|
|
@@ -42,7 +43,7 @@ async function presetGeneratorInternal(tree, rawOptions) {
|
|
|
42
43
|
project: options.pluginName,
|
|
43
44
|
skipFormat: true,
|
|
44
45
|
unitTestRunner: 'jest',
|
|
45
|
-
linter:
|
|
46
|
+
linter: options.linter,
|
|
46
47
|
compiler: 'tsc',
|
|
47
48
|
useProjectJson: options.useProjectJson,
|
|
48
49
|
addPlugin: options.addPlugin,
|
|
@@ -62,7 +63,7 @@ function moveNxPluginToDevDeps(tree) {
|
|
|
62
63
|
return json;
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
|
-
function normalizeOptions(options) {
|
|
66
|
+
async function normalizeOptions(tree, options) {
|
|
66
67
|
return {
|
|
67
68
|
...options,
|
|
68
69
|
pluginName: (0, devkit_1.names)(options.pluginName.includes('/')
|
|
@@ -71,6 +72,9 @@ function normalizeOptions(options) {
|
|
|
71
72
|
createPackageName: options.createPackageName === 'false' // for command line in e2e, it is passed as a string
|
|
72
73
|
? undefined
|
|
73
74
|
: options.createPackageName,
|
|
75
|
+
// Resolved once here rather than left to the two child generators, which
|
|
76
|
+
// each prompt on their own and would ask the same question twice.
|
|
77
|
+
linter: await (0, internal_1.normalizeLinterOption)(tree, options.linter),
|
|
74
78
|
};
|
|
75
79
|
}
|
|
76
80
|
exports.default = presetGenerator;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import type { LinterType } from '@nx/js';
|
|
2
|
+
|
|
1
3
|
export interface PresetGeneratorSchema {
|
|
2
4
|
pluginName: string;
|
|
3
5
|
createPackageName?: string;
|
|
4
6
|
useProjectJson?: boolean;
|
|
5
7
|
addPlugin?: boolean;
|
|
8
|
+
linter?: LinterType;
|
|
6
9
|
}
|
|
7
10
|
|
|
8
11
|
export interface NormalizedPresetGeneratorOptions
|
|
9
12
|
extends PresetGeneratorSchema {
|
|
10
13
|
createPackageName: string;
|
|
14
|
+
linter: LinterType;
|
|
11
15
|
}
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
"type": "string",
|
|
26
26
|
"description": "Name of package which creates a workspace"
|
|
27
27
|
},
|
|
28
|
+
"linter": {
|
|
29
|
+
"description": "The tool to use for running lint checks. Defaults to the linter the workspace already uses.",
|
|
30
|
+
"type": "string",
|
|
31
|
+
"enum": ["none", "eslint", "oxlint"]
|
|
32
|
+
},
|
|
28
33
|
"useProjectJson": {
|
|
29
34
|
"type": "boolean",
|
|
30
35
|
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/plugin",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This plugin is used to create Nx plugins! It contains generators for generating common plugin features like generators, executors, migrations and more.",
|
|
6
6
|
"repository": {
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"tslib": "^2.3.0",
|
|
39
|
-
"@nx/devkit": "23.2.0-beta.
|
|
40
|
-
"@nx/jest": "23.2.0-beta.
|
|
41
|
-
"@nx/js": "23.2.0-beta.
|
|
42
|
-
"@nx/eslint": "23.2.0-beta.
|
|
39
|
+
"@nx/devkit": "23.2.0-beta.7",
|
|
40
|
+
"@nx/jest": "23.2.0-beta.7",
|
|
41
|
+
"@nx/js": "23.2.0-beta.7",
|
|
42
|
+
"@nx/eslint": "23.2.0-beta.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"nx": "23.2.0-beta.
|
|
45
|
+
"nx": "23.2.0-beta.7"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@nx/vitest": "23.2.0-beta.
|
|
48
|
+
"@nx/vitest": "23.2.0-beta.7"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"@nx/vitest": {
|