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() {
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/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 versionParts = version.split(".");
let updateNextToLatest = false;
let tagArg = "";
if (versionParts[0] !== LATEST) {
tagArg = `--tag v${versionParts[0]}-maintenance`
} else if (/-/.test(version)) {
tagArg = "--tag next"
} else {
updateNextToLatest = true;
}
const lines = [];
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(""))
});