fix(schematics): fix create-nx-workspace to respect the --directory

This commit is contained in:
vsavkin 2018-03-09 10:45:09 -05:00
parent e21caa0143
commit da9310e9db
2 changed files with 15 additions and 2 deletions

View File

@ -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',
() => {

View File

@ -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 });
}