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

feat(scripts): push npm build to arbitrary tag #1060

Merged
merged 1 commit into from
Jun 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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