From 5a012182d9f05e155f8b6505b6cee20e9594bfed Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 25 Oct 2021 10:05:23 +0100 Subject: [PATCH] Update gen-publish script to update 'next' tag for main releases --- scripts/generate-publish-script.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/generate-publish-script.js b/scripts/generate-publish-script.js index 7bcbb7fc6..0c64cb832 100644 --- a/scripts/generate-publish-script.js +++ b/scripts/generate-publish-script.js @@ -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("")) });