Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 4e93f60

Browse files
authored
feat(scripts): push npm build to arbitrary tag (#1060)
1 parent 52b6bb5 commit 4e93f60

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

scripts/publish-nightly.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,28 @@ function createTimestamp() {
3838
('0' + (d.getUTCMinutes())).slice(-2); // MM
3939
}
4040

41-
function publishToNpm() {
42-
var command = `npm publish --tag=nightly ${process.cwd()}`;
41+
function publishToNpm(tagName) {
42+
var command = `npm publish --tag=${tagName} ${process.cwd()}`;
4343
execSync(command);
4444
}
4545

4646

4747
function mainFunction() {
4848
try {
49-
console.log('Building Nightly ... BEGIN');
49+
let tagName = 'nightly';
50+
if (process.argv.length >= 3) {
51+
tagName = process.argv[2];
52+
}
53+
console.log(`Building ${tagName} ... BEGIN`);
5054
console.log('Backing up the original package.json');
5155
backupOriginalPackageJson();
5256
console.log('Creating the nightly version of package.json');
5357
createNightlyVersionInPackageJson();
5458
console.log('Publishing to npm');
55-
publishToNpm();
59+
publishToNpm(tagName);
5660
console.log('Restoring original package.json');
5761
revertPackageJson();
58-
console.log('Building Nightly ... DONE');
62+
console.log(`Building ${tagName}... DONE`);
5963
}
6064
catch (ex) {
6165
console.log(`Something went wrong with publishing the nightly. This process modifies the package.json, so restore it before committing code! - ${ex.message}`);

0 commit comments

Comments
 (0)