release-please 12.3.0 → 12.6.1
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 +28 -0
- package/README.md +5 -0
- package/build/src/bin/release-please.d.ts +2 -0
- package/build/src/bin/release-please.js +7 -0
- package/build/src/bootstrapper.d.ts +12 -0
- package/build/src/bootstrapper.js +60 -0
- package/build/src/changelog-notes/default.d.ts +15 -0
- package/build/src/changelog-notes/default.js +71 -0
- package/build/src/changelog-notes/github.d.ts +8 -0
- package/build/src/changelog-notes/github.js +26 -0
- package/build/src/changelog-notes.d.ts +19 -0
- package/build/src/changelog-notes.js +16 -0
- package/build/src/commit.d.ts +26 -0
- package/build/src/commit.js +316 -0
- package/build/src/constants.d.ts +1 -0
- package/build/src/constants.js +2 -1
- package/build/src/factory.js +2 -1
- package/build/src/github.d.ts +1 -0
- package/build/src/github.js +3 -2
- package/build/src/index.d.ts +1 -0
- package/build/src/plugin.d.ts +20 -0
- package/build/src/plugin.js +31 -0
- package/build/src/plugins/merge.d.ts +11 -0
- package/build/src/plugins/merge.js +83 -0
- package/build/src/plugins/workspace.d.ts +102 -0
- package/build/src/plugins/workspace.js +170 -0
- package/build/src/pull-request.d.ts +10 -0
- package/build/src/pull-request.js +16 -0
- package/build/src/release-notes.d.ts +29 -0
- package/build/src/release-notes.js +71 -0
- package/build/src/release-pull-request.d.ts +13 -0
- package/build/src/release-pull-request.js +16 -0
- package/build/src/release.d.ts +6 -0
- package/build/src/release.js +16 -0
- package/build/src/releasers/dart.d.ts +9 -0
- package/build/src/releasers/dart.js +65 -0
- package/build/src/releasers/index.d.ts +1 -1
- package/build/src/releasers/index.js +4 -0
- package/build/src/releasers/java-backport.d.ts +9 -0
- package/build/src/releasers/java-backport.js +43 -0
- package/build/src/repository.d.ts +5 -0
- package/build/src/repository.js +16 -0
- package/build/src/strategies/dart.d.ts +8 -0
- package/build/src/strategies/dart.js +63 -0
- package/build/src/strategies/elixir.d.ts +5 -0
- package/build/src/strategies/elixir.js +45 -0
- package/build/src/strategies/go-yoshi.d.ts +13 -0
- package/build/src/strategies/go-yoshi.js +114 -0
- package/build/src/strategies/go.d.ts +5 -0
- package/build/src/strategies/go.js +36 -0
- package/build/src/strategies/helm.d.ts +8 -0
- package/build/src/strategies/helm.js +63 -0
- package/build/src/strategies/java-yoshi.d.ts +25 -0
- package/build/src/strategies/java-yoshi.js +259 -0
- package/build/src/strategies/krm-blueprint.d.ts +7 -0
- package/build/src/strategies/krm-blueprint.js +64 -0
- package/build/src/strategies/node.d.ts +9 -0
- package/build/src/strategies/node.js +82 -0
- package/build/src/strategies/ocaml.d.ts +5 -0
- package/build/src/strategies/ocaml.js +75 -0
- package/build/src/strategies/php-yoshi.d.ts +10 -0
- package/build/src/strategies/php-yoshi.js +214 -0
- package/build/src/strategies/php.d.ts +6 -0
- package/build/src/strategies/php.js +67 -0
- package/build/src/strategies/python.d.ts +8 -0
- package/build/src/strategies/python.js +117 -0
- package/build/src/strategies/ruby-yoshi.d.ts +17 -0
- package/build/src/strategies/ruby-yoshi.js +116 -0
- package/build/src/strategies/ruby.d.ts +13 -0
- package/build/src/strategies/ruby.js +61 -0
- package/build/src/strategies/rust.d.ts +20 -0
- package/build/src/strategies/rust.js +120 -0
- package/build/src/strategies/simple.d.ts +5 -0
- package/build/src/strategies/simple.js +45 -0
- package/build/src/strategies/terraform-module.d.ts +7 -0
- package/build/src/strategies/terraform-module.js +72 -0
- package/build/src/strategy.d.ts +103 -0
- package/build/src/strategy.js +249 -0
- package/build/src/update.d.ts +23 -0
- package/build/src/update.js +16 -0
- package/build/src/updaters/composite.d.ts +19 -0
- package/build/src/updaters/composite.js +42 -0
- package/build/src/updaters/dart/pubspec-yaml.d.ts +12 -0
- package/build/src/updaters/dart/pubspec-yaml.js +45 -0
- package/build/src/updaters/default.d.ts +21 -0
- package/build/src/updaters/default.js +36 -0
- package/build/src/updaters/dotnet/csproj.d.ts +12 -0
- package/build/src/updaters/dotnet/csproj.js +33 -0
- package/build/src/updaters/elixir/elixir-mix-exs.d.ts +12 -0
- package/build/src/updaters/elixir/elixir-mix-exs.js +37 -0
- package/build/src/updaters/go/version-go.d.ts +4 -0
- package/build/src/updaters/go/version-go.js +24 -0
- package/build/src/updaters/java/java-update.d.ts +14 -0
- package/build/src/updaters/java/java-update.js +76 -0
- package/build/src/updaters/node/package-json.d.ts +12 -0
- package/build/src/updaters/node/package-json.js +37 -0
- package/build/src/updaters/node/package-lock-json.d.ts +8 -0
- package/build/src/updaters/node/package-lock-json.js +36 -0
- package/build/src/updaters/node/samples-package-json.d.ts +23 -0
- package/build/src/updaters/node/samples-package-json.js +49 -0
- package/build/src/updaters/php/php-client-version.d.ts +12 -0
- package/build/src/updaters/php/php-client-version.js +32 -0
- package/build/src/updaters/php/php-manifest.d.ts +13 -0
- package/build/src/updaters/php/php-manifest.js +55 -0
- package/build/src/updaters/php/root-composer-update-packages.d.ts +12 -0
- package/build/src/updaters/php/root-composer-update-packages.js +47 -0
- package/build/src/updaters/pubspec-yaml.d.ts +13 -0
- package/build/src/updaters/pubspec-yaml.js +44 -0
- package/build/src/updaters/raw-content.d.ts +19 -0
- package/build/src/updaters/raw-content.js +39 -0
- package/build/src/updaters/release-please-config.d.ts +8 -0
- package/build/src/updaters/release-please-config.js +41 -0
- package/build/src/updaters/ruby/version-rb.d.ts +12 -0
- package/build/src/updaters/ruby/version-rb.js +32 -0
- package/build/src/updaters/rust/cargo-toml.js +5 -1
- package/build/src/util/commit-split.d.ts +11 -0
- package/build/src/util/commit-split.js +94 -0
- package/build/src/util/pull-request-body.d.ts +20 -0
- package/build/src/util/pull-request-body.js +129 -0
- package/build/src/util/tag-name.d.ts +9 -0
- package/build/src/util/tag-name.js +41 -0
- package/build/src/util/toml-edit.d.ts +8 -0
- package/build/src/util/toml-edit.js +125 -0
- package/build/src/version.d.ts +11 -0
- package/build/src/version.js +45 -0
- package/build/src/versioning-strategies/always-bump-patch.d.ts +7 -0
- package/build/src/versioning-strategies/always-bump-patch.js +25 -0
- package/build/src/versioning-strategies/default.d.ts +15 -0
- package/build/src/versioning-strategies/default.js +67 -0
- package/build/src/versioning-strategies/dependency-manifest.d.ts +7 -0
- package/build/src/versioning-strategies/dependency-manifest.js +90 -0
- package/build/src/versioning-strategies/java-add-snapshot.d.ts +9 -0
- package/build/src/versioning-strategies/java-add-snapshot.js +53 -0
- package/build/src/versioning-strategies/java-snapshot.d.ts +9 -0
- package/build/src/versioning-strategies/java-snapshot.js +67 -0
- package/build/src/versioning-strategies/service-pack.d.ts +7 -0
- package/build/src/versioning-strategies/service-pack.js +40 -0
- package/build/src/versioning-strategy.d.ts +28 -0
- package/build/src/versioning-strategy.js +55 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,34 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
|
|
6
6
|
|
|
7
|
+
### [12.6.1](https://www.github.com/googleapis/release-please/compare/v12.6.0...v12.6.1) (2021-12-21)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **rust:** Don't update dev-dependencies lacking a version key ([#1095](https://www.github.com/googleapis/release-please/issues/1095)) ([dc1bad9](https://www.github.com/googleapis/release-please/commit/dc1bad997ef0d028e280e75b0e6510a99d06cb44))
|
|
13
|
+
|
|
14
|
+
## [12.6.0](https://www.github.com/googleapis/release-please/compare/v12.5.0...v12.6.0) (2021-10-11)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* add GraphQL URL option for Github ([#1083](https://www.github.com/googleapis/release-please/issues/1083)) ([ec661e2](https://www.github.com/googleapis/release-please/commit/ec661e22c7f5fa80e26d32d4cf0d93a4a90af4be)), closes [#1082](https://www.github.com/googleapis/release-please/issues/1082)
|
|
20
|
+
|
|
21
|
+
## [12.5.0](https://www.github.com/googleapis/release-please/compare/v12.4.0...v12.5.0) (2021-09-29)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* add java-backport releaser ([#1074](https://www.github.com/googleapis/release-please/issues/1074)) ([e98b165](https://www.github.com/googleapis/release-please/commit/e98b16549be4ee688660eb2337be6b0ed2f0a4cd))
|
|
27
|
+
|
|
28
|
+
## [12.4.0](https://www.github.com/googleapis/release-please/compare/v12.3.0...v12.4.0) (2021-09-29)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* add dart updater and releaser ([#1053](https://www.github.com/googleapis/release-please/issues/1053)) ([f0d0fb8](https://www.github.com/googleapis/release-please/commit/f0d0fb84d47b6df77bb6b5563482bfac4aec2c94))
|
|
34
|
+
|
|
7
35
|
## [12.3.0](https://www.github.com/googleapis/release-please/compare/v12.2.0...v12.3.0) (2021-09-24)
|
|
8
36
|
|
|
9
37
|
|
package/README.md
CHANGED
|
@@ -104,6 +104,7 @@ Release Please automates releases for the following flavors of repositories:
|
|
|
104
104
|
| simple | [A repository with a version.txt and a CHANGELOG.md](https://github.com/googleapis/gapic-generator) |
|
|
105
105
|
| helm | A repository with a Chart.yaml and a CHANGELOG.md |
|
|
106
106
|
| elixir | A repository with a mix.exs and a CHANGELOG.md |
|
|
107
|
+
| dart | A repository with a pubspec.yaml and a CHANGELOG.md |
|
|
107
108
|
|
|
108
109
|
## Adding additional release types
|
|
109
110
|
|
|
@@ -217,6 +218,8 @@ release-please release-pr --package-name=@google-cloud/firestore" \
|
|
|
217
218
|
| `--monorepo-tags` | add prefix to tags and branches, allowing multiple libraries to be released from the same repository. |
|
|
218
219
|
| `--pull-request-title-pattern` | add title pattern to make release PR, defaults to using `chore${scope}: release${component} ${version}`. |
|
|
219
220
|
| `--signoff` | Add [`Signed-off-by`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff) line at the end of the commit log message using the user and email provided. (format "Name \<email@example.com\>") |
|
|
221
|
+
| `--api-url` | URL to use when making API requests [default: "https://api.github.com"] |
|
|
222
|
+
| `--graphql-url` | URL to use when making GraphQL requests [default: "https://api.github.com"] |
|
|
220
223
|
|
|
221
224
|
### Creating a release on GitHub
|
|
222
225
|
|
|
@@ -231,6 +234,8 @@ release-please github-release --repo-url=googleapis/nodejs-firestore \
|
|
|
231
234
|
| `--repo-url` | is the URL of the repository on GitHub. |
|
|
232
235
|
| `--token` | a token with write access to `--repo-url`. |
|
|
233
236
|
| `--path` | create a release from a path other than the repository's root |
|
|
237
|
+
| `--api-url` | URL to use when making API requests [default: "https://api.github.com"] |
|
|
238
|
+
| `--graphql-url` | URL to use when making GraphQL requests [default: "https://api.github.com"] |
|
|
234
239
|
|
|
235
240
|
### Running as a GitHub App
|
|
236
241
|
|
|
@@ -175,6 +175,8 @@ exports.parser = yargs
|
|
|
175
175
|
argv.token = coerce_option_1.coerceOption(argv.token);
|
|
176
176
|
if (argv.apiUrl)
|
|
177
177
|
argv.apiUrl = coerce_option_1.coerceOption(argv.apiUrl);
|
|
178
|
+
if (argv.graphqlUrl)
|
|
179
|
+
argv.graphqlUrl = coerce_option_1.coerceOption(argv.graphqlUrl);
|
|
178
180
|
})
|
|
179
181
|
.option('debug', {
|
|
180
182
|
describe: 'print verbose errors (use only for local debugging).',
|
|
@@ -187,6 +189,11 @@ exports.parser = yargs
|
|
|
187
189
|
describe: 'URL to use when making API requests',
|
|
188
190
|
default: constants_1.GH_API_URL,
|
|
189
191
|
type: 'string',
|
|
192
|
+
})
|
|
193
|
+
.option('graphql-url', {
|
|
194
|
+
describe: 'URL to use when making GraphQL requests',
|
|
195
|
+
default: constants_1.GH_GRAPHQL_URL,
|
|
196
|
+
type: 'string',
|
|
190
197
|
})
|
|
191
198
|
.option('default-branch', {
|
|
192
199
|
describe: 'The branch to open release PRs against and tag releases on',
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
|
@@ -0,0 +1,15 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1,26 @@
|
|
|
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[];
|
|
@@ -0,0 +1,316 @@
|
|
|
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
|