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

Commit

Permalink
feat(scripts): push npm build to arbitrary tag (#1060)
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat authored and mlynch committed Aug 11, 2017
1 parent 0e567ff commit 4692688
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions scripts/publish-nightly.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,28 @@ function createTimestamp() {
('0' + (d.getUTCMinutes())).slice(-2); // MM
}

function publishToNpm() {
var command = `npm publish --tag=nightly ${process.cwd()}`;
function publishToNpm(tagName) {
var command = `npm publish --tag=${tagName} ${process.cwd()}`;
execSync(command);
}


function mainFunction() {
try {
console.log('Building Nightly ... BEGIN');
let tagName = 'nightly';
if (process.argv.length >= 3) {
tagName = process.argv[2];
}
console.log(`Building ${tagName} ... BEGIN`);
console.log('Backing up the original package.json');
backupOriginalPackageJson();
console.log('Creating the nightly version of package.json');
createNightlyVersionInPackageJson();
console.log('Publishing to npm');
publishToNpm();
publishToNpm(tagName);
console.log('Restoring original package.json');
revertPackageJson();
console.log('Building Nightly ... DONE');
console.log(`Building ${tagName}... DONE`);
}
catch (ex) {
console.log(`Something went wrong with publishing the nightly. This process modifies the package.json, so restore it before committing code! - ${ex.message}`);
Expand Down

0 comments on commit 4692688

Please sign in to comment.