Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(angular): strip trailing slash from directory #9263 (#9314)
  • Loading branch information
Coly010 committed Mar 15, 2022
1 parent 53a0528 commit 3c39c31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Expand Up @@ -34,7 +34,7 @@ export function normalizeOptions(

const name = names(options.name).fileName;
const projectDirectory = options.directory
? `${names(options.directory).fileName}/${name}`
? `${names(options.directory).fileName}/${name}`.replace(/\/+/g, '/')
: name;

const { libsDir, npmScope, standaloneAsDefault } = getWorkspaceLayout(host);
Expand Down
7 changes: 7 additions & 0 deletions packages/angular/src/generators/library/library.spec.ts
Expand Up @@ -46,6 +46,13 @@ describe('lib', () => {
tree = createTreeWithEmptyWorkspace(2);
});

it('should run the library generator without erroring if the directory has a trailing slash', async () => {
// ACT & ASSERT
await expect(
runLibraryGeneratorWithOpts({ directory: 'mylib/shared/' })
).resolves.not.toThrow();
});

it('should default to standalone project for first project', async () => {
await runLibraryGeneratorWithOpts();
const workspaceJsonEntry = readJson(tree, 'workspace.json').projects[
Expand Down

0 comments on commit 3c39c31

Please sign in to comment.