Skip to content

Commit b06421d

Browse files
alan-agius4clydin
authored andcommitted
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 #23994
1 parent d8bff4f commit b06421d

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

packages/schematics/angular/application/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,18 @@ export default function (options: ApplicationOptions): Rule {
247247

248248
const workspace = await getWorkspace(host);
249249
const newProjectRoot = (workspace.extensions.newProjectRoot as string | undefined) || '';
250-
const isRootApp = options.projectRoot !== undefined;
251250

252251
// If scoped project (i.e. "@foo/bar"), convert dir to "foo/bar".
253252
let folderName = options.name.startsWith('@') ? options.name.slice(1) : options.name;
254253
if (/[A-Z]/.test(folderName)) {
255254
folderName = strings.dasherize(folderName);
256255
}
257256

258-
const appDir = isRootApp
259-
? normalize(options.projectRoot || '')
260-
: join(normalize(newProjectRoot), folderName);
257+
const appDir =
258+
options.projectRoot === undefined
259+
? join(normalize(newProjectRoot), folderName)
260+
: normalize(options.projectRoot);
261+
261262
const sourceDir = `${appDir}/src/app`;
262263

263264
return chain([
@@ -270,7 +271,6 @@ export default function (options: ApplicationOptions): Rule {
270271
...options,
271272
relativePathToWorkspaceRoot: relativePathToWorkspaceRoot(appDir),
272273
appName: options.name,
273-
isRootApp,
274274
folderName,
275275
}),
276276
move(appDir),

packages/schematics/angular/application/schema.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
"additionalProperties": false,
88
"properties": {
99
"projectRoot": {
10-
"description": "The root directory of the new app.",
11-
"type": "string",
12-
"visible": false
10+
"description": "The root directory of the new application.",
11+
"type": "string"
1312
},
1413
"name": {
15-
"description": "The name of the new app.",
14+
"description": "The name of the new application.",
1615
"type": "string",
1716
"pattern": "^(?:@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*/)?[a-zA-Z0-9-~][a-zA-Z0-9-._~]*$",
1817
"$default": {

0 commit comments

Comments
 (0)