1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Update gen-publish script to update 'next' tag for main releases

This commit is contained in:
Nick O'Leary 2021-10-25 10:05:23 +01:00
parent b855438af6
commit 5a012182d9
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -9,29 +9,36 @@ const LATEST = "2";
function generateScript() { function generateScript() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const packages = [ const packages = [
"node-red-util", "@node-red/util",
"node-red-runtime", "@node-red/runtime",
"node-red-registry", "@node-red/registry",
"node-red-nodes", "@node-red/nodes",
"node-red-editor-client", "@node-red/editor-client",
"node-red-editor-api", "@node-red/editor-api",
"node-red" "node-red"
]; ];
const rootPackage = require(path.join(__dirname,"..","package.json")); const rootPackage = require(path.join(__dirname,"..","package.json"));
const version = rootPackage.version; const version = rootPackage.version;
const versionParts = version.split("."); const versionParts = version.split(".");
let updateNextToLatest = false;
let tagArg = ""; let tagArg = "";
if (versionParts[0] !== LATEST) { if (versionParts[0] !== LATEST) {
tagArg = `--tag v${versionParts[0]}-maintenance` tagArg = `--tag v${versionParts[0]}-maintenance`
} else if (/-/.test(version)) { } else if (/-/.test(version)) {
tagArg = "--tag next" tagArg = "--tag next"
} else {
updateNextToLatest = true;
} }
const lines = []; const lines = [];
packages.forEach(name => { packages.forEach(name => {
lines.push(`npm publish ${name}-${version}.tgz ${tagArg}\n`); const tarName = name.replace(/@/,"").replace(/\//,"-")
lines.push(`npm publish ${tarName}-${version}.tgz ${tagArg}\n`);
if (updateNextToLatest) {
lines.push(`npm dist-tag add ${name}@${version} next\n`);
}
}) })
resolve(lines.join("")) resolve(lines.join(""))
}); });