Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip committed Dec 4, 2020
1 parent d4f4b38 commit d1af56b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 7 deletions.
3 changes: 1 addition & 2 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -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"]
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
65 changes: 63 additions & 2 deletions tools/update-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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
Expand Down Expand Up @@ -375,7 +436,7 @@ const commitChangeLogFile = clean => {

xsh
.exec(true, `lerna updated`)
.then(processLernaUpdated)
.then(processLerna3Updated)
.then(listGitCommits)
.then(collateCommitsPackages)
.then(determinePackageVersions)
Expand Down

0 comments on commit d1af56b

Please sign in to comment.