forked from OHIF/Viewers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish-package.mjs
40 lines (36 loc) · 889 Bytes
/
publish-package.mjs
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
import { execa } from 'execa';
async function run() {
const { stdout: branchName } = await execa('git', [
'rev-parse',
'--abbrev-ref',
'HEAD',
]);
// using the environment variable NPM_TOKEN, create a .npmrc file
// and set the token to the value of the environment variable
// Publishing each package, if on master/main branch publish beta versions
// otherwise publish latest
if (branchName === 'release') {
await execa('npx', [
'lerna',
'publish',
'from-package',
'--no-verify-access',
'--yes',
]);
} else {
await execa('npx', [
'lerna',
'publish',
'from-package',
'--no-verify-access',
'--yes',
'--dist-tag',
'beta',
]);
}
console.log('Finished');
}
run().catch(err => {
console.error('Error encountered during package publish:', err);
process.exit(1);
});