release-please 12.6.1 → 12.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/build/src/bootstrapper.d.ts +0 -12
- package/build/src/bootstrapper.js +0 -60
- package/build/src/changelog-notes/default.d.ts +0 -15
- package/build/src/changelog-notes/default.js +0 -71
- package/build/src/changelog-notes/github.d.ts +0 -8
- package/build/src/changelog-notes/github.js +0 -26
- package/build/src/changelog-notes.d.ts +0 -19
- package/build/src/changelog-notes.js +0 -16
- package/build/src/commit.d.ts +0 -26
- package/build/src/commit.js +0 -316
- package/build/src/plugin.d.ts +0 -20
- package/build/src/plugin.js +0 -31
- package/build/src/plugins/merge.d.ts +0 -11
- package/build/src/plugins/merge.js +0 -83
- package/build/src/plugins/workspace.d.ts +0 -102
- package/build/src/plugins/workspace.js +0 -170
- package/build/src/pull-request.d.ts +0 -10
- package/build/src/pull-request.js +0 -16
- package/build/src/release-notes.d.ts +0 -29
- package/build/src/release-notes.js +0 -71
- package/build/src/release-pull-request.d.ts +0 -13
- package/build/src/release-pull-request.js +0 -16
- package/build/src/release.d.ts +0 -6
- package/build/src/release.js +0 -16
- package/build/src/repository.d.ts +0 -5
- package/build/src/repository.js +0 -16
- package/build/src/strategies/dart.d.ts +0 -8
- package/build/src/strategies/dart.js +0 -63
- package/build/src/strategies/elixir.d.ts +0 -5
- package/build/src/strategies/elixir.js +0 -45
- package/build/src/strategies/go-yoshi.d.ts +0 -13
- package/build/src/strategies/go-yoshi.js +0 -114
- package/build/src/strategies/go.d.ts +0 -5
- package/build/src/strategies/go.js +0 -36
- package/build/src/strategies/helm.d.ts +0 -8
- package/build/src/strategies/helm.js +0 -63
- package/build/src/strategies/java-yoshi.d.ts +0 -25
- package/build/src/strategies/java-yoshi.js +0 -259
- package/build/src/strategies/krm-blueprint.d.ts +0 -7
- package/build/src/strategies/krm-blueprint.js +0 -64
- package/build/src/strategies/node.d.ts +0 -9
- package/build/src/strategies/node.js +0 -82
- package/build/src/strategies/ocaml.d.ts +0 -5
- package/build/src/strategies/ocaml.js +0 -75
- package/build/src/strategies/php-yoshi.d.ts +0 -10
- package/build/src/strategies/php-yoshi.js +0 -214
- package/build/src/strategies/php.d.ts +0 -6
- package/build/src/strategies/php.js +0 -67
- package/build/src/strategies/python.d.ts +0 -8
- package/build/src/strategies/python.js +0 -117
- package/build/src/strategies/ruby-yoshi.d.ts +0 -17
- package/build/src/strategies/ruby-yoshi.js +0 -116
- package/build/src/strategies/ruby.d.ts +0 -13
- package/build/src/strategies/ruby.js +0 -61
- package/build/src/strategies/rust.d.ts +0 -20
- package/build/src/strategies/rust.js +0 -120
- package/build/src/strategies/simple.d.ts +0 -5
- package/build/src/strategies/simple.js +0 -45
- package/build/src/strategies/terraform-module.d.ts +0 -7
- package/build/src/strategies/terraform-module.js +0 -72
- package/build/src/strategy.d.ts +0 -103
- package/build/src/strategy.js +0 -249
- package/build/src/update.d.ts +0 -23
- package/build/src/update.js +0 -16
- package/build/src/updaters/composite.d.ts +0 -19
- package/build/src/updaters/composite.js +0 -42
- package/build/src/updaters/dart/pubspec-yaml.d.ts +0 -12
- package/build/src/updaters/dart/pubspec-yaml.js +0 -45
- package/build/src/updaters/default.d.ts +0 -21
- package/build/src/updaters/default.js +0 -36
- package/build/src/updaters/dotnet/csproj.d.ts +0 -12
- package/build/src/updaters/dotnet/csproj.js +0 -33
- package/build/src/updaters/elixir/elixir-mix-exs.d.ts +0 -12
- package/build/src/updaters/elixir/elixir-mix-exs.js +0 -37
- package/build/src/updaters/go/version-go.d.ts +0 -4
- package/build/src/updaters/go/version-go.js +0 -24
- package/build/src/updaters/java/java-update.d.ts +0 -14
- package/build/src/updaters/java/java-update.js +0 -76
- package/build/src/updaters/node/package-json.d.ts +0 -12
- package/build/src/updaters/node/package-json.js +0 -37
- package/build/src/updaters/node/package-lock-json.d.ts +0 -8
- package/build/src/updaters/node/package-lock-json.js +0 -36
- package/build/src/updaters/node/samples-package-json.d.ts +0 -23
- package/build/src/updaters/node/samples-package-json.js +0 -49
- package/build/src/updaters/php/php-client-version.d.ts +0 -12
- package/build/src/updaters/php/php-client-version.js +0 -32
- package/build/src/updaters/php/php-manifest.d.ts +0 -13
- package/build/src/updaters/php/php-manifest.js +0 -55
- package/build/src/updaters/php/root-composer-update-packages.d.ts +0 -12
- package/build/src/updaters/php/root-composer-update-packages.js +0 -47
- package/build/src/updaters/raw-content.d.ts +0 -19
- package/build/src/updaters/raw-content.js +0 -39
- package/build/src/updaters/release-please-config.d.ts +0 -8
- package/build/src/updaters/release-please-config.js +0 -41
- package/build/src/updaters/ruby/version-rb.d.ts +0 -12
- package/build/src/updaters/ruby/version-rb.js +0 -32
- package/build/src/util/commit-split.d.ts +0 -11
- package/build/src/util/commit-split.js +0 -94
- package/build/src/util/pull-request-body.d.ts +0 -20
- package/build/src/util/pull-request-body.js +0 -129
- package/build/src/util/tag-name.d.ts +0 -9
- package/build/src/util/tag-name.js +0 -41
- package/build/src/util/toml-edit.d.ts +0 -8
- package/build/src/util/toml-edit.js +0 -125
- package/build/src/version.d.ts +0 -11
- package/build/src/version.js +0 -45
- package/build/src/versioning-strategies/always-bump-patch.d.ts +0 -7
- package/build/src/versioning-strategies/always-bump-patch.js +0 -25
- package/build/src/versioning-strategies/default.d.ts +0 -15
- package/build/src/versioning-strategies/default.js +0 -67
- package/build/src/versioning-strategies/dependency-manifest.d.ts +0 -7
- package/build/src/versioning-strategies/dependency-manifest.js +0 -90
- package/build/src/versioning-strategies/java-add-snapshot.d.ts +0 -9
- package/build/src/versioning-strategies/java-add-snapshot.js +0 -53
- package/build/src/versioning-strategies/java-snapshot.d.ts +0 -9
- package/build/src/versioning-strategies/java-snapshot.js +0 -67
- package/build/src/versioning-strategies/service-pack.d.ts +0 -7
- package/build/src/versioning-strategies/service-pack.js +0 -40
- package/build/src/versioning-strategy.d.ts +0 -28
- package/build/src/versioning-strategy.js +0 -55
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
|
|
6
6
|
|
|
7
|
+
### [12.6.2](https://www.github.com/googleapis/release-please/compare/v12.6.1...v12.6.2) (2021-12-21)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **release:** ensure release-backed tokens work on branch ([#1155](https://www.github.com/googleapis/release-please/issues/1155)) ([9849f93](https://www.github.com/googleapis/release-please/commit/9849f930f2137aa41b54b54d5d6a6faa2a9fe8ee))
|
|
13
|
+
|
|
7
14
|
### [12.6.1](https://www.github.com/googleapis/release-please/compare/v12.6.0...v12.6.1) (2021-12-21)
|
|
8
15
|
|
|
9
16
|
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { GitHub } from './github';
|
|
2
|
-
import { ReleaserConfig } from './manifest';
|
|
3
|
-
import { PullRequest } from './pull-request';
|
|
4
|
-
export declare class Bootstrapper {
|
|
5
|
-
private github;
|
|
6
|
-
private targetBranch;
|
|
7
|
-
private manifestFile;
|
|
8
|
-
private configFile;
|
|
9
|
-
private initialVersion;
|
|
10
|
-
constructor(github: GitHub, targetBranch: string, manifestFile?: string, configFile?: string, initialVersionString?: string);
|
|
11
|
-
bootstrap(path: string, config: ReleaserConfig): Promise<PullRequest>;
|
|
12
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2021 Google LLC
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.Bootstrapper = void 0;
|
|
17
|
-
const manifest_1 = require("./manifest");
|
|
18
|
-
const version_1 = require("./version");
|
|
19
|
-
const release_please_manifest_1 = require("./updaters/release-please-manifest");
|
|
20
|
-
const release_please_config_1 = require("./updaters/release-please-config");
|
|
21
|
-
class Bootstrapper {
|
|
22
|
-
constructor(github, targetBranch, manifestFile = manifest_1.DEFAULT_RELEASE_PLEASE_MANIFEST, configFile = manifest_1.DEFAULT_RELEASE_PLEASE_CONFIG, initialVersionString = '0.0.0') {
|
|
23
|
-
this.github = github;
|
|
24
|
-
this.targetBranch = targetBranch;
|
|
25
|
-
this.manifestFile = manifestFile;
|
|
26
|
-
this.configFile = configFile;
|
|
27
|
-
this.initialVersion = version_1.Version.parse(initialVersionString);
|
|
28
|
-
}
|
|
29
|
-
async bootstrap(path, config) {
|
|
30
|
-
const message = `chore: bootstrap releases for path: ${path}`;
|
|
31
|
-
const branchName = path === manifest_1.ROOT_PROJECT_PATH ? 'default' : path;
|
|
32
|
-
const pullRequest = {
|
|
33
|
-
headBranchName: `release-please/bootstrap/${branchName}`,
|
|
34
|
-
baseBranchName: this.targetBranch,
|
|
35
|
-
number: -1,
|
|
36
|
-
title: message,
|
|
37
|
-
body: `Configuring release-please for path: ${path}`,
|
|
38
|
-
labels: [],
|
|
39
|
-
files: [],
|
|
40
|
-
};
|
|
41
|
-
const version = this.initialVersion;
|
|
42
|
-
const versionsMap = new Map();
|
|
43
|
-
versionsMap.set(path, version);
|
|
44
|
-
const updates = [
|
|
45
|
-
{
|
|
46
|
-
path: this.manifestFile,
|
|
47
|
-
createIfMissing: true,
|
|
48
|
-
updater: new release_please_manifest_1.ReleasePleaseManifest({ version, versionsMap }),
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
path: this.configFile,
|
|
52
|
-
createIfMissing: true,
|
|
53
|
-
updater: new release_please_config_1.ReleasePleaseConfig(path, config),
|
|
54
|
-
},
|
|
55
|
-
];
|
|
56
|
-
return await this.github.createPullRequest(pullRequest, this.targetBranch, message, updates, {});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.Bootstrapper = Bootstrapper;
|
|
60
|
-
//# sourceMappingURL=bootstrapper.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ChangelogNotes, BuildNotesOptions } from '../changelog-notes';
|
|
2
|
-
import { ConventionalCommit } from '../commit';
|
|
3
|
-
interface DefaultChangelogNotesOptions {
|
|
4
|
-
commitPartial?: string;
|
|
5
|
-
headerPartial?: string;
|
|
6
|
-
mainTemplate?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare class DefaultChangelogNotes implements ChangelogNotes {
|
|
9
|
-
private commitPartial?;
|
|
10
|
-
private headerPartial?;
|
|
11
|
-
private mainTemplate?;
|
|
12
|
-
constructor(options?: DefaultChangelogNotesOptions);
|
|
13
|
-
buildNotes(commits: ConventionalCommit[], options: BuildNotesOptions): Promise<string>;
|
|
14
|
-
}
|
|
15
|
-
export {};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2021 Google LLC
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.DefaultChangelogNotes = void 0;
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
18
|
-
const conventionalChangelogWriter = require('conventional-changelog-writer');
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
20
|
-
const presetFactory = require('conventional-changelog-conventionalcommits');
|
|
21
|
-
const DEFAULT_HOST = 'https://github.com';
|
|
22
|
-
class DefaultChangelogNotes {
|
|
23
|
-
constructor(options = {}) {
|
|
24
|
-
this.commitPartial = options.commitPartial;
|
|
25
|
-
this.headerPartial = options.headerPartial;
|
|
26
|
-
this.mainTemplate = options.mainTemplate;
|
|
27
|
-
}
|
|
28
|
-
async buildNotes(commits, options) {
|
|
29
|
-
const context = {
|
|
30
|
-
host: options.host || DEFAULT_HOST,
|
|
31
|
-
owner: options.owner,
|
|
32
|
-
repository: options.repository,
|
|
33
|
-
version: options.version,
|
|
34
|
-
previousTag: options.previousTag,
|
|
35
|
-
currentTag: options.currentTag,
|
|
36
|
-
linkCompare: !!options.previousTag,
|
|
37
|
-
};
|
|
38
|
-
const config = {};
|
|
39
|
-
if (options.changelogSections) {
|
|
40
|
-
config.types = options.changelogSections;
|
|
41
|
-
}
|
|
42
|
-
const preset = await presetFactory(config);
|
|
43
|
-
preset.writerOpts.commitPartial =
|
|
44
|
-
this.commitPartial || preset.writerOpts.commitPartial;
|
|
45
|
-
preset.writerOpts.headerPartial =
|
|
46
|
-
this.headerPartial || preset.writerOpts.headerPartial;
|
|
47
|
-
preset.writerOpts.mainTemplate =
|
|
48
|
-
this.mainTemplate || preset.writerOpts.mainTemplate;
|
|
49
|
-
const changelogCommits = commits.map(commit => {
|
|
50
|
-
return {
|
|
51
|
-
body: '',
|
|
52
|
-
subject: commit.bareMessage,
|
|
53
|
-
type: commit.type,
|
|
54
|
-
scope: commit.scope,
|
|
55
|
-
notes: commit.notes,
|
|
56
|
-
references: commit.references,
|
|
57
|
-
mentions: [],
|
|
58
|
-
merge: null,
|
|
59
|
-
revert: null,
|
|
60
|
-
header: commit.message,
|
|
61
|
-
footer: null,
|
|
62
|
-
hash: commit.sha,
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
|
-
return conventionalChangelogWriter
|
|
66
|
-
.parseArray(changelogCommits, context, preset.writerOpts)
|
|
67
|
-
.trim();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.DefaultChangelogNotes = DefaultChangelogNotes;
|
|
71
|
-
//# sourceMappingURL=default.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ChangelogNotes, BuildNotesOptions } from '../changelog-notes';
|
|
2
|
-
import { ConventionalCommit } from '../commit';
|
|
3
|
-
import { GitHub } from '../github';
|
|
4
|
-
export declare class GitHubChangelogNotes implements ChangelogNotes {
|
|
5
|
-
private github;
|
|
6
|
-
constructor(github: GitHub);
|
|
7
|
-
buildNotes(_commits: ConventionalCommit[], options: BuildNotesOptions): Promise<string>;
|
|
8
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2021 Google LLC
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.GitHubChangelogNotes = void 0;
|
|
17
|
-
class GitHubChangelogNotes {
|
|
18
|
-
constructor(github) {
|
|
19
|
-
this.github = github;
|
|
20
|
-
}
|
|
21
|
-
async buildNotes(_commits, options) {
|
|
22
|
-
return await this.github.generateReleaseNotes(options.currentTag, options.targetBranch, options.previousTag);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.GitHubChangelogNotes = GitHubChangelogNotes;
|
|
26
|
-
//# sourceMappingURL=github.js.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ConventionalCommit } from './commit';
|
|
2
|
-
export interface BuildNotesOptions {
|
|
3
|
-
host?: string;
|
|
4
|
-
owner: string;
|
|
5
|
-
repository: string;
|
|
6
|
-
version: string;
|
|
7
|
-
previousTag?: string;
|
|
8
|
-
currentTag: string;
|
|
9
|
-
targetBranch: string;
|
|
10
|
-
changelogSections?: ChangelogSection[];
|
|
11
|
-
}
|
|
12
|
-
export interface ChangelogNotes {
|
|
13
|
-
buildNotes(commits: ConventionalCommit[], options: BuildNotesOptions): Promise<string>;
|
|
14
|
-
}
|
|
15
|
-
export interface ChangelogSection {
|
|
16
|
-
type: string;
|
|
17
|
-
section: string;
|
|
18
|
-
hidden?: boolean;
|
|
19
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2021 Google LLC
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
//# sourceMappingURL=changelog-notes.js.map
|
package/build/src/commit.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PullRequest } from './pull-request';
|
|
2
|
-
import * as parser from '@conventional-commits/parser';
|
|
3
|
-
export interface Commit {
|
|
4
|
-
sha: string;
|
|
5
|
-
message: string;
|
|
6
|
-
files: string[];
|
|
7
|
-
pullRequest?: PullRequest;
|
|
8
|
-
}
|
|
9
|
-
export interface ConventionalCommit extends Commit {
|
|
10
|
-
type: string;
|
|
11
|
-
scope: string | null;
|
|
12
|
-
notes: parser.Note[];
|
|
13
|
-
references: parser.Reference[];
|
|
14
|
-
bareMessage: string;
|
|
15
|
-
breaking: boolean;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Given a list of raw commits, parse and expand into conventional commits.
|
|
19
|
-
*
|
|
20
|
-
* @param commits {Commit[]} The input commits
|
|
21
|
-
*
|
|
22
|
-
* @returns {ConventionalCommit[]} Parsed and expanded commits. There may be
|
|
23
|
-
* more commits returned as a single raw commit may contain multiple release
|
|
24
|
-
* messages.
|
|
25
|
-
*/
|
|
26
|
-
export declare function parseConventionalCommits(commits: Commit[]): ConventionalCommit[];
|
package/build/src/commit.js
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2021 Google LLC
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.parseConventionalCommits = void 0;
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
18
|
-
const visit = require('unist-util-visit');
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
20
|
-
const visitWithAncestors = require('unist-util-visit-parents');
|
|
21
|
-
const NUMBER_REGEX = /^[0-9]+$/;
|
|
22
|
-
const logger_1 = require("./util/logger");
|
|
23
|
-
const parser = require("@conventional-commits/parser");
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
25
|
-
const conventionalCommitsFilter = require('conventional-commits-filter');
|
|
26
|
-
function getBlankConventionalCommit() {
|
|
27
|
-
return {
|
|
28
|
-
body: '',
|
|
29
|
-
subject: '',
|
|
30
|
-
type: '',
|
|
31
|
-
scope: null,
|
|
32
|
-
notes: [],
|
|
33
|
-
references: [],
|
|
34
|
-
mentions: [],
|
|
35
|
-
merge: null,
|
|
36
|
-
revert: null,
|
|
37
|
-
header: '',
|
|
38
|
-
footer: null,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
// Converts conventional commit AST into conventional-changelog's
|
|
42
|
-
// output format, see: https://www.npmjs.com/package/conventional-commits-parser
|
|
43
|
-
function toConventionalChangelogFormat(ast) {
|
|
44
|
-
const commits = [];
|
|
45
|
-
const headerCommit = getBlankConventionalCommit();
|
|
46
|
-
// Separate the body and summary nodes, this simplifies the subsequent
|
|
47
|
-
// tree walking logic:
|
|
48
|
-
let body;
|
|
49
|
-
let summary;
|
|
50
|
-
visit(ast, ['body', 'summary'], (node) => {
|
|
51
|
-
switch (node.type) {
|
|
52
|
-
case 'body':
|
|
53
|
-
body = node;
|
|
54
|
-
break;
|
|
55
|
-
case 'summary':
|
|
56
|
-
summary = node;
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
// <type>, "(", <scope>, ")", ["!"], ":", <whitespace>*, <text>
|
|
61
|
-
visit(summary, (node) => {
|
|
62
|
-
switch (node.type) {
|
|
63
|
-
case 'type':
|
|
64
|
-
headerCommit.type = node.value;
|
|
65
|
-
headerCommit.header += node.value;
|
|
66
|
-
break;
|
|
67
|
-
case 'scope':
|
|
68
|
-
headerCommit.scope = node.value;
|
|
69
|
-
headerCommit.header += `(${node.value})`;
|
|
70
|
-
break;
|
|
71
|
-
case 'breaking-change':
|
|
72
|
-
headerCommit.header += '!';
|
|
73
|
-
break;
|
|
74
|
-
case 'text':
|
|
75
|
-
headerCommit.subject = node.value;
|
|
76
|
-
headerCommit.header += `: ${node.value}`;
|
|
77
|
-
break;
|
|
78
|
-
default:
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
// [<any body-text except pre-footer>]
|
|
83
|
-
if (body) {
|
|
84
|
-
visit(body, ['text', 'newline'], (node) => {
|
|
85
|
-
headerCommit.body += node.value;
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
// Extract BREAKING CHANGE notes, regardless of whether they fall in
|
|
89
|
-
// summary, body, or footer:
|
|
90
|
-
const breaking = {
|
|
91
|
-
title: 'BREAKING CHANGE',
|
|
92
|
-
text: '',
|
|
93
|
-
};
|
|
94
|
-
visitWithAncestors(ast, ['breaking-change'], (node, ancestors) => {
|
|
95
|
-
let parent = ancestors.pop();
|
|
96
|
-
if (!parent) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
switch (parent.type) {
|
|
100
|
-
case 'summary':
|
|
101
|
-
breaking.text = headerCommit.subject;
|
|
102
|
-
break;
|
|
103
|
-
case 'body':
|
|
104
|
-
breaking.text = '';
|
|
105
|
-
// We treat text from the BREAKING CHANGE marker forward as
|
|
106
|
-
// the breaking change notes:
|
|
107
|
-
visit(parent, ['text', 'newline'], (node) => {
|
|
108
|
-
breaking.text += node.value;
|
|
109
|
-
});
|
|
110
|
-
break;
|
|
111
|
-
case 'token':
|
|
112
|
-
// If the '!' breaking change marker is used, the breaking change
|
|
113
|
-
// will be identified when the footer is parsed as a commit:
|
|
114
|
-
if (!node.value.includes('BREAKING'))
|
|
115
|
-
return;
|
|
116
|
-
parent = ancestors.pop();
|
|
117
|
-
visit(parent, ['text', 'newline'], (node) => {
|
|
118
|
-
breaking.text = node.value;
|
|
119
|
-
});
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
if (breaking.text !== '')
|
|
124
|
-
headerCommit.notes.push(breaking);
|
|
125
|
-
// Populates references array from footers:
|
|
126
|
-
// references: [{
|
|
127
|
-
// action: 'Closes',
|
|
128
|
-
// owner: null,
|
|
129
|
-
// repository: null,
|
|
130
|
-
// issue: '1', raw: '#1',
|
|
131
|
-
// prefix: '#'
|
|
132
|
-
// }]
|
|
133
|
-
visit(ast, ['footer'], (node) => {
|
|
134
|
-
const reference = {
|
|
135
|
-
prefix: '#',
|
|
136
|
-
action: '',
|
|
137
|
-
issue: '',
|
|
138
|
-
};
|
|
139
|
-
let hasRefSepartor = false;
|
|
140
|
-
visit(node, ['type', 'separator', 'text'], (node) => {
|
|
141
|
-
switch (node.type) {
|
|
142
|
-
case 'type':
|
|
143
|
-
// refs, closes, etc:
|
|
144
|
-
// TODO(@bcoe): conventional-changelog does not currently use
|
|
145
|
-
// "reference.action" in its templates:
|
|
146
|
-
reference.action = node.value;
|
|
147
|
-
break;
|
|
148
|
-
case 'separator':
|
|
149
|
-
// Footer of the form "Refs #99":
|
|
150
|
-
if (node.value.includes('#'))
|
|
151
|
-
hasRefSepartor = true;
|
|
152
|
-
break;
|
|
153
|
-
case 'text':
|
|
154
|
-
// Footer of the form "Refs: #99"
|
|
155
|
-
if (node.value.charAt(0) === '#') {
|
|
156
|
-
hasRefSepartor = true;
|
|
157
|
-
reference.issue = node.value.substring(1);
|
|
158
|
-
// TODO(@bcoe): what about references like "Refs: #99, #102"?
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
reference.issue = node.value;
|
|
162
|
-
}
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
// TODO(@bcoe): how should references like "Refs: v8:8940" work.
|
|
167
|
-
if (hasRefSepartor && reference.issue.match(NUMBER_REGEX)) {
|
|
168
|
-
headerCommit.references.push(reference);
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
/*
|
|
172
|
-
* Split footers that resemble commits into additional commits, e.g.,
|
|
173
|
-
* chore: multiple commits
|
|
174
|
-
* chore(recaptchaenterprise): migrate recaptchaenterprise to the Java microgenerator
|
|
175
|
-
* Committer: @miraleung
|
|
176
|
-
* PiperOrigin-RevId: 345559154
|
|
177
|
-
* ...
|
|
178
|
-
*/
|
|
179
|
-
visitWithAncestors(ast, ['type'], (node, ancestors) => {
|
|
180
|
-
let parent = ancestors.pop();
|
|
181
|
-
if (!parent) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
if (parent.type === 'token') {
|
|
185
|
-
parent = ancestors.pop();
|
|
186
|
-
let footerText = '';
|
|
187
|
-
const semanticFooter = node.value.toLowerCase() === 'release-as';
|
|
188
|
-
visit(parent, ['type', 'scope', 'breaking-change', 'separator', 'text', 'newline'], (node) => {
|
|
189
|
-
switch (node.type) {
|
|
190
|
-
case 'scope':
|
|
191
|
-
footerText += `(${node.value})`;
|
|
192
|
-
break;
|
|
193
|
-
case 'separator':
|
|
194
|
-
// Footers of the form Fixes #99, should not be parsed.
|
|
195
|
-
if (node.value.includes('#'))
|
|
196
|
-
return;
|
|
197
|
-
footerText += `${node.value} `;
|
|
198
|
-
break;
|
|
199
|
-
default:
|
|
200
|
-
footerText += node.value;
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
// Any footers that carry semantic meaning, e.g., Release-As, should
|
|
205
|
-
// be added to the footer field, for the benefits of post-processing:
|
|
206
|
-
if (semanticFooter) {
|
|
207
|
-
let releaseAs = '';
|
|
208
|
-
visit(parent, ['text'], (node) => {
|
|
209
|
-
releaseAs = node.value;
|
|
210
|
-
});
|
|
211
|
-
// record Release-As footer as a note
|
|
212
|
-
headerCommit.notes.push({
|
|
213
|
-
title: 'RELEASE AS',
|
|
214
|
-
text: releaseAs,
|
|
215
|
-
});
|
|
216
|
-
if (!headerCommit.footer)
|
|
217
|
-
headerCommit.footer = '';
|
|
218
|
-
headerCommit.footer += `\n${footerText.toLowerCase()}`.trimStart();
|
|
219
|
-
}
|
|
220
|
-
try {
|
|
221
|
-
for (const commit of toConventionalChangelogFormat(parser.parser(footerText))) {
|
|
222
|
-
commits.push(commit);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
catch (err) {
|
|
226
|
-
// Footer does not appear to be an additional commit.
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
commits.push(headerCommit);
|
|
231
|
-
return commits;
|
|
232
|
-
}
|
|
233
|
-
// TODO(@bcoe): now that we walk the actual AST of conventional commits
|
|
234
|
-
// we should be able to move post processing into
|
|
235
|
-
// to-conventional-changelog.ts.
|
|
236
|
-
function postProcessCommits(commit) {
|
|
237
|
-
commit.notes.forEach(note => {
|
|
238
|
-
let text = '';
|
|
239
|
-
let i = 0;
|
|
240
|
-
let extendedContext = false;
|
|
241
|
-
for (const chunk of note.text.split(/\r?\n/)) {
|
|
242
|
-
if (i > 0 && hasExtendedContext(chunk) && !extendedContext) {
|
|
243
|
-
text = `${text.trim()}\n`;
|
|
244
|
-
extendedContext = true;
|
|
245
|
-
}
|
|
246
|
-
if (chunk === '')
|
|
247
|
-
break;
|
|
248
|
-
else if (extendedContext) {
|
|
249
|
-
text += ` ${chunk}\n`;
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
text += `${chunk} `;
|
|
253
|
-
}
|
|
254
|
-
i++;
|
|
255
|
-
}
|
|
256
|
-
note.text = text.trim();
|
|
257
|
-
});
|
|
258
|
-
return commit;
|
|
259
|
-
}
|
|
260
|
-
// If someone wishes to include additional contextual information for a
|
|
261
|
-
// BREAKING CHANGE using markdown, they can do so by starting the line after the initial
|
|
262
|
-
// breaking change description with either:
|
|
263
|
-
//
|
|
264
|
-
// 1. a fourth-level header.
|
|
265
|
-
// 2. a bulleted list (using either '*' or '-').
|
|
266
|
-
//
|
|
267
|
-
// BREAKING CHANGE: there were breaking changes
|
|
268
|
-
// #### Deleted Endpoints
|
|
269
|
-
// - endpoint 1
|
|
270
|
-
// - endpoint 2
|
|
271
|
-
function hasExtendedContext(line) {
|
|
272
|
-
if (line.match(/^#### |^[*-] /))
|
|
273
|
-
return true;
|
|
274
|
-
return false;
|
|
275
|
-
}
|
|
276
|
-
function parseCommits(message) {
|
|
277
|
-
return conventionalCommitsFilter(toConventionalChangelogFormat(parser.parser(message))).map(postProcessCommits);
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Given a list of raw commits, parse and expand into conventional commits.
|
|
281
|
-
*
|
|
282
|
-
* @param commits {Commit[]} The input commits
|
|
283
|
-
*
|
|
284
|
-
* @returns {ConventionalCommit[]} Parsed and expanded commits. There may be
|
|
285
|
-
* more commits returned as a single raw commit may contain multiple release
|
|
286
|
-
* messages.
|
|
287
|
-
*/
|
|
288
|
-
function parseConventionalCommits(commits) {
|
|
289
|
-
const conventionalCommits = [];
|
|
290
|
-
for (const commit of commits) {
|
|
291
|
-
try {
|
|
292
|
-
for (const parsedCommit of parseCommits(commit.message)) {
|
|
293
|
-
const breaking = parsedCommit.notes.filter(note => note.title === 'BREAKING CHANGE')
|
|
294
|
-
.length > 0;
|
|
295
|
-
conventionalCommits.push({
|
|
296
|
-
sha: commit.sha,
|
|
297
|
-
message: parsedCommit.header,
|
|
298
|
-
files: commit.files,
|
|
299
|
-
pullRequest: commit.pullRequest,
|
|
300
|
-
type: parsedCommit.type,
|
|
301
|
-
scope: parsedCommit.scope,
|
|
302
|
-
bareMessage: parsedCommit.subject,
|
|
303
|
-
notes: parsedCommit.notes,
|
|
304
|
-
references: parsedCommit.references,
|
|
305
|
-
breaking,
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
catch (_err) {
|
|
310
|
-
logger_1.logger.debug(`commit could not be parsed: ${commit.sha} ${commit.message.split('\n')[0]}`);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
return conventionalCommits;
|
|
314
|
-
}
|
|
315
|
-
exports.parseConventionalCommits = parseConventionalCommits;
|
|
316
|
-
//# sourceMappingURL=commit.js.map
|
package/build/src/plugin.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { GitHub } from './github';
|
|
2
|
-
import { CandidateReleasePullRequest, RepositoryConfig } from './manifest';
|
|
3
|
-
/**
|
|
4
|
-
* A plugin runs after a repository manifest has built candidate
|
|
5
|
-
* pull requests and can make updates that span across multiple
|
|
6
|
-
* components. A plugin *might* choose to merge pull requests or add
|
|
7
|
-
* or update existing files.
|
|
8
|
-
*/
|
|
9
|
-
export declare abstract class ManifestPlugin {
|
|
10
|
-
readonly github: GitHub;
|
|
11
|
-
readonly targetBranch: string;
|
|
12
|
-
readonly repositoryConfig: RepositoryConfig;
|
|
13
|
-
constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig);
|
|
14
|
-
/**
|
|
15
|
-
* Post-process candidate pull requests.
|
|
16
|
-
* @param {CandidateReleasePullRequest[]} pullRequests Candidate pull requests
|
|
17
|
-
* @returns {CandidateReleasePullRequest[]} Updated pull requests
|
|
18
|
-
*/
|
|
19
|
-
abstract run(pullRequests: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
|
|
20
|
-
}
|
package/build/src/plugin.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2021 Google LLC
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.ManifestPlugin = void 0;
|
|
17
|
-
/**
|
|
18
|
-
* A plugin runs after a repository manifest has built candidate
|
|
19
|
-
* pull requests and can make updates that span across multiple
|
|
20
|
-
* components. A plugin *might* choose to merge pull requests or add
|
|
21
|
-
* or update existing files.
|
|
22
|
-
*/
|
|
23
|
-
class ManifestPlugin {
|
|
24
|
-
constructor(github, targetBranch, repositoryConfig) {
|
|
25
|
-
this.github = github;
|
|
26
|
-
this.targetBranch = targetBranch;
|
|
27
|
-
this.repositoryConfig = repositoryConfig;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.ManifestPlugin = ManifestPlugin;
|
|
31
|
-
//# sourceMappingURL=plugin.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ManifestPlugin } from '../plugin';
|
|
2
|
-
import { CandidateReleasePullRequest } from '../manifest';
|
|
3
|
-
/**
|
|
4
|
-
* This plugin merges multiple pull requests into a single
|
|
5
|
-
* release pull request.
|
|
6
|
-
*
|
|
7
|
-
* Release notes are broken up using `<summary>`/`<details>` blocks.
|
|
8
|
-
*/
|
|
9
|
-
export declare class Merge extends ManifestPlugin {
|
|
10
|
-
run(candidates: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
|
|
11
|
-
}
|