release-please
Advanced tools
Comparing version
@@ -19,3 +19,2 @@ "use strict"; | ||
const checkpoint_1 = require("./util/checkpoint"); | ||
const package_branch_prefix_1 = require("./util/package-branch-prefix"); | ||
const release_pr_factory_1 = require("./release-pr-factory"); | ||
@@ -43,10 +42,2 @@ const github_1 = require("./github"); | ||
async createRelease() { | ||
// Attempt to lookup the package name from a well known location, such | ||
// as package.json, if none is provided: | ||
if (!this.packageName && this.releaseType) { | ||
this.packageName = await release_pr_factory_1.ReleasePRFactory.class(this.releaseType).lookupPackageName(this.gh, this.path); | ||
} | ||
if (this.packageName === undefined) { | ||
throw Error(`could not determine package name for release repo = ${this.repoUrl}`); | ||
} | ||
// In most configurations, createRelease() should be called close to when | ||
@@ -56,5 +47,3 @@ // a release PR is merged, e.g., a GitHub action that kicks off this | ||
const pageSize = 25; | ||
const gitHubReleasePR = await this.gh.findMergedReleasePR(this.labels, pageSize, this.monorepoTags | ||
? package_branch_prefix_1.packageBranchPrefix(this.packageName, this.releaseType) | ||
: undefined); | ||
const gitHubReleasePR = await this.gh.findMergedReleasePR(this.labels, pageSize, this.monorepoTags ? this.packageName : undefined); | ||
if (!gitHubReleasePR) { | ||
@@ -69,2 +58,7 @@ checkpoint_1.checkpoint('no recent release PRs found', checkpoint_1.CheckpointType.Failure); | ||
checkpoint_1.checkpoint(`found release notes: \n---\n${chalk.grey(latestReleaseNotes)}\n---\n`, checkpoint_1.CheckpointType.Success); | ||
// Attempt to lookup the package name from a well known location, such | ||
// as package.json, if none is provided: | ||
if (!this.packageName && this.releaseType) { | ||
this.packageName = await release_pr_factory_1.ReleasePRFactory.class(this.releaseType).lookupPackageName(this.gh); | ||
} | ||
// Go uses '/' for a tag separator, rather than '-': | ||
@@ -75,2 +69,5 @@ let tagSeparator = '-'; | ||
} | ||
if (this.packageName === undefined) { | ||
throw Error(`could not determine package name for release repo = ${this.repoUrl}`); | ||
} | ||
const release = await this.gh.createRelease(this.packageName, this.monorepoTags | ||
@@ -77,0 +74,0 @@ ? `${this.packageName}${tagSeparator}${version}` |
@@ -78,3 +78,3 @@ import { Octokit } from '@octokit/rest'; | ||
private allTags; | ||
findMergedReleasePR(labels: string[], perPage?: number, branchPrefix?: string | undefined, preRelease?: boolean): Promise<GitHubReleasePR | undefined>; | ||
findMergedReleasePR(labels: string[], perPage?: number, prefix?: string | undefined, preRelease?: boolean): Promise<GitHubReleasePR | undefined>; | ||
private hasAllLabels; | ||
@@ -81,0 +81,0 @@ findOpenReleasePRs(labels: string[], perPage?: number): Promise<PullsListResponseItems>; |
@@ -384,5 +384,4 @@ "use strict"; | ||
// TODO: make this handle more than 100 results using async iterator. | ||
async findMergedReleasePR(labels, perPage = 100, branchPrefix = undefined, preRelease = true) { | ||
branchPrefix = (branchPrefix === null || branchPrefix === void 0 ? void 0 : branchPrefix.endsWith('-')) ? branchPrefix.replace(/-$/, '') | ||
: branchPrefix; | ||
async findMergedReleasePR(labels, perPage = 100, prefix = undefined, preRelease = true) { | ||
prefix = (prefix === null || prefix === void 0 ? void 0 : prefix.endsWith('-')) ? prefix.replace(/-$/, '') : prefix; | ||
const baseLabel = await this.getBaseLabel(); | ||
@@ -418,6 +417,6 @@ const pullsResponse = (await this.request(`GET /repos/:owner/:repo/pulls?state=closed&per_page=${perPage}${this.proxyKey ? `&key=${this.proxyKey}` : ''}&sort=merged_at&direction=desc`, { | ||
continue; | ||
if (branchPrefix && match[1] !== branchPrefix) { | ||
if (prefix && match[1] !== prefix) { | ||
continue; | ||
} | ||
else if (!branchPrefix && match[1]) { | ||
else if (!prefix && match[1]) { | ||
continue; | ||
@@ -424,0 +423,0 @@ } |
@@ -62,3 +62,2 @@ import { ConventionalCommits } from './conventional-commits'; | ||
changelogSections?: []; | ||
releaseType: string; | ||
constructor(options: ReleasePROptions); | ||
@@ -70,3 +69,3 @@ run(): Promise<number | undefined>; | ||
protected defaultInitialVersion(): string; | ||
static lookupPackageName(gh: GitHub, path?: string): Promise<string | undefined>; | ||
static lookupPackageName(gh: GitHub): Promise<string | undefined>; | ||
static tagSeparator(): string; | ||
@@ -78,5 +77,4 @@ protected coerceReleaseCandidate(cc: ConventionalCommits, latestTag: GitHubTag | undefined, preRelease?: boolean): Promise<ReleaseCandidate>; | ||
protected changelogEmpty(changelogEntry: string): boolean; | ||
static addPathStatic(file: string, path?: string): string; | ||
addPath(file: string): string; | ||
} | ||
export {}; |
@@ -19,3 +19,2 @@ "use strict"; | ||
const checkpoint_1 = require("./util/checkpoint"); | ||
const package_branch_prefix_1 = require("./util/package-branch-prefix"); | ||
const github_1 = require("./github"); | ||
@@ -48,3 +47,2 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires | ||
this.changelogSections = options.changelogSections; | ||
this.releaseType = options.releaseType; | ||
} | ||
@@ -94,7 +92,4 @@ async run() { | ||
// name in package.json, or setup.py. | ||
static async lookupPackageName( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
gh, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
path) { | ||
static async lookupPackageName(gh) { | ||
return Promise.resolve(undefined); | ||
@@ -175,3 +170,6 @@ } | ||
const includePackageName = options.includePackageName; | ||
const branchPrefix = package_branch_prefix_1.packageBranchPrefix(this.packageName, this.releaseType); | ||
// Do not include npm style @org/ prefixes in the branch name: | ||
const branchPrefix = this.packageName.match(/^@[\w-]+\//) | ||
? this.packageName.split('/')[1] | ||
: this.packageName; | ||
const title = includePackageName | ||
@@ -213,8 +211,8 @@ ? `chore: release ${this.packageName} ${version}` | ||
} | ||
static addPathStatic(file, path) { | ||
if (path === undefined) { | ||
addPath(file) { | ||
if (this.path === undefined) { | ||
return file; | ||
} | ||
else { | ||
path = path.replace(/[/\\]$/, ''); | ||
const path = this.path.replace(/[/\\]$/, ''); | ||
file = file.replace(/^[/\\]/, ''); | ||
@@ -224,5 +222,2 @@ return `${path}/${file}`; | ||
} | ||
addPath(file) { | ||
return ReleasePR.addPathStatic(file, this.path); | ||
} | ||
} | ||
@@ -229,0 +224,0 @@ exports.ReleasePR = ReleasePR; |
@@ -6,3 +6,3 @@ import { ReleasePR } from '../release-pr'; | ||
protected _run(): Promise<number | undefined>; | ||
static lookupPackageName(gh: GitHub, path?: string): Promise<string | undefined>; | ||
static lookupPackageName(gh: GitHub): Promise<string | undefined>; | ||
} |
@@ -20,3 +20,2 @@ "use strict"; | ||
const checkpoint_1 = require("../util/checkpoint"); | ||
const package_branch_prefix_1 = require("../util/package-branch-prefix"); | ||
// Generic | ||
@@ -29,11 +28,3 @@ const changelog_1 = require("../updaters/changelog"); | ||
async _run() { | ||
// Make an effort to populate packageName from the contents of | ||
// the package.json, rather than forcing this to be set: | ||
const contents = await this.gh.getFileContents(this.addPath('package.json')); | ||
const pkg = JSON.parse(contents.parsedContent); | ||
if (pkg.name) | ||
this.packageName = pkg.name; | ||
const latestTag = await this.gh.latestTag(this.monorepoTags | ||
? `${package_branch_prefix_1.packageBranchPrefix(this.packageName, 'node')}-` | ||
: undefined); | ||
const latestTag = await this.gh.latestTag(this.monorepoTags ? `${this.packageName}-` : undefined); | ||
const commits = await this.commits({ | ||
@@ -63,2 +54,8 @@ sha: latestTag ? latestTag.sha : undefined, | ||
const updates = []; | ||
// Make an effort to populate packageName from the contents of | ||
// the package.json, rather than forcing this to be set: | ||
const contents = await this.gh.getFileContents(this.addPath('package.json')); | ||
const pkg = JSON.parse(contents.parsedContent); | ||
if (pkg.name) | ||
this.packageName = pkg.name; | ||
updates.push(new package_json_1.PackageJson({ | ||
@@ -100,6 +97,6 @@ path: this.addPath('package-lock.json'), | ||
// name in package.json, or setup.py. | ||
static async lookupPackageName(gh, path) { | ||
static async lookupPackageName(gh) { | ||
// Make an effort to populate packageName from the contents of | ||
// the package.json, rather than forcing this to be set: | ||
const contents = await gh.getFileContents(this.addPathStatic('package.json', path)); | ||
const contents = await gh.getFileContents('package.json'); | ||
const pkg = JSON.parse(contents.parsedContent); | ||
@@ -106,0 +103,0 @@ if (pkg.name) |
@@ -7,2 +7,18 @@ # Changelog | ||
## [9.0.0](https://www.github.com/googleapis/release-please/compare/v8.2.0...v9.0.0) (2021-01-08) | ||
### ⚠ BREAKING CHANGES | ||
* support multiple commits in footer (#686) | ||
### Features | ||
* support multiple commits in footer ([#686](https://www.github.com/googleapis/release-please/issues/686)) ([b3f96d8](https://www.github.com/googleapis/release-please/commit/b3f96d8dd988b7d482223e8a7868a45043db4880)) | ||
### Bug Fixes | ||
* `findFilesByfilename` respects `path` option ([#665](https://www.github.com/googleapis/release-please/issues/665)) ([a3a1df6](https://www.github.com/googleapis/release-please/commit/a3a1df690f48b38c539ee5aab5ae046d640c6811)) | ||
## [8.2.0](https://www.github.com/googleapis/release-please/compare/v8.1.0...v8.2.0) (2021-01-06) | ||
@@ -9,0 +25,0 @@ |
{ | ||
"name": "release-please", | ||
"version": "9.0.0-candidate.1", | ||
"version": "9.0.0", | ||
"description": "generate release PRs based on the conventionalcommits.org spec", | ||
@@ -5,0 +5,0 @@ "main": "./build/src/index.js", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
-100%296649
-2.37%110
-3.51%5357
-3.75%