chore(publish): a way to re-try in case something happens

This commit is contained in:
Ibby Hadeed 2017-03-24 15:42:52 -04:00
parent df64486a13
commit 150b236468

View File

@ -13,6 +13,7 @@ const FLAGS = '--access public'; // add any flags here if you want... (example:
const PACKAGES = fs.readdirSync(DIST); const PACKAGES = fs.readdirSync(DIST);
const failedPackages = [];
const QUEUE = queue({ const QUEUE = queue({
concurrency: 10 concurrency: 10
@ -26,7 +27,15 @@ PACKAGES.forEach(packageName => {
const packagePath = path.resolve(DIST, packageName); const packagePath = path.resolve(DIST, packageName);
exec(`npm publish ${packagePath} ${FLAGS}`) exec(`npm publish ${packagePath} ${FLAGS}`)
.then(() => done()) .then(() => done())
.catch(done); .catch((e) => {
if (e.stderr && e.stderr.indexOf('previously published version') === -1) {
failedPackages.push({
cmd: e.cmd,
stderr: e.stderr
});
}
done();
});
}); });
@ -36,9 +45,14 @@ QUEUE.start((err) => {
if (err) { if (err) {
console.log('Error publishing ionic-native. ', err); console.log('Error publishing ionic-native. ', err);
} else if (failedPackages.length > 0) {
console.log(`${failedPackages.length} packages failed to publish.`);
console.log(failedPackages);
} else { } else {
console.log('Done publishing ionic-native!'); console.log('Done publishing ionic-native!');
} }
}); });