@nx/devkit
Advanced tools
Comparing version 20.5.0-rc.3 to 20.5.0-rc.4
{ | ||
"name": "@nx/devkit", | ||
"version": "20.5.0-rc.3", | ||
"version": "20.5.0-rc.4", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "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.", |
@@ -34,6 +34,9 @@ import { type ProjectType, type Tree } from 'nx/src/devkit-exports'; | ||
*/ | ||
importPath?: string; | ||
importPath: string; | ||
}; | ||
export declare function determineProjectNameAndRootOptions(tree: Tree, options: ProjectGenerationOptions): Promise<ProjectNameAndRootOptions>; | ||
export declare function resolveImportPath(tree: Tree, projectName: string, projectRoot: string): string; | ||
export declare function ensureProjectName(tree: Tree, options: Omit<ProjectGenerationOptions, 'projectType'>, projectType: 'application' | 'library'): Promise<void>; | ||
export declare function ensureRootProjectName(options: { | ||
directory: string; | ||
name?: string; | ||
}, projectType: 'application' | 'library'): Promise<void>; |
@@ -5,3 +5,3 @@ "use strict"; | ||
exports.resolveImportPath = resolveImportPath; | ||
exports.ensureProjectName = ensureProjectName; | ||
exports.ensureRootProjectName = ensureRootProjectName; | ||
const enquirer_1 = require("enquirer"); | ||
@@ -48,7 +48,3 @@ const devkit_exports_1 = require("nx/src/devkit-exports"); | ||
} | ||
let importPath = undefined; | ||
if (options.projectType === 'library') { | ||
importPath = | ||
options.importPath ?? resolveImportPath(tree, name, projectRoot); | ||
} | ||
const importPath = options.importPath ?? resolveImportPath(tree, name, projectRoot); | ||
return { | ||
@@ -79,16 +75,10 @@ projectName: name, | ||
} | ||
async function ensureProjectName(tree, options, projectType) { | ||
if (!options.name) { | ||
if (options.directory === '.' && getRelativeCwd() === '') { | ||
const result = await (0, enquirer_1.prompt)({ | ||
type: 'input', | ||
name: 'name', | ||
message: `What do you want to name the ${projectType}?`, | ||
}).then(({ name }) => (options.name = name)); | ||
} | ||
const { projectName } = await determineProjectNameAndRootOptions(tree, { | ||
...options, | ||
projectType, | ||
async function ensureRootProjectName(options, projectType) { | ||
if (!options.name && options.directory === '.' && getRelativeCwd() === '') { | ||
const result = await (0, enquirer_1.prompt)({ | ||
type: 'input', | ||
name: 'name', | ||
message: `What do you want to name the ${projectType}?`, | ||
}); | ||
options.name = projectName; | ||
options.name = result.name; | ||
} | ||
@@ -95,0 +85,0 @@ } |
209475
5151