Skip to content

Commit

Permalink
fix(@schematics/angular): dasherize library package name
Browse files Browse the repository at this point in the history
Fix #11017
  • Loading branch information
filipesilva committed Sep 26, 2018
1 parent 91cf2d7 commit abb98eb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/schematics/angular/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function addDependenciesToPackageJson() {
}

function addAppToWorkspaceFile(options: LibraryOptions, workspace: WorkspaceSchema,
projectRoot: string, packageName: string): Rule {
projectRoot: string, projectName: string): Rule {

const project: WorkspaceProject<ProjectType.Library> = {
root: projectRoot,
Expand Down Expand Up @@ -169,7 +169,7 @@ function addAppToWorkspaceFile(options: LibraryOptions, workspace: WorkspaceSche
},
};

return addProjectToWorkspace(workspace, packageName, project);
return addProjectToWorkspace(workspace, projectName, project);
}

export default function (options: LibraryOptions): Rule {
Expand All @@ -182,7 +182,8 @@ export default function (options: LibraryOptions): Rule {
validateProjectName(options.name);

// If scoped project (i.e. "@foo/bar"), convert projectDir to "foo/bar".
const packageName = options.name;
const projectName = options.name;
const packageName = strings.dasherize(projectName);
let scopeName = null;
if (/^@.*\/.*/.test(options.name)) {
const [scope, name] = options.name.split('/');
Expand Down Expand Up @@ -218,7 +219,7 @@ export default function (options: LibraryOptions): Rule {

return chain([
branchAndMerge(mergeWith(templateSource)),
addAppToWorkspaceFile(options, workspace, projectRoot, packageName),
addAppToWorkspaceFile(options, workspace, projectRoot, projectName),
options.skipPackageJson ? noop() : addDependenciesToPackageJson(),
options.skipTsConfig ? noop() : updateTsConfig(packageName, distRoot),
schematic('module', {
Expand Down

0 comments on commit abb98eb

Please sign in to comment.