Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/schematics/angular/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,18 @@ 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;
if (/[A-Z]/.test(folderName)) {
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([
Expand All @@ -270,7 +271,6 @@ export default function (options: ApplicationOptions): Rule {
...options,
relativePathToWorkspaceRoot: relativePathToWorkspaceRoot(appDir),
appName: options.name,
isRootApp,
folderName,
}),
move(appDir),
Expand Down
7 changes: 3 additions & 4 deletions packages/schematics/angular/application/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down