mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 02:54:21 +08:00
feat(@schematics/angular): mark projectRoot
as non hidden option in application schematic
This option is useful to create an application outside of the `newProjectRoot`. Related to https://github.com/angular/angular-cli/pull/23994
This commit is contained in:
parent
d8bff4f1e6
commit
b06421d15e
@ -247,7 +247,6 @@ export default function (options: ApplicationOptions): Rule {
|
||||
|
||||
const workspace = await getWorkspace(host);
|
||||
const newProjectRoot = (workspace.extensions.newProjectRoot as string | undefined) || '';
|
||||
const isRootApp = options.projectRoot !== undefined;
|
||||
|
||||
// If scoped project (i.e. "@foo/bar"), convert dir to "foo/bar".
|
||||
let folderName = options.name.startsWith('@') ? options.name.slice(1) : options.name;
|
||||
@ -255,9 +254,11 @@ export default function (options: ApplicationOptions): Rule {
|
||||
folderName = strings.dasherize(folderName);
|
||||
}
|
||||
|
||||
const appDir = isRootApp
|
||||
? normalize(options.projectRoot || '')
|
||||
: join(normalize(newProjectRoot), folderName);
|
||||
const appDir =
|
||||
options.projectRoot === undefined
|
||||
? join(normalize(newProjectRoot), folderName)
|
||||
: normalize(options.projectRoot);
|
||||
|
||||
const sourceDir = `${appDir}/src/app`;
|
||||
|
||||
return chain([
|
||||
@ -270,7 +271,6 @@ export default function (options: ApplicationOptions): Rule {
|
||||
...options,
|
||||
relativePathToWorkspaceRoot: relativePathToWorkspaceRoot(appDir),
|
||||
appName: options.name,
|
||||
isRootApp,
|
||||
folderName,
|
||||
}),
|
||||
move(appDir),
|
||||
|
@ -7,12 +7,11 @@
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"projectRoot": {
|
||||
"description": "The root directory of the new app.",
|
||||
"type": "string",
|
||||
"visible": false
|
||||
"description": "The root directory of the new application.",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the new app.",
|
||||
"description": "The name of the new application.",
|
||||
"type": "string",
|
||||
"pattern": "^(?:@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*/)?[a-zA-Z0-9-~][a-zA-Z0-9-._~]*$",
|
||||
"$default": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user