fix(schematics): update create-nx-workspace to use the latest stable version of the @nrwl/bazel package

This commit is contained in:
Victor Savkin 2018-06-11 10:32:59 -04:00
parent f00ff2c7d2
commit f99210a5e2
2 changed files with 8 additions and 71 deletions

View File

@ -1,67 +0,0 @@
import { checkFilesExist, createNxWorkspace, readJson } from '../utils';
/**
* Too slow to run on CI :(
*/
xdescribe('CreateNxWorkspace', () => {
it(
'should create a new workspace using npm',
() => {
const res = createNxWorkspace('proj --npmScope=myscope');
expect(res).toContain("Project 'proj' successfully created.");
const config = readJson('.angular-cli.json');
expect(config.project.name).toEqual('proj');
expect(config.project.npmScope).toEqual('myscope');
checkFilesExist('package-lock.json');
},
1000000
);
it(
'should create a new workspace using yarn',
() => {
const res = createNxWorkspace('proj --npmScope=myscope --yarn');
expect(res).toContain("Project 'proj' successfully created.");
const config = readJson('.angular-cli.json');
expect(config.project.name).toEqual('proj');
expect(config.project.npmScope).toEqual('myscope');
checkFilesExist('yarn.lock');
},
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 create a new workspace with the --bazel option',
() => {
const res = createNxWorkspace('mybazelproj --bazel');
expect(res).toContain("Project 'mybazelproj' successfully created.");
},
1000000
);
it(
'should error when no name is given',
() => {
expect(() => createNxWorkspace('')).toThrowError(
'Please provide a project name'
);
},
1000000
);
});

View File

@ -85,15 +85,19 @@ if (!projectName) {
// creating the sandbox
console.log(`Creating a sandbox with the CLI and Nx ${nxTool.name}...`);
const tmpDir = dirSync().name;
const nxVersion = readJsonFile(
path.join(path.dirname(__dirname), 'package.json')
).version;
// we haven't updated bazel to CLI6 yet
const nxVersion = parsedArgs.bazel
? '1.0.3'
: readJsonFile(path.join(path.dirname(__dirname), 'package.json')).version;
const cliVersion = parsedArgs.bazel ? '1.7.2' : '6.0.0';
writeFileSync(
path.join(tmpDir, 'package.json'),
JSON.stringify({
dependencies: {
[nxTool.packageName]: nxVersion,
'@angular/cli': '6.0.0'
'@angular/cli': cliVersion
},
license: 'MIT'
})