Skip to content

Commit

Permalink
fix(schematics): fix create-nx-workspace to respect the --directory
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin committed Mar 9, 2018
1 parent e21caa0 commit da9310e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions e2e/schematics/create-nx-workspace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ xdescribe('CreateNxWorkspace', () => {
1000000
);

it(
'should create a new workspace with the --directory option',
() => {
const res = createNxWorkspace('myproj --npmScope=myscope --directory=proj');
expect(res).toContain("Project 'myproj' successfully created.");
checkFilesExist('package-lock.json');
},
1000000
);

it(
'should error when no name is given',
() => {
Expand Down
7 changes: 5 additions & 2 deletions packages/schematics/bin/create-nx-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ execSync(
}
);

const dir = process.argv.filter(a => a.startsWith('-dir') || a.startsWith('--directory'))[0];
const cwd = dir ? dir.split('=')[1] : projectName;

if (useYarn) {
execSync(`yarn install`, { stdio: [0, 1, 2], cwd: projectName });
execSync(`yarn install`, { stdio: [0, 1, 2], cwd });
} else {
execSync(`npm install`, { stdio: [0, 1, 2], cwd: projectName });
execSync(`npm install`, { stdio: [0, 1, 2], cwd });
}

0 comments on commit da9310e

Please sign in to comment.