Skip to content

Commit

Permalink
fix(@schematics/angular): dasherize library package name
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva committed Jul 19, 2018
1 parent 4106a89 commit f3689f5
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 = {
root: `${projectRoot}`,
Expand Down Expand Up @@ -174,7 +174,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 @@ -187,7 +187,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 @@ -223,7 +224,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 f3689f5

Please sign in to comment.