diff --git a/lerna.json b/lerna.json index 22e180062..88af80deb 100644 --- a/lerna.json +++ b/lerna.json @@ -1,10 +1,9 @@ { - "lerna": "2.11.0", "version": "independent", "command.publish.config": { "ignore": ["*.md"] }, - "commands": { + "command": { "bootstrap": { "ignore": ["ignite-core", "electrode-ignite", "generator-electrode"] } diff --git a/package.json b/package.json index 7cd460b0a..ad05a4e91 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "devDependencies": { "bluebird": "^3.5.0", "fynpo": "^0.1.31", - "lerna": "^2.0.0", + "lerna": "^3.22.1", "lodash": "^4.17.10", "semver": "^5.3.0", "xclap": "^0.2.18", @@ -31,8 +31,8 @@ "url": "https://github.com/electrode-io/electrode.git" }, "engines": { - "node": ">= 6", - "npm": ">= 3" + "node": ">= 10", + "npm": ">= 6" }, "private": true, "license": "Apache-2.0", diff --git a/tools/update-changelog.js b/tools/update-changelog.js index 63272f74e..a2eeee18b 100644 --- a/tools/update-changelog.js +++ b/tools/update-changelog.js @@ -63,7 +63,23 @@ const removeNpmScope = name => { return name; }; -const processLernaUpdated = output => { +const processLerna2Updated = output => { + /* +lerna info version 2.11.0 +lerna info versioning independent +lerna info Checking for updated packages... +lerna info Comparing with rel-v8-20201202. +lerna info Checking for prereleased packages... +lerna info result +- electrode-react-webapp +- subapp-server +- @xarc/app-dev +- @xarc/index-page +- @xarc/jsx-renderer +- @xarc/render-context +- @xarc/tag-renderer + */ + // search for last commit that's Publish using lerna const lernaInfo = output.stderr.split("\n"); const tagSig = "Comparing with"; @@ -88,6 +104,51 @@ const processLernaUpdated = output => { return { tag, packages }; }; +const processLerna3Updated = output => { + /* +lerna notice cli v3.22.1 +lerna info versioning independent +lerna info Looking for changed packages since rel-v8-20201202 +electrode-react-webapp +subapp-server +@xarc/app-dev +@xarc/index-page +@xarc/jsx-renderer +@xarc/render-context +@xarc/tag-renderer +lerna success found 7 packages ready to publish +*/ + + // search for last commit that's Publish using lerna + const lernaInfo = output.stderr.split("\n"); + const tagSig = "Looking for changed packages since"; + let tagIndex; + let tagLine = lernaInfo + .find(x => { + tagIndex = x.indexOf(tagSig); + return tagIndex >= 0; + }) + .trim(); + + if (tagLine.endsWith(".")) { + tagLine = tagLine.substr(0, tagLine.length - 1); + } + + assert(tagLine, "Can't find last publish tag from lerna"); + const tag = tagLine.substr(tagIndex + tagSig.length).trim(); + const packages = output.stdout.split("\n").filter(x => x.trim().length > 0); + + if (packages.length > 0) { + console.log( + `detected from lerna: since tag '${tag}', these packages changed: ${packages.join(" ")}` + ); + } else { + console.log(`no packages changed since tag '${tag}'`); + } + + return { tag, packages }; +}; + const listGitCommits = updated => { const tag = updated.tag; return xsh @@ -375,7 +436,7 @@ const commitChangeLogFile = clean => { xsh .exec(true, `lerna updated`) - .then(processLernaUpdated) + .then(processLerna3Updated) .then(listGitCommits) .then(collateCommitsPackages) .then(determinePackageVersions)