Skip to content

Commit

Permalink
Release - v0.18.8 (#315)
Browse files Browse the repository at this point in the history
* Fix version number inference (#314)
  • Loading branch information
JAForbes authored Apr 28, 2022
1 parent 215fa88 commit 5ed8be2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
10 changes: 10 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@
"args": ["extract-changelog", "--out"],
"program": "${workspaceFolder}/bin.js"
},
{
"type": "pwa-node",
"request": "launch",
"name": "merge",
"skipFiles": [
"<node_internals>/**"
],
"args": ["merge", "--target", "main", "--source", "next", "--verbose", "--force", "--clean", "--changelog", "--compact"],
"program": "${workspaceFolder}/bin.js"
}
{
"type": "pwa-node",
"request": "launch",
Expand Down
21 changes: 3 additions & 18 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ function groupBy(f, xs){
return idx
}

function getVersionFromReleasePR(x){
return [x]
.filter(Boolean)
.map( x => x.title )
.flatMap( x => x.split('-') )
.map( x => x.trim() )
.find( x => semver.valid(x))
}

async function getPackageJSONVersion({ owner, repo }){
let f; try {
f = await octokit.rest.repos.getContent(
Expand Down Expand Up @@ -341,12 +332,7 @@ async function extractChangelog(options){
,per_page: 2
,page: 1
})
}

let openBranches =
lastRelease
? await getRecentBranchesFromLastRelease({ owner, repo, lastRelease })
: []
}

let lines =
lastRelease
Expand Down Expand Up @@ -416,7 +402,7 @@ async function extractChangelog(options){
// this version is the published version + branch inferred versions
// it ignores the version set in the PR description
let nextVersion =
await getNextVersion({ recentBranches: openBranches, version })
await getNextVersion({ recentBranches, version })

let contributors =
[...new Set(recentBranches.map( x => x.user.login))]
Expand Down Expand Up @@ -737,11 +723,10 @@ async function merge(options){
return null;
}

async function inferVersion({ owner, repo, lastRelease }){
async function inferVersion({ owner, repo }){
let versionTypes = {
git: await getGitTagVersion({ owner, repo })
,npm: await getPackageJSONVersion({ owner, repo })
,title: lastRelease && getVersionFromReleasePR(lastRelease)
,default: '0.0.0'
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pr-release",
"version": "0.18.4",
"version": "0.18.7",
"description": "Generate releases from pull request descriptions.",
"main": "dist/pr-release.cjs",
"module": "lib/index.js",
Expand Down

0 comments on commit 5ed8be2

Please sign in to comment.