-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-ci.js
executable file
·47 lines (36 loc) · 1.21 KB
/
build-ci.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const shell = require('shelljs');
const process = require('process');
const createExecYarn = package => args => {
shell.config.execPath = shell.which('node').toString();
const { code } = shell.exec(
`yarn ${(package && `workspace ${package}`) || ''} ${(args || []).join(' ')}`
);
if (code !== 0) {
console.error('Failing build due to last error.');
process.exit(1);
}
};
const packages = ['nuget-extensions-lib', 'nuget-extensions', 'nuget-extensions-vscode'];
createExecYarn()();
packages.reduce((_, package) => {
const execYarn = createExecYarn(package);
console.log(`\nBuilding ${package}\n`);
if (package === 'nuget-extensions-vscode') {
execYarn(['link', 'nuget-extensions-lib']);
}
execYarn(['build']);
if (package === 'nuget-extensions-lib') {
// yarn install destroys symlinks (in devDependency deps), make sure `yarn jest` works.
execYarn(['add', '--dev', 'jest-cli']);
execYarn(['link']);
}
// The current travis.yml doesn't support launching VSCode windows for integration tests.
if (package === 'nuget-extensions-lib') {
execYarn(['test', '--coverage']);
}
// Only release from Travis, not Appveyor.
if (process.env.TRAVIS) {
execYarn(['semantic-release']);
}
return _;
}, {});