@nx/devkit 20.5.0-rc.3 → 20.5.0
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": "20.5.0
|
3
|
+
"version": "20.5.0",
|
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. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.",
|
6
6
|
"repository": {
|
@@ -31,8 +31,11 @@ export type ProjectNameAndRootOptions = {
|
|
31
31
|
/**
|
32
32
|
* Normalized import path for the project.
|
33
33
|
*/
|
34
|
-
importPath
|
34
|
+
importPath: string;
|
35
35
|
};
|
36
36
|
export declare function determineProjectNameAndRootOptions(tree: Tree, options: ProjectGenerationOptions): Promise<ProjectNameAndRootOptions>;
|
37
37
|
export declare function resolveImportPath(tree: Tree, projectName: string, projectRoot: string): string;
|
38
|
-
export declare function
|
38
|
+
export declare function ensureRootProjectName(options: {
|
39
|
+
directory: string;
|
40
|
+
name?: string;
|
41
|
+
}, projectType: 'application' | 'library'): Promise<void>;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.determineProjectNameAndRootOptions = determineProjectNameAndRootOptions;
|
4
4
|
exports.resolveImportPath = resolveImportPath;
|
5
|
-
exports.
|
5
|
+
exports.ensureRootProjectName = ensureRootProjectName;
|
6
6
|
const enquirer_1 = require("enquirer");
|
7
7
|
const devkit_exports_1 = require("nx/src/devkit-exports");
|
8
8
|
const path_1 = require("path");
|
@@ -44,11 +44,7 @@ async function determineProjectNameAndRootOptions(tree, options) {
|
|
44
44
|
projectRoot = (0, devkit_exports_1.joinPathFragments)(relativeCwd, name);
|
45
45
|
}
|
46
46
|
}
|
47
|
-
|
48
|
-
if (options.projectType === 'library') {
|
49
|
-
importPath =
|
50
|
-
options.importPath ?? resolveImportPath(tree, name, projectRoot);
|
51
|
-
}
|
47
|
+
const importPath = options.importPath ?? resolveImportPath(tree, name, projectRoot);
|
52
48
|
return {
|
53
49
|
projectName: name,
|
54
50
|
names: {
|
@@ -74,20 +70,14 @@ function resolveImportPath(tree, projectName, projectRoot) {
|
|
74
70
|
}
|
75
71
|
return importPath;
|
76
72
|
}
|
77
|
-
async function
|
78
|
-
if (!options.name) {
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
message: `What do you want to name the ${projectType}?`,
|
84
|
-
}).then(({ name }) => (options.name = name));
|
85
|
-
}
|
86
|
-
const { projectName } = await determineProjectNameAndRootOptions(tree, {
|
87
|
-
...options,
|
88
|
-
projectType,
|
73
|
+
async function ensureRootProjectName(options, projectType) {
|
74
|
+
if (!options.name && options.directory === '.' && getRelativeCwd() === '') {
|
75
|
+
const result = await (0, enquirer_1.prompt)({
|
76
|
+
type: 'input',
|
77
|
+
name: 'name',
|
78
|
+
message: `What do you want to name the ${projectType}?`,
|
89
79
|
});
|
90
|
-
options.name =
|
80
|
+
options.name = result.name;
|
91
81
|
}
|
92
82
|
}
|
93
83
|
function validateOptions(options) {
|