@nx/devkit 16.7.0-beta.4 → 16.7.0-beta.6
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.7.0-beta.
|
|
3
|
+
"version": "16.7.0-beta.6",
|
|
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,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://nx.dev",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nrwl/devkit": "16.7.0-beta.
|
|
31
|
+
"@nrwl/devkit": "16.7.0-beta.6",
|
|
32
32
|
"ejs": "^3.1.7",
|
|
33
33
|
"enquirer": "~2.3.6",
|
|
34
34
|
"ignore": "^5.0.4",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"migrations": "./migrations.json"
|
|
47
47
|
},
|
|
48
48
|
"type": "commonjs",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "d1ffe58644851335f18da1d60b1a60882347aff9"
|
|
50
50
|
}
|
|
@@ -17,9 +17,9 @@ export type ProjectNameAndRootOptions = {
|
|
|
17
17
|
*/
|
|
18
18
|
projectName: string;
|
|
19
19
|
/**
|
|
20
|
-
* Normalized project
|
|
20
|
+
* Normalized project root, including the layout directory if configured.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
projectRoot: string;
|
|
23
23
|
names: {
|
|
24
24
|
/**
|
|
25
25
|
* Normalized project name without scope. It's meant to be used when
|
|
@@ -13,7 +13,7 @@ function determineProjectNameAndRootOptions(tree, options) {
|
|
|
13
13
|
validateName(options.name, options.projectNameAndRootFormat);
|
|
14
14
|
const formats = getProjectNameAndRootFormats(tree, options);
|
|
15
15
|
const format = (_a = options.projectNameAndRootFormat) !== null && _a !== void 0 ? _a : (yield determineFormat(formats));
|
|
16
|
-
return formats[format]
|
|
16
|
+
return formats[format];
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
exports.determineProjectNameAndRootOptions = determineProjectNameAndRootOptions;
|
|
@@ -45,22 +45,30 @@ function determineFormat(formats) {
|
|
|
45
45
|
if (process.env.NX_INTERACTIVE !== 'true' || !isTTY()) {
|
|
46
46
|
return 'derived';
|
|
47
47
|
}
|
|
48
|
+
const asProvidedDescription = `As provided:
|
|
49
|
+
Name: ${formats['as-provided'].projectName}
|
|
50
|
+
Root: ${formats['as-provided'].projectRoot}`;
|
|
51
|
+
const asProvidedSelectedValue = `${formats['as-provided'].projectName} @ ${formats['as-provided'].projectRoot}`;
|
|
52
|
+
const derivedDescription = `Derived:
|
|
53
|
+
Name: ${formats['derived'].projectName}
|
|
54
|
+
Root: ${formats['derived'].projectRoot}`;
|
|
55
|
+
const derivedSelectedValue = `${formats['derived'].projectName} @ ${formats['derived'].projectRoot} (This was derived from the folder structure. Please provide the exact name and directory in the future)`;
|
|
48
56
|
return yield (0, enquirer_1.prompt)({
|
|
49
57
|
type: 'select',
|
|
50
58
|
name: 'format',
|
|
51
59
|
message: 'What should be the project name and where should it be generated?',
|
|
52
60
|
choices: [
|
|
53
61
|
{
|
|
54
|
-
message:
|
|
55
|
-
name:
|
|
62
|
+
message: asProvidedDescription,
|
|
63
|
+
name: asProvidedSelectedValue,
|
|
56
64
|
},
|
|
57
65
|
{
|
|
58
|
-
message:
|
|
59
|
-
name:
|
|
66
|
+
message: derivedDescription,
|
|
67
|
+
name: derivedSelectedValue,
|
|
60
68
|
},
|
|
61
69
|
],
|
|
62
70
|
initial: 'as-provided',
|
|
63
|
-
}).then(({ format }) => format);
|
|
71
|
+
}).then(({ format }) => format === asProvidedSelectedValue ? 'as-provided' : 'derived');
|
|
64
72
|
});
|
|
65
73
|
}
|
|
66
74
|
function getProjectNameAndRootFormats(tree, options) {
|
|
@@ -77,18 +85,13 @@ function getProjectNameAndRootFormats(tree, options) {
|
|
|
77
85
|
const nameWithoutScope = asProvidedProjectName.split('/')[1];
|
|
78
86
|
return {
|
|
79
87
|
'as-provided': {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
projectName: asProvidedProjectName,
|
|
85
|
-
names: {
|
|
86
|
-
projectSimpleName: nameWithoutScope,
|
|
87
|
-
projectFileName: nameWithoutScope,
|
|
88
|
-
},
|
|
89
|
-
importPath: (_b = options.importPath) !== null && _b !== void 0 ? _b : asProvidedProjectName,
|
|
90
|
-
projectDirectory: asProvidedProjectDirectory,
|
|
88
|
+
projectName: asProvidedProjectName,
|
|
89
|
+
names: {
|
|
90
|
+
projectSimpleName: nameWithoutScope,
|
|
91
|
+
projectFileName: nameWithoutScope,
|
|
91
92
|
},
|
|
93
|
+
importPath: (_b = options.importPath) !== null && _b !== void 0 ? _b : asProvidedProjectName,
|
|
94
|
+
projectRoot: asProvidedProjectDirectory,
|
|
92
95
|
},
|
|
93
96
|
};
|
|
94
97
|
}
|
|
@@ -132,32 +135,22 @@ function getProjectNameAndRootFormats(tree, options) {
|
|
|
132
135
|
}
|
|
133
136
|
return {
|
|
134
137
|
'as-provided': {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
projectName: asProvidedProjectName,
|
|
140
|
-
names: {
|
|
141
|
-
projectSimpleName: asProvidedProjectName,
|
|
142
|
-
projectFileName: asProvidedProjectName,
|
|
143
|
-
},
|
|
144
|
-
importPath: asProvidedImportPath,
|
|
145
|
-
projectDirectory: asProvidedProjectDirectory,
|
|
138
|
+
projectName: asProvidedProjectName,
|
|
139
|
+
names: {
|
|
140
|
+
projectSimpleName: asProvidedProjectName,
|
|
141
|
+
projectFileName: asProvidedProjectName,
|
|
146
142
|
},
|
|
143
|
+
importPath: asProvidedImportPath,
|
|
144
|
+
projectRoot: asProvidedProjectDirectory,
|
|
147
145
|
},
|
|
148
146
|
derived: {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
projectName: derivedProjectName,
|
|
154
|
-
names: {
|
|
155
|
-
projectSimpleName: derivedSimpleProjectName,
|
|
156
|
-
projectFileName: derivedProjectName,
|
|
157
|
-
},
|
|
158
|
-
importPath: derivedImportPath,
|
|
159
|
-
projectDirectory: derivedProjectDirectory,
|
|
147
|
+
projectName: derivedProjectName,
|
|
148
|
+
names: {
|
|
149
|
+
projectSimpleName: derivedSimpleProjectName,
|
|
150
|
+
projectFileName: derivedProjectName,
|
|
160
151
|
},
|
|
152
|
+
importPath: derivedImportPath,
|
|
153
|
+
projectRoot: derivedProjectDirectory,
|
|
161
154
|
},
|
|
162
155
|
};
|
|
163
156
|
}
|