@nx/node 0.0.0-pr-27957-a99d5ea → 0.0.0-pr-28229-afe192c
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/package.json +6 -7
- package/src/generators/application/application.js +2 -9
- package/src/generators/application/files/common/tsconfig.app.json +0 -1
- package/src/generators/application/schema.d.ts +2 -5
- package/src/generators/application/schema.json +7 -19
- package/src/generators/e2e-project/e2e-project.js +2 -7
- package/src/generators/e2e-project/schema.d.ts +0 -3
- package/src/generators/e2e-project/schema.json +0 -5
- package/src/generators/library/library.js +5 -15
- package/src/generators/library/schema.d.ts +2 -5
- package/src/generators/library/schema.json +9 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/node",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-28229-afe192c",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Node Plugin for Nx contains generators to manage Node applications within an Nx workspace.",
|
|
6
6
|
"repository": {
|
|
@@ -32,15 +32,14 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"tslib": "^2.3.0",
|
|
35
|
-
"@nx/devkit": "0.0.0-pr-
|
|
36
|
-
"@nx/jest": "0.0.0-pr-
|
|
37
|
-
"@nx/js": "0.0.0-pr-
|
|
38
|
-
"@nx/eslint": "0.0.0-pr-
|
|
39
|
-
"@nrwl/node": "0.0.0-pr-27957-a99d5ea"
|
|
35
|
+
"@nx/devkit": "0.0.0-pr-28229-afe192c",
|
|
36
|
+
"@nx/jest": "0.0.0-pr-28229-afe192c",
|
|
37
|
+
"@nx/js": "0.0.0-pr-28229-afe192c",
|
|
38
|
+
"@nx/eslint": "0.0.0-pr-28229-afe192c"
|
|
40
39
|
},
|
|
41
40
|
"publishConfig": {
|
|
42
41
|
"access": "public"
|
|
43
42
|
},
|
|
44
43
|
"type": "commonjs",
|
|
45
44
|
"types": "./index.d.ts"
|
|
46
|
-
}
|
|
45
|
+
}
|
|
@@ -152,9 +152,6 @@ function addAppFiles(tree, options) {
|
|
|
152
152
|
if (options.js) {
|
|
153
153
|
(0, devkit_1.toJS)(tree);
|
|
154
154
|
}
|
|
155
|
-
if (options.pascalCaseFiles) {
|
|
156
|
-
devkit_1.logger.warn('NOTE: --pascalCaseFiles is a noop');
|
|
157
|
-
}
|
|
158
155
|
}
|
|
159
156
|
function addProxy(tree, options) {
|
|
160
157
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.frontendProject);
|
|
@@ -275,7 +272,6 @@ function updateTsConfigOptions(tree, options) {
|
|
|
275
272
|
async function applicationGenerator(tree, schema) {
|
|
276
273
|
return await applicationGeneratorInternal(tree, {
|
|
277
274
|
addPlugin: false,
|
|
278
|
-
projectNameAndRootFormat: 'derived',
|
|
279
275
|
...schema,
|
|
280
276
|
});
|
|
281
277
|
}
|
|
@@ -363,7 +359,6 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
363
359
|
projectType: options.framework === 'none' ? 'cli' : 'server',
|
|
364
360
|
name: options.rootProject ? 'e2e' : `${options.name}-e2e`,
|
|
365
361
|
directory: options.rootProject ? 'e2e' : `${options.appProjectRoot}-e2e`,
|
|
366
|
-
projectNameAndRootFormat: 'as-provided',
|
|
367
362
|
project: options.name,
|
|
368
363
|
port: options.port,
|
|
369
364
|
isNest: options.isNest,
|
|
@@ -394,16 +389,14 @@ async function applicationGeneratorInternal(tree, schema) {
|
|
|
394
389
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
395
390
|
}
|
|
396
391
|
async function normalizeOptions(host, options) {
|
|
397
|
-
|
|
392
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
|
|
393
|
+
const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
398
394
|
name: options.name,
|
|
399
395
|
projectType: 'application',
|
|
400
396
|
directory: options.directory,
|
|
401
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
402
397
|
rootProject: options.rootProject,
|
|
403
|
-
callingGenerator: '@nx/node:application',
|
|
404
398
|
});
|
|
405
399
|
options.rootProject = appProjectRoot === '.';
|
|
406
|
-
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
|
407
400
|
options.bundler = options.bundler ?? 'esbuild';
|
|
408
401
|
options.e2eTestRunner = options.e2eTestRunner ?? 'jest';
|
|
409
402
|
const parsedTags = options.tags
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
1
|
import type { Linter, LinterType } from '@nx/eslint';
|
|
3
2
|
|
|
4
3
|
export interface Schema {
|
|
5
|
-
|
|
4
|
+
directory: string;
|
|
5
|
+
name?: string;
|
|
6
6
|
skipFormat?: boolean;
|
|
7
7
|
skipPackageJson?: boolean;
|
|
8
|
-
directory?: string;
|
|
9
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
10
8
|
unitTestRunner?: 'jest' | 'none';
|
|
11
9
|
e2eTestRunner?: 'jest' | 'none';
|
|
12
10
|
linter?: Linter | LinterType;
|
|
@@ -16,7 +14,6 @@ export interface Schema {
|
|
|
16
14
|
/** @deprecated use `swcJest` instead */
|
|
17
15
|
babelJest?: boolean;
|
|
18
16
|
js?: boolean;
|
|
19
|
-
pascalCaseFiles?: boolean;
|
|
20
17
|
setParserOptionsProject?: boolean;
|
|
21
18
|
standaloneConfig?: boolean;
|
|
22
19
|
bundler?: 'esbuild' | 'webpack';
|
|
@@ -6,27 +6,21 @@
|
|
|
6
6
|
"description": "Nx Application Options Schema.",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
9
|
-
"
|
|
10
|
-
"description": "The
|
|
9
|
+
"directory": {
|
|
10
|
+
"description": "The directory of the new application.",
|
|
11
11
|
"type": "string",
|
|
12
12
|
"$default": {
|
|
13
13
|
"$source": "argv",
|
|
14
14
|
"index": 0
|
|
15
15
|
},
|
|
16
|
-
"x-prompt": "
|
|
17
|
-
"x-priority": "important",
|
|
18
|
-
"pattern": "^[a-zA-Z][^:]*$"
|
|
16
|
+
"x-prompt": "Which directory do you want to create the application in?"
|
|
19
17
|
},
|
|
20
|
-
"
|
|
21
|
-
"description": "The
|
|
18
|
+
"name": {
|
|
19
|
+
"description": "The name of the application.",
|
|
22
20
|
"type": "string",
|
|
21
|
+
"pattern": "^[a-zA-Z][^:]*$",
|
|
23
22
|
"x-priority": "important"
|
|
24
23
|
},
|
|
25
|
-
"projectNameAndRootFormat": {
|
|
26
|
-
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
27
|
-
"type": "string",
|
|
28
|
-
"enum": ["as-provided", "derived"]
|
|
29
|
-
},
|
|
30
24
|
"skipFormat": {
|
|
31
25
|
"description": "Skip formatting files",
|
|
32
26
|
"type": "boolean",
|
|
@@ -72,12 +66,6 @@
|
|
|
72
66
|
"default": false,
|
|
73
67
|
"x-deprecated": "Use --swcJest instead for faster compilation"
|
|
74
68
|
},
|
|
75
|
-
"pascalCaseFiles": {
|
|
76
|
-
"type": "boolean",
|
|
77
|
-
"description": "Use pascal case file names.",
|
|
78
|
-
"alias": "P",
|
|
79
|
-
"default": false
|
|
80
|
-
},
|
|
81
69
|
"js": {
|
|
82
70
|
"type": "boolean",
|
|
83
71
|
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
@@ -132,5 +120,5 @@
|
|
|
132
120
|
"description": "Add a docker build target"
|
|
133
121
|
}
|
|
134
122
|
},
|
|
135
|
-
"required": ["
|
|
123
|
+
"required": ["directory"]
|
|
136
124
|
}
|
|
@@ -14,7 +14,6 @@ const config_file_1 = require("@nx/jest/src/utils/config/config-file");
|
|
|
14
14
|
async function e2eProjectGenerator(host, options) {
|
|
15
15
|
return await e2eProjectGeneratorInternal(host, {
|
|
16
16
|
addPlugin: false,
|
|
17
|
-
projectNameAndRootFormat: 'derived',
|
|
18
17
|
...options,
|
|
19
18
|
});
|
|
20
19
|
}
|
|
@@ -127,15 +126,11 @@ async function e2eProjectGeneratorInternal(host, _options) {
|
|
|
127
126
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
128
127
|
}
|
|
129
128
|
async function normalizeOptions(tree, options) {
|
|
129
|
+
options.directory = options.directory ?? `${options.project}-e2e`;
|
|
130
130
|
const { projectName: e2eProjectName, projectRoot: e2eProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
|
131
|
-
name: options.name
|
|
131
|
+
name: options.name,
|
|
132
132
|
projectType: 'library',
|
|
133
133
|
directory: options.rootProject ? 'e2e' : options.directory,
|
|
134
|
-
projectNameAndRootFormat: options.rootProject
|
|
135
|
-
? 'as-provided'
|
|
136
|
-
: options.projectNameAndRootFormat,
|
|
137
|
-
// this is an internal generator, don't save defaults
|
|
138
|
-
callingGenerator: null,
|
|
139
134
|
});
|
|
140
135
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
141
136
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
|
-
|
|
3
1
|
export interface Schema {
|
|
4
2
|
project: string;
|
|
5
3
|
projectType: 'server' | 'cli';
|
|
6
4
|
directory?: string;
|
|
7
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
8
5
|
name?: string;
|
|
9
6
|
port?: number;
|
|
10
7
|
linter?: 'eslint' | 'none';
|
|
@@ -18,11 +18,6 @@
|
|
|
18
18
|
"type": "string",
|
|
19
19
|
"x-priority": "important"
|
|
20
20
|
},
|
|
21
|
-
"projectNameAndRootFormat": {
|
|
22
|
-
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
23
|
-
"type": "string",
|
|
24
|
-
"enum": ["as-provided", "derived"]
|
|
25
|
-
},
|
|
26
21
|
"name": {
|
|
27
22
|
"description": "The name of the e2e project. Defaults to the project name with '-e2e' suffix.",
|
|
28
23
|
"type": "string"
|
|
@@ -14,7 +14,6 @@ const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaul
|
|
|
14
14
|
async function libraryGenerator(tree, schema) {
|
|
15
15
|
return await libraryGeneratorInternal(tree, {
|
|
16
16
|
addPlugin: false,
|
|
17
|
-
projectNameAndRootFormat: 'derived',
|
|
18
17
|
...schema,
|
|
19
18
|
});
|
|
20
19
|
}
|
|
@@ -52,25 +51,20 @@ async function libraryGeneratorInternal(tree, schema) {
|
|
|
52
51
|
}
|
|
53
52
|
exports.default = libraryGenerator;
|
|
54
53
|
async function normalizeOptions(tree, options) {
|
|
55
|
-
|
|
54
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'library');
|
|
55
|
+
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
|
56
56
|
name: options.name,
|
|
57
57
|
projectType: 'library',
|
|
58
58
|
directory: options.directory,
|
|
59
59
|
importPath: options.importPath,
|
|
60
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
61
|
-
callingGenerator: '@nx/node:library',
|
|
62
60
|
});
|
|
63
|
-
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
|
64
61
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
65
62
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
66
63
|
nxJson.useInferencePlugins !== false;
|
|
67
64
|
options.addPlugin ??= addPluginDefault;
|
|
68
|
-
const fileName =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
: projectNames.projectFileName,
|
|
72
|
-
pascalCaseFiles: options.pascalCaseFiles,
|
|
73
|
-
});
|
|
65
|
+
const fileName = (0, devkit_1.names)(options.simpleModuleName
|
|
66
|
+
? projectNames.projectSimpleName
|
|
67
|
+
: projectNames.projectFileName).fileName;
|
|
74
68
|
const parsedTags = options.tags
|
|
75
69
|
? options.tags.split(',').map((s) => s.trim())
|
|
76
70
|
: [];
|
|
@@ -83,10 +77,6 @@ async function normalizeOptions(tree, options) {
|
|
|
83
77
|
importPath,
|
|
84
78
|
};
|
|
85
79
|
}
|
|
86
|
-
function getCaseAwareFileName(options) {
|
|
87
|
-
const normalized = (0, devkit_1.names)(options.fileName);
|
|
88
|
-
return options.pascalCaseFiles ? normalized.className : normalized.fileName;
|
|
89
|
-
}
|
|
90
80
|
function createFiles(tree, options) {
|
|
91
81
|
const { className, name, propertyName } = (0, devkit_1.names)(options.fileName);
|
|
92
82
|
(0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files/lib'), options.projectRoot, {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
|
|
2
1
|
import type { Linter, LinterType } from '@nx/eslint';
|
|
3
2
|
|
|
4
3
|
export interface Schema {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
projectNameAndRootFormat?: ProjectNameAndRootFormat;
|
|
4
|
+
directory: string;
|
|
5
|
+
name?: string;
|
|
8
6
|
simpleModuleName?: boolean;
|
|
9
7
|
skipTsConfig?: boolean;
|
|
10
8
|
skipFormat?: boolean;
|
|
@@ -18,7 +16,6 @@ export interface Schema {
|
|
|
18
16
|
rootDir?: string;
|
|
19
17
|
babelJest?: boolean;
|
|
20
18
|
js?: boolean;
|
|
21
|
-
pascalCaseFiles?: boolean;
|
|
22
19
|
strict?: boolean;
|
|
23
20
|
standaloneConfig?: boolean;
|
|
24
21
|
setParserOptionsProject?: boolean;
|
|
@@ -12,29 +12,24 @@
|
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
14
|
"properties": {
|
|
15
|
-
"
|
|
15
|
+
"directory": {
|
|
16
16
|
"type": "string",
|
|
17
|
-
"description": "
|
|
17
|
+
"description": "A directory where the lib is placed",
|
|
18
|
+
"alias": "dir",
|
|
18
19
|
"$default": {
|
|
19
20
|
"$source": "argv",
|
|
20
21
|
"index": 0
|
|
21
22
|
},
|
|
22
|
-
"x-prompt": "
|
|
23
|
-
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
|
|
23
|
+
"x-prompt": "Which directory do you want to create the library in?"
|
|
24
24
|
},
|
|
25
|
-
"
|
|
25
|
+
"name": {
|
|
26
26
|
"type": "string",
|
|
27
|
-
"description": "
|
|
28
|
-
"
|
|
27
|
+
"description": "Library name",
|
|
28
|
+
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
|
|
29
29
|
"x-priority": "important"
|
|
30
30
|
},
|
|
31
|
-
"projectNameAndRootFormat": {
|
|
32
|
-
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
33
|
-
"type": "string",
|
|
34
|
-
"enum": ["as-provided", "derived"]
|
|
35
|
-
},
|
|
36
31
|
"simpleModuleName": {
|
|
37
|
-
"description": "Keep the module name simple
|
|
32
|
+
"description": "Keep the module name simple.",
|
|
38
33
|
"type": "boolean",
|
|
39
34
|
"default": false
|
|
40
35
|
},
|
|
@@ -104,12 +99,6 @@
|
|
|
104
99
|
"description": "Use `babel` instead of `ts-jest`.",
|
|
105
100
|
"default": false
|
|
106
101
|
},
|
|
107
|
-
"pascalCaseFiles": {
|
|
108
|
-
"type": "boolean",
|
|
109
|
-
"description": "Use pascal case file names.",
|
|
110
|
-
"alias": "P",
|
|
111
|
-
"default": false
|
|
112
|
-
},
|
|
113
102
|
"js": {
|
|
114
103
|
"type": "boolean",
|
|
115
104
|
"description": "Generate JavaScript files rather than TypeScript files.",
|
|
@@ -132,5 +121,5 @@
|
|
|
132
121
|
"default": false
|
|
133
122
|
}
|
|
134
123
|
},
|
|
135
|
-
"required": ["
|
|
124
|
+
"required": ["directory"]
|
|
136
125
|
}
|