1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00
node-red/scripts/generate-publish-script.js
2019-10-14 15:50:48 +01:00

39 lines
981 B
JavaScript

#!/usr/bin/env node
const path = require("path");
const fs = require("fs-extra");
const should = require("should");
function generateScript() {
return new Promise((resolve, reject) => {
const packages = [
"node-red-util",
"node-red-runtime",
"node-red-registry",
"node-red-nodes",
"node-red-editor-client",
"node-red-editor-api",
"node-red"
];
const rootPackage = require(path.join(__dirname,"..","package.json"));
const version = rootPackage.version;
const tagArg = /-/.test(version) ? "--tag next" : ""
const lines = [];
packages.forEach(name => {
lines.push(`npm publish ${name}-${version}.tgz ${tagArg}\n`);
})
resolve(lines.join(""))
});
}
if (require.main === module) {
generateScript().then(output => {
console.log(output);
});
} else {
module.exports = generateScript;
}