forked from getsentry/sentry-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage-and-upload-to-zeus.js
More file actions
35 lines (31 loc) · 1017 Bytes
/
package-and-upload-to-zeus.js
File metadata and controls
35 lines (31 loc) · 1017 Bytes
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
const { promisify } = require('util');
const exec = promisify(require('child_process').exec);
const join = require('path').join;
(async () => {
const result = (await exec('yarn lerna changed --include-merged-tags -p')).stdout;
const lines = result.split('\n');
if (
!/^yarn/.test(lines[0]) ||
!/lerna changed/.test(lines[1]) ||
!/^Done/.test(lines[lines.length - 2]) ||
lines.length < 4
) {
throw new Error('missing output from lerna changed');
}
const changedPackagesFolders = lines.filter(line => {
return /^\//.test(line);
});
console.log('---------------------');
console.log('Changed Packages:');
console.log(changedPackagesFolders);
console.log('---------------------');
await Promise.all(
changedPackagesFolders.map(async folder => {
const archive = (await exec(`cd ${folder}; npm pack`)).stdout.trim();
return promisify(exec)(`zeus upload ${join(folder, archive)}`);
}),
);
})().catch(e => {
console.error(e);
process.exit(1);
});