@nx/devkit 16.9.0-beta.2 → 16.9.0-beta.4
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/devkit",
|
|
3
|
-
"version": "16.9.0-beta.
|
|
3
|
+
"version": "16.9.0-beta.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more.",
|
|
6
6
|
"repository": {
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://nx.dev",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nrwl/devkit": "16.9.0-beta.2",
|
|
32
31
|
"ejs": "^3.1.7",
|
|
33
32
|
"enquirer": "~2.3.6",
|
|
34
33
|
"ignore": "^5.0.4",
|
|
35
|
-
"semver": "7.5.3",
|
|
36
34
|
"tmp": "~0.2.1",
|
|
37
|
-
"tslib": "^2.3.0"
|
|
35
|
+
"tslib": "^2.3.0",
|
|
36
|
+
"semver": "7.5.3",
|
|
37
|
+
"@nrwl/devkit": "*"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"nx": ">= 15 <= 17"
|
|
@@ -45,6 +45,5 @@
|
|
|
45
45
|
"nx-migrations": {
|
|
46
46
|
"migrations": "./migrations.json"
|
|
47
47
|
},
|
|
48
|
-
"type": "commonjs"
|
|
49
|
-
"gitHead": "e11d538fa2c7266066d554d9405abab8e0a65040"
|
|
48
|
+
"type": "commonjs"
|
|
50
49
|
}
|
|
@@ -12,12 +12,7 @@ const deprecationWarning = stripIndents `
|
|
|
12
12
|
async function determineProjectNameAndRootOptions(tree, options) {
|
|
13
13
|
validateName(options.name, options.projectNameAndRootFormat);
|
|
14
14
|
const formats = getProjectNameAndRootFormats(tree, options);
|
|
15
|
-
const configuredDefault = getDefaultProjectNameAndRootFormat(tree);
|
|
16
|
-
if (configuredDefault === 'derived') {
|
|
17
|
-
logger.warn(deprecationWarning + '\n' + getExample(options.callingGenerator, formats));
|
|
18
|
-
}
|
|
19
15
|
const format = options.projectNameAndRootFormat ??
|
|
20
|
-
configuredDefault ??
|
|
21
16
|
(await determineFormat(tree, formats, options.callingGenerator));
|
|
22
17
|
return {
|
|
23
18
|
...formats[format],
|
|
@@ -63,6 +58,9 @@ async function determineFormat(tree, formats, callingGenerator) {
|
|
|
63
58
|
Name: ${formats['derived'].projectName}
|
|
64
59
|
Root: ${formats['derived'].projectRoot}`;
|
|
65
60
|
const derivedSelectedValue = `${formats['derived'].projectName} @ ${formats['derived'].projectRoot}`;
|
|
61
|
+
if (asProvidedSelectedValue === derivedSelectedValue) {
|
|
62
|
+
return 'as-provided';
|
|
63
|
+
}
|
|
66
64
|
const result = await (0, enquirer_1.prompt)({
|
|
67
65
|
type: 'select',
|
|
68
66
|
name: 'format',
|
|
@@ -79,36 +77,12 @@ async function determineFormat(tree, formats, callingGenerator) {
|
|
|
79
77
|
],
|
|
80
78
|
initial: 'as-provided',
|
|
81
79
|
}).then(({ format }) => format === asProvidedSelectedValue ? 'as-provided' : 'derived');
|
|
82
|
-
if (result === '
|
|
83
|
-
const { saveDefault } = await (0, enquirer_1.prompt)({
|
|
84
|
-
type: 'confirm',
|
|
85
|
-
message: `Would you like to configure Nx to always take project name and root as provided for ${callingGenerator}?`,
|
|
86
|
-
name: 'saveDefault',
|
|
87
|
-
initial: true,
|
|
88
|
-
});
|
|
89
|
-
if (saveDefault) {
|
|
90
|
-
setProjectNameAndRootFormatDefault(tree);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
logger.warn(deprecationWarning);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
80
|
+
if (result === 'derived' && callingGenerator) {
|
|
97
81
|
const example = getExample(callingGenerator, formats);
|
|
98
82
|
logger.warn(deprecationWarning + '\n' + example);
|
|
99
83
|
}
|
|
100
84
|
return result;
|
|
101
85
|
}
|
|
102
|
-
function setProjectNameAndRootFormatDefault(tree) {
|
|
103
|
-
const nxJson = readNxJson(tree);
|
|
104
|
-
nxJson.workspaceLayout ??= {};
|
|
105
|
-
nxJson.workspaceLayout.projectNameAndRootFormat = 'as-provided';
|
|
106
|
-
updateNxJson(tree, nxJson);
|
|
107
|
-
}
|
|
108
|
-
function getDefaultProjectNameAndRootFormat(tree) {
|
|
109
|
-
const nxJson = readNxJson(tree);
|
|
110
|
-
return nxJson.workspaceLayout?.projectNameAndRootFormat;
|
|
111
|
-
}
|
|
112
86
|
function getProjectNameAndRootFormats(tree, options) {
|
|
113
87
|
const name = (0, names_1.names)(options.name).fileName;
|
|
114
88
|
const directory = options.directory
|