@release-please-oss/release-please 0.0.0-stage → 17.11.3
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/LICENSE +202 -0
- package/README.md +279 -2
- package/build/src/bin/release-please.d.ts +22 -0
- package/build/src/bin/release-please.js +727 -0
- package/build/src/bootstrapper.d.ts +18 -0
- package/build/src/bootstrapper.js +64 -0
- package/build/src/changelog-notes/default.d.ts +15 -0
- package/build/src/changelog-notes/default.js +96 -0
- package/build/src/changelog-notes/github.d.ts +8 -0
- package/build/src/changelog-notes/github.js +29 -0
- package/build/src/changelog-notes.d.ts +22 -0
- package/build/src/changelog-notes.js +40 -0
- package/build/src/commit.d.ts +33 -0
- package/build/src/commit.js +422 -0
- package/build/src/errors/index.d.ts +36 -0
- package/build/src/errors/index.js +77 -0
- package/build/src/factories/changelog-notes-factory.d.ts +16 -0
- package/build/src/factories/changelog-notes-factory.js +44 -0
- package/build/src/factories/plugin-factory.d.ts +23 -0
- package/build/src/factories/plugin-factory.js +94 -0
- package/build/src/factories/versioning-strategy-factory.d.ts +16 -0
- package/build/src/factories/versioning-strategy-factory.js +52 -0
- package/build/src/factory.d.ts +18 -0
- package/build/src/factory.js +161 -0
- package/build/src/github-api.d.ts +260 -0
- package/build/src/github-api.js +714 -0
- package/build/src/github.d.ts +306 -0
- package/build/src/github.js +769 -0
- package/build/src/index.d.ts +17 -0
- package/build/src/index.js +41 -0
- package/build/src/local-github.d.ts +270 -0
- package/build/src/local-github.js +756 -0
- package/build/src/manifest.d.ts +370 -0
- package/build/src/manifest.js +1142 -0
- package/build/src/plugin.d.ts +37 -0
- package/build/src/plugin.js +57 -0
- package/build/src/plugins/cargo-workspace.d.ts +58 -0
- package/build/src/plugins/cargo-workspace.js +339 -0
- package/build/src/plugins/group-priority.d.ts +29 -0
- package/build/src/plugins/group-priority.js +82 -0
- package/build/src/plugins/linked-versions.d.ts +36 -0
- package/build/src/plugins/linked-versions.js +137 -0
- package/build/src/plugins/maven-workspace.d.ts +81 -0
- package/build/src/plugins/maven-workspace.js +431 -0
- package/build/src/plugins/merge.d.ts +27 -0
- package/build/src/plugins/merge.js +99 -0
- package/build/src/plugins/node-workspace.d.ts +50 -0
- package/build/src/plugins/node-workspace.js +352 -0
- package/build/src/plugins/sentence-case.d.ts +19 -0
- package/build/src/plugins/sentence-case.js +80 -0
- package/build/src/plugins/workspace.d.ts +173 -0
- package/build/src/plugins/workspace.js +308 -0
- package/build/src/pull-request.d.ts +11 -0
- package/build/src/pull-request.js +16 -0
- package/build/src/release-pull-request.d.ts +14 -0
- package/build/src/release-pull-request.js +16 -0
- package/build/src/release.d.ts +7 -0
- package/build/src/release.js +16 -0
- package/build/src/repository.d.ts +5 -0
- package/build/src/repository.js +16 -0
- package/build/src/scm.d.ts +80 -0
- package/build/src/scm.js +16 -0
- package/build/src/strategies/base.d.ts +162 -0
- package/build/src/strategies/base.js +494 -0
- package/build/src/strategies/bazel.d.ts +7 -0
- package/build/src/strategies/bazel.js +49 -0
- package/build/src/strategies/dart.d.ts +8 -0
- package/build/src/strategies/dart.js +73 -0
- package/build/src/strategies/dotnet-yoshi.d.ts +13 -0
- package/build/src/strategies/dotnet-yoshi.js +109 -0
- package/build/src/strategies/elixir.d.ts +5 -0
- package/build/src/strategies/elixir.js +46 -0
- package/build/src/strategies/expo.d.ts +15 -0
- package/build/src/strategies/expo.js +51 -0
- package/build/src/strategies/go-librarian.d.ts +11 -0
- package/build/src/strategies/go-librarian.js +84 -0
- package/build/src/strategies/go-yoshi.d.ts +14 -0
- package/build/src/strategies/go-yoshi.js +168 -0
- package/build/src/strategies/go.d.ts +7 -0
- package/build/src/strategies/go.js +53 -0
- package/build/src/strategies/helm.d.ts +8 -0
- package/build/src/strategies/helm.js +73 -0
- package/build/src/strategies/java-yoshi-mono-repo.d.ts +22 -0
- package/build/src/strategies/java-yoshi-mono-repo.js +308 -0
- package/build/src/strategies/java-yoshi.d.ts +20 -0
- package/build/src/strategies/java-yoshi.js +210 -0
- package/build/src/strategies/java.d.ts +28 -0
- package/build/src/strategies/java.js +176 -0
- package/build/src/strategies/krm-blueprint.d.ts +7 -0
- package/build/src/strategies/krm-blueprint.js +65 -0
- package/build/src/strategies/maven.d.ts +9 -0
- package/build/src/strategies/maven.js +56 -0
- package/build/src/strategies/node-librarian.d.ts +10 -0
- package/build/src/strategies/node-librarian.js +121 -0
- package/build/src/strategies/node.d.ts +10 -0
- package/build/src/strategies/node.js +111 -0
- package/build/src/strategies/ocaml.d.ts +5 -0
- package/build/src/strategies/ocaml.js +86 -0
- package/build/src/strategies/php-librarian.d.ts +6 -0
- package/build/src/strategies/php-librarian.js +35 -0
- package/build/src/strategies/php-yoshi.d.ts +13 -0
- package/build/src/strategies/php-yoshi.js +255 -0
- package/build/src/strategies/php.d.ts +6 -0
- package/build/src/strategies/php.js +76 -0
- package/build/src/strategies/python-librarian.d.ts +6 -0
- package/build/src/strategies/python-librarian.js +35 -0
- package/build/src/strategies/python.d.ts +11 -0
- package/build/src/strategies/python.js +175 -0
- package/build/src/strategies/r.d.ts +8 -0
- package/build/src/strategies/r.js +67 -0
- package/build/src/strategies/ruby-librarian.d.ts +6 -0
- package/build/src/strategies/ruby-librarian.js +35 -0
- package/build/src/strategies/ruby-yoshi.d.ts +13 -0
- package/build/src/strategies/ruby-yoshi.js +97 -0
- package/build/src/strategies/ruby.d.ts +9 -0
- package/build/src/strategies/ruby.js +71 -0
- package/build/src/strategies/rust.d.ts +17 -0
- package/build/src/strategies/rust.js +149 -0
- package/build/src/strategies/sfdx.d.ts +9 -0
- package/build/src/strategies/sfdx.js +67 -0
- package/build/src/strategies/simple.d.ts +7 -0
- package/build/src/strategies/simple.js +51 -0
- package/build/src/strategies/terraform-module.d.ts +7 -0
- package/build/src/strategies/terraform-module.js +90 -0
- package/build/src/strategy.d.ts +68 -0
- package/build/src/strategy.js +16 -0
- package/build/src/update.d.ts +24 -0
- package/build/src/update.js +16 -0
- package/build/src/updaters/base-xml.d.ts +19 -0
- package/build/src/updaters/base-xml.js +43 -0
- package/build/src/updaters/bazel/module-bazel.d.ts +7 -0
- package/build/src/updaters/bazel/module-bazel.js +33 -0
- package/build/src/updaters/changelog-json.d.ts +29 -0
- package/build/src/updaters/changelog-json.js +100 -0
- package/build/src/updaters/changelog.d.ts +13 -0
- package/build/src/updaters/changelog.js +55 -0
- package/build/src/updaters/composite.d.ts +20 -0
- package/build/src/updaters/composite.js +65 -0
- package/build/src/updaters/dart/pubspec-yaml.d.ts +13 -0
- package/build/src/updaters/dart/pubspec-yaml.js +50 -0
- package/build/src/updaters/default.d.ts +21 -0
- package/build/src/updaters/default.js +36 -0
- package/build/src/updaters/dotnet/apis.d.ts +18 -0
- package/build/src/updaters/dotnet/apis.js +45 -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 +13 -0
- package/build/src/updaters/elixir/elixir-mix-exs.js +42 -0
- package/build/src/updaters/expo/app-json.d.ts +31 -0
- package/build/src/updaters/expo/app-json.js +67 -0
- package/build/src/updaters/generic-json.d.ts +14 -0
- package/build/src/updaters/generic-json.js +54 -0
- package/build/src/updaters/generic-toml.d.ts +21 -0
- package/build/src/updaters/generic-toml.js +66 -0
- package/build/src/updaters/generic-xml.d.ts +8 -0
- package/build/src/updaters/generic-xml.js +38 -0
- package/build/src/updaters/generic-yaml.d.ts +23 -0
- package/build/src/updaters/generic-yaml.js +85 -0
- package/build/src/updaters/generic.d.ts +54 -0
- package/build/src/updaters/generic.js +187 -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/helm/chart-yaml.d.ts +13 -0
- package/build/src/updaters/helm/chart-yaml.js +41 -0
- package/build/src/updaters/java/java-released.d.ts +28 -0
- package/build/src/updaters/java/java-released.js +59 -0
- package/build/src/updaters/java/java-update.d.ts +21 -0
- package/build/src/updaters/java/java-update.js +80 -0
- package/build/src/updaters/java/pom-xml.d.ts +29 -0
- package/build/src/updaters/java/pom-xml.js +135 -0
- package/build/src/updaters/java/versions-manifest.d.ts +19 -0
- package/build/src/updaters/java/versions-manifest.js +71 -0
- package/build/src/updaters/krm/krm-blueprint-version.d.ts +13 -0
- package/build/src/updaters/krm/krm-blueprint-version.js +46 -0
- package/build/src/updaters/librarian-yaml.d.ts +45 -0
- package/build/src/updaters/librarian-yaml.js +149 -0
- package/build/src/updaters/node/package-json.d.ts +46 -0
- package/build/src/updaters/node/package-json.js +106 -0
- package/build/src/updaters/node/package-lock-json.d.ts +14 -0
- package/build/src/updaters/node/package-lock-json.js +83 -0
- package/build/src/updaters/node/samples-package-json.d.ts +24 -0
- package/build/src/updaters/node/samples-package-json.js +49 -0
- package/build/src/updaters/ocaml/dune-project.d.ts +13 -0
- package/build/src/updaters/ocaml/dune-project.js +37 -0
- package/build/src/updaters/ocaml/esy-json.d.ts +13 -0
- package/build/src/updaters/ocaml/esy-json.js +37 -0
- package/build/src/updaters/ocaml/opam.d.ts +13 -0
- package/build/src/updaters/ocaml/opam.js +37 -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/root-composer-update-packages.d.ts +13 -0
- package/build/src/updaters/php/root-composer-update-packages.js +60 -0
- package/build/src/updaters/python/pyproject-toml.d.ts +29 -0
- package/build/src/updaters/python/pyproject-toml.js +53 -0
- package/build/src/updaters/python/python-file-with-version.d.ts +12 -0
- package/build/src/updaters/python/python-file-with-version.js +32 -0
- package/build/src/updaters/python/setup-cfg.d.ts +12 -0
- package/build/src/updaters/python/setup-cfg.js +32 -0
- package/build/src/updaters/python/setup-py.d.ts +12 -0
- package/build/src/updaters/python/setup-py.js +32 -0
- package/build/src/updaters/r/description.d.ts +12 -0
- package/build/src/updaters/r/description.js +32 -0
- package/build/src/updaters/r/news.d.ts +12 -0
- package/build/src/updaters/r/news.js +49 -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 +80 -0
- package/build/src/updaters/release-please-manifest.d.ts +4 -0
- package/build/src/updaters/release-please-manifest.js +34 -0
- package/build/src/updaters/ruby/common.d.ts +17 -0
- package/build/src/updaters/ruby/common.js +46 -0
- package/build/src/updaters/ruby/gemfile-lock.d.ts +24 -0
- package/build/src/updaters/ruby/gemfile-lock.js +53 -0
- package/build/src/updaters/ruby/version-rb.d.ts +12 -0
- package/build/src/updaters/ruby/version-rb.js +34 -0
- package/build/src/updaters/rust/cargo-lock.d.ts +16 -0
- package/build/src/updaters/rust/cargo-lock.js +64 -0
- package/build/src/updaters/rust/cargo-toml.d.ts +13 -0
- package/build/src/updaters/rust/cargo-toml.js +89 -0
- package/build/src/updaters/rust/common.d.ts +54 -0
- package/build/src/updaters/rust/common.js +35 -0
- package/build/src/updaters/sfdx/sfdx-project-json.d.ts +21 -0
- package/build/src/updaters/sfdx/sfdx-project-json.js +41 -0
- package/build/src/updaters/terraform/metadata-version.d.ts +13 -0
- package/build/src/updaters/terraform/metadata-version.js +37 -0
- package/build/src/updaters/terraform/module-version.d.ts +13 -0
- package/build/src/updaters/terraform/module-version.js +37 -0
- package/build/src/updaters/terraform/readme.d.ts +12 -0
- package/build/src/updaters/terraform/readme.js +32 -0
- package/build/src/util/branch-name.d.ts +20 -0
- package/build/src/util/branch-name.js +225 -0
- package/build/src/util/code-suggester/default-options-handler.d.ts +10 -0
- package/build/src/util/code-suggester/default-options-handler.js +45 -0
- package/build/src/util/code-suggester/errors.d.ts +4 -0
- package/build/src/util/code-suggester/errors.js +24 -0
- package/build/src/util/code-suggester/github/branch.d.ts +45 -0
- package/build/src/util/code-suggester/github/branch.js +118 -0
- package/build/src/util/code-suggester/github/commit-and-push.d.ts +51 -0
- package/build/src/util/code-suggester/github/commit-and-push.js +141 -0
- package/build/src/util/code-suggester/github/create-commit.d.ts +20 -0
- package/build/src/util/code-suggester/github/create-commit.js +60 -0
- package/build/src/util/code-suggester/github/fork.d.ts +15 -0
- package/build/src/util/code-suggester/github/fork.js +48 -0
- package/build/src/util/code-suggester/github/labels.d.ts +14 -0
- package/build/src/util/code-suggester/github/labels.js +42 -0
- package/build/src/util/code-suggester/github/open-pull-request.d.ts +16 -0
- package/build/src/util/code-suggester/github/open-pull-request.js +56 -0
- package/build/src/util/code-suggester/index.d.ts +28 -0
- package/build/src/util/code-suggester/index.js +110 -0
- package/build/src/util/code-suggester/logger.d.ts +4 -0
- package/build/src/util/code-suggester/logger.js +37 -0
- package/build/src/util/code-suggester/types.d.ts +109 -0
- package/build/src/util/code-suggester/types.js +30 -0
- package/build/src/util/coerce-option.d.ts +1 -0
- package/build/src/util/coerce-option.js +40 -0
- package/build/src/util/commit-exclude.d.ts +10 -0
- package/build/src/util/commit-exclude.js +49 -0
- package/build/src/util/commit-split.d.ts +26 -0
- package/build/src/util/commit-split.js +100 -0
- package/build/src/util/commit-utils.d.ts +1 -0
- package/build/src/util/commit-utils.js +34 -0
- package/build/src/util/filter-commits.d.ts +12 -0
- package/build/src/util/filter-commits.js +59 -0
- package/build/src/util/indent-commit.d.ts +2 -0
- package/build/src/util/indent-commit.js +39 -0
- package/build/src/util/json-stringify.d.ts +1 -0
- package/build/src/util/json-stringify.js +22 -0
- package/build/src/util/logger.d.ts +24 -0
- package/build/src/util/logger.js +54 -0
- package/build/src/util/pull-request-body.d.ts +25 -0
- package/build/src/util/pull-request-body.js +147 -0
- package/build/src/util/pull-request-overflow-handler.d.ts +54 -0
- package/build/src/util/pull-request-overflow-handler.js +78 -0
- package/build/src/util/pull-request-title.d.ts +22 -0
- package/build/src/util/pull-request-title.js +146 -0
- package/build/src/util/signoff-commit-message.d.ts +1 -0
- package/build/src/util/signoff-commit-message.js +35 -0
- package/build/src/util/tag-name.d.ts +10 -0
- package/build/src/util/tag-name.js +42 -0
- package/build/src/util/toml-edit.d.ts +16 -0
- package/build/src/util/toml-edit.js +126 -0
- package/build/src/version.d.ts +35 -0
- package/build/src/version.js +74 -0
- package/build/src/versioning-strategies/always-bump-major.d.ts +10 -0
- package/build/src/versioning-strategies/always-bump-major.js +28 -0
- package/build/src/versioning-strategies/always-bump-minor.d.ts +10 -0
- package/build/src/versioning-strategies/always-bump-minor.js +28 -0
- package/build/src/versioning-strategies/always-bump-patch.d.ts +11 -0
- package/build/src/versioning-strategies/always-bump-patch.js +29 -0
- package/build/src/versioning-strategies/default.d.ts +48 -0
- package/build/src/versioning-strategies/default.js +102 -0
- package/build/src/versioning-strategies/dependency-manifest.d.ts +15 -0
- package/build/src/versioning-strategies/dependency-manifest.js +103 -0
- package/build/src/versioning-strategies/java-add-snapshot.d.ts +13 -0
- package/build/src/versioning-strategies/java-add-snapshot.js +54 -0
- package/build/src/versioning-strategies/java-snapshot.d.ts +13 -0
- package/build/src/versioning-strategies/java-snapshot.js +70 -0
- package/build/src/versioning-strategies/prerelease.d.ts +20 -0
- package/build/src/versioning-strategies/prerelease.js +163 -0
- package/build/src/versioning-strategies/service-pack.d.ts +12 -0
- package/build/src/versioning-strategies/service-pack.js +47 -0
- package/build/src/versioning-strategy.d.ts +90 -0
- package/build/src/versioning-strategy.js +82 -0
- package/package.json +114 -4
- package/schemas/config.json +513 -0
- package/schemas/manifest.json +9 -0
- package/templates/commit.hbs +2 -0
- package/templates/header.hbs +9 -0
- package/templates/template.hbs +19 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2023 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.CommitExclude = void 0;
|
|
17
|
+
const manifest_1 = require("../manifest");
|
|
18
|
+
const commit_utils_1 = require("./commit-utils");
|
|
19
|
+
class CommitExclude {
|
|
20
|
+
constructor(config) {
|
|
21
|
+
this.excludePaths = {};
|
|
22
|
+
Object.entries(config).forEach(([path, releaseConfig]) => {
|
|
23
|
+
if (releaseConfig.excludePaths) {
|
|
24
|
+
this.excludePaths[path] = (0, commit_utils_1.normalizePaths)(releaseConfig.excludePaths);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
excludeCommits(commitsPerPath) {
|
|
29
|
+
const filteredCommitsPerPath = {};
|
|
30
|
+
Object.entries(commitsPerPath).forEach(([path, commits]) => {
|
|
31
|
+
if (this.excludePaths[path]) {
|
|
32
|
+
commits = commits.filter(commit => this.shouldInclude(commit, this.excludePaths[path], path));
|
|
33
|
+
}
|
|
34
|
+
filteredCommitsPerPath[path] = commits;
|
|
35
|
+
});
|
|
36
|
+
return filteredCommitsPerPath;
|
|
37
|
+
}
|
|
38
|
+
shouldInclude(commit, excludePaths, packagePath) {
|
|
39
|
+
return (!commit.files ||
|
|
40
|
+
!commit.files
|
|
41
|
+
.filter(file => this.isRelevant(file, packagePath))
|
|
42
|
+
.every(file => excludePaths.some(path => this.isRelevant(file, path))));
|
|
43
|
+
}
|
|
44
|
+
isRelevant(file, path) {
|
|
45
|
+
return path === manifest_1.ROOT_PROJECT_PATH || file.indexOf(`${path}/`) === 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.CommitExclude = CommitExclude;
|
|
49
|
+
//# sourceMappingURL=commit-exclude.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Commit } from '../commit';
|
|
2
|
+
export interface CommitSplitOptions {
|
|
3
|
+
includeEmpty?: boolean;
|
|
4
|
+
packagePaths?: string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Helper class for splitting commits by component path. If `packagePaths`
|
|
8
|
+
* is configured, then only consider the provided paths. If `includeEmpty`
|
|
9
|
+
* is configured, then commits without any touched files apply to all
|
|
10
|
+
* configured component paths.
|
|
11
|
+
*/
|
|
12
|
+
export declare class CommitSplit {
|
|
13
|
+
includeEmpty: boolean;
|
|
14
|
+
packagePaths?: string[];
|
|
15
|
+
constructor(opts?: CommitSplitOptions);
|
|
16
|
+
/**
|
|
17
|
+
* Split commits by component path. If the commit splitter is configured
|
|
18
|
+
* with a set of tracked package paths, then only consider paths for
|
|
19
|
+
* configured components. If `includeEmpty` is configured, then a commit
|
|
20
|
+
* that does not touch any files will be applied to all components'
|
|
21
|
+
* commits.
|
|
22
|
+
* @param {Commit[]} commits The commits to split
|
|
23
|
+
* @returns {Record<string, Commit[]>} Commits indexed by component path
|
|
24
|
+
*/
|
|
25
|
+
split<T extends Commit>(commits: T[]): Record<string, T[]>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2019 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.CommitSplit = void 0;
|
|
17
|
+
const manifest_1 = require("../manifest");
|
|
18
|
+
const commit_utils_1 = require("./commit-utils");
|
|
19
|
+
/**
|
|
20
|
+
* Helper class for splitting commits by component path. If `packagePaths`
|
|
21
|
+
* is configured, then only consider the provided paths. If `includeEmpty`
|
|
22
|
+
* is configured, then commits without any touched files apply to all
|
|
23
|
+
* configured component paths.
|
|
24
|
+
*/
|
|
25
|
+
class CommitSplit {
|
|
26
|
+
constructor(opts) {
|
|
27
|
+
opts = opts || {};
|
|
28
|
+
this.includeEmpty = !!opts.includeEmpty;
|
|
29
|
+
if (opts.packagePaths) {
|
|
30
|
+
const paths = (0, commit_utils_1.normalizePaths)(opts.packagePaths);
|
|
31
|
+
this.packagePaths = paths
|
|
32
|
+
.filter(path => {
|
|
33
|
+
// The special "." path, representing the root of the module, should be
|
|
34
|
+
// ignored by commit-split as it is assigned all commits in manifest.ts
|
|
35
|
+
return path !== manifest_1.ROOT_PROJECT_PATH;
|
|
36
|
+
})
|
|
37
|
+
.sort((a, b) => b.length - a.length); // sort by longest paths first
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Split commits by component path. If the commit splitter is configured
|
|
42
|
+
* with a set of tracked package paths, then only consider paths for
|
|
43
|
+
* configured components. If `includeEmpty` is configured, then a commit
|
|
44
|
+
* that does not touch any files will be applied to all components'
|
|
45
|
+
* commits.
|
|
46
|
+
* @param {Commit[]} commits The commits to split
|
|
47
|
+
* @returns {Record<string, Commit[]>} Commits indexed by component path
|
|
48
|
+
*/
|
|
49
|
+
split(commits) {
|
|
50
|
+
const splitCommits = {};
|
|
51
|
+
commits.forEach(commit => {
|
|
52
|
+
if (commit.files === undefined) {
|
|
53
|
+
throw new Error(`Commit ${commit.sha} is missing files. Did you set "backfillFiles" to "true"?`);
|
|
54
|
+
}
|
|
55
|
+
const dedupe = new Set();
|
|
56
|
+
for (let i = 0; i < commit.files.length; i++) {
|
|
57
|
+
const file = commit.files[i];
|
|
58
|
+
// NOTE: GitHub API always returns paths using the `/` separator,
|
|
59
|
+
// regardless of what platform the client code is running on
|
|
60
|
+
const splitPath = file.split('/');
|
|
61
|
+
// indicates that we have a top-level file and not a folder
|
|
62
|
+
// in this edge-case we should not attempt to update the path.
|
|
63
|
+
if (splitPath.length === 1)
|
|
64
|
+
continue;
|
|
65
|
+
let pkgName;
|
|
66
|
+
if (this.packagePaths) {
|
|
67
|
+
// only track paths under this.packagePaths
|
|
68
|
+
pkgName = this.packagePaths.find(p => file.indexOf(`${p}/`) === 0);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// track paths by top level folder
|
|
72
|
+
pkgName = splitPath[0];
|
|
73
|
+
}
|
|
74
|
+
if (!pkgName || dedupe.has(pkgName))
|
|
75
|
+
continue;
|
|
76
|
+
else
|
|
77
|
+
dedupe.add(pkgName);
|
|
78
|
+
if (!splitCommits[pkgName])
|
|
79
|
+
splitCommits[pkgName] = [];
|
|
80
|
+
splitCommits[pkgName].push(commit);
|
|
81
|
+
}
|
|
82
|
+
if (commit.files.length === 0 && this.includeEmpty) {
|
|
83
|
+
if (this.packagePaths) {
|
|
84
|
+
for (const pkgName of this.packagePaths) {
|
|
85
|
+
splitCommits[pkgName] = splitCommits[pkgName] || [];
|
|
86
|
+
splitCommits[pkgName].push(commit);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
for (const pkgName in splitCommits) {
|
|
91
|
+
splitCommits[pkgName].push(commit);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return splitCommits;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.CommitSplit = CommitSplit;
|
|
100
|
+
//# sourceMappingURL=commit-split.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const normalizePaths: (paths: string[]) => string[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2023 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.normalizePaths = void 0;
|
|
17
|
+
const normalizePaths = (paths) => {
|
|
18
|
+
return paths.map(path => {
|
|
19
|
+
// normalize so that all paths have leading and trailing slashes for
|
|
20
|
+
// non-overlap validation.
|
|
21
|
+
// NOTE: GitHub API always returns paths using the `/` separator,
|
|
22
|
+
// regardless of what platform the client code is running on
|
|
23
|
+
let newPath = path.replace(/\/$/, '');
|
|
24
|
+
newPath = newPath.replace(/^\//, '');
|
|
25
|
+
newPath = newPath.replace(/$/, '/');
|
|
26
|
+
newPath = newPath.replace(/^/, '/');
|
|
27
|
+
// store them with leading and trailing slashes removed.
|
|
28
|
+
newPath = newPath.replace(/\/$/, '');
|
|
29
|
+
newPath = newPath.replace(/^\//, '');
|
|
30
|
+
return newPath;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
exports.normalizePaths = normalizePaths;
|
|
34
|
+
//# sourceMappingURL=commit-utils.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChangelogSection } from '../changelog-notes';
|
|
2
|
+
import { ConventionalCommit } from '../commit';
|
|
3
|
+
/**
|
|
4
|
+
* Given a set of conventional commits and the configured
|
|
5
|
+
* changelog sections provided by the user, return the set
|
|
6
|
+
* of commits that should be displayed:
|
|
7
|
+
*
|
|
8
|
+
* @param commits
|
|
9
|
+
* @param changelogSections
|
|
10
|
+
* @returns ConventionalCommit[]
|
|
11
|
+
*/
|
|
12
|
+
export declare function filterCommits(commits: ConventionalCommit[], changelogSections?: ChangelogSection[]): ConventionalCommit[];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2023 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.filterCommits = void 0;
|
|
17
|
+
const BREAKING_CHANGE_NOTE = 'BREAKING CHANGE';
|
|
18
|
+
const DEFAULT_CHANGELOG_SECTIONS = [
|
|
19
|
+
{ type: 'feat', section: 'Features' },
|
|
20
|
+
{ type: 'fix', section: 'Bug Fixes' },
|
|
21
|
+
{ type: 'perf', section: 'Performance Improvements' },
|
|
22
|
+
{ type: 'revert', section: 'Reverts' },
|
|
23
|
+
{ type: 'chore', section: 'Miscellaneous Chores', hidden: true },
|
|
24
|
+
{ type: 'docs', section: 'Documentation', hidden: true },
|
|
25
|
+
{ type: 'style', section: 'Styles', hidden: true },
|
|
26
|
+
{ type: 'refactor', section: 'Code Refactoring', hidden: true },
|
|
27
|
+
{ type: 'test', section: 'Tests', hidden: true },
|
|
28
|
+
{ type: 'build', section: 'Build System', hidden: true },
|
|
29
|
+
{ type: 'ci', section: 'Continuous Integration', hidden: true },
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* Given a set of conventional commits and the configured
|
|
33
|
+
* changelog sections provided by the user, return the set
|
|
34
|
+
* of commits that should be displayed:
|
|
35
|
+
*
|
|
36
|
+
* @param commits
|
|
37
|
+
* @param changelogSections
|
|
38
|
+
* @returns ConventionalCommit[]
|
|
39
|
+
*/
|
|
40
|
+
function filterCommits(commits, changelogSections) {
|
|
41
|
+
changelogSections = changelogSections !== null && changelogSections !== void 0 ? changelogSections : DEFAULT_CHANGELOG_SECTIONS;
|
|
42
|
+
const hiddenSections = [];
|
|
43
|
+
const visibleSections = [];
|
|
44
|
+
for (const section of changelogSections) {
|
|
45
|
+
if (!section.hidden)
|
|
46
|
+
visibleSections.push(section.type);
|
|
47
|
+
else
|
|
48
|
+
hiddenSections.push(section.type);
|
|
49
|
+
}
|
|
50
|
+
return commits.filter(commit => {
|
|
51
|
+
const isBreaking = commit.notes.find(note => {
|
|
52
|
+
return note.title === BREAKING_CHANGE_NOTE;
|
|
53
|
+
});
|
|
54
|
+
return (visibleSections.includes(commit.type) ||
|
|
55
|
+
(isBreaking && hiddenSections.includes(commit.type)));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
exports.filterCommits = filterCommits;
|
|
59
|
+
//# sourceMappingURL=filter-commits.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2019 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.indentCommit = void 0;
|
|
17
|
+
function indentCommit(commit) {
|
|
18
|
+
const reduced = [];
|
|
19
|
+
let inList = false;
|
|
20
|
+
commit.message.split(/\r?\n/).forEach((line, i) => {
|
|
21
|
+
if (i !== 0)
|
|
22
|
+
line = ` ${line}`;
|
|
23
|
+
else
|
|
24
|
+
reduced.push(line);
|
|
25
|
+
if (/^\s*\*/.test(line)) {
|
|
26
|
+
inList = true;
|
|
27
|
+
reduced.push(line);
|
|
28
|
+
}
|
|
29
|
+
else if (/^ +[\w]/.test(line) && inList) {
|
|
30
|
+
reduced[reduced.length - 1] = `${reduced[reduced.length - 1]}\n${line}`;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
inList = false;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return reduced.join('\n');
|
|
37
|
+
}
|
|
38
|
+
exports.indentCommit = indentCommit;
|
|
39
|
+
//# sourceMappingURL=indent-commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function jsonStringify(parsed: object, content: string, replacer?: (string | number)[]): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
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.jsonStringify = void 0;
|
|
17
|
+
const detectIndent = require("detect-indent");
|
|
18
|
+
function jsonStringify(parsed, content, replacer) {
|
|
19
|
+
return `${content.slice(0, content.indexOf('{'))}${JSON.stringify(parsed, replacer, detectIndent(content.trim()).indent)}${content.slice(content.lastIndexOf('}') + 1)}`;
|
|
20
|
+
}
|
|
21
|
+
exports.jsonStringify = jsonStringify;
|
|
22
|
+
//# sourceMappingURL=json-stringify.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface LogFn {
|
|
2
|
+
<T extends object>(obj: T, msg?: string, ...args: any[]): void;
|
|
3
|
+
(msg: string, ...args: any[]): void;
|
|
4
|
+
}
|
|
5
|
+
export interface Logger {
|
|
6
|
+
error: LogFn;
|
|
7
|
+
warn: LogFn;
|
|
8
|
+
info: LogFn;
|
|
9
|
+
debug: LogFn;
|
|
10
|
+
trace: LogFn;
|
|
11
|
+
}
|
|
12
|
+
export declare class CheckpointLogger implements Logger {
|
|
13
|
+
private includeDebug;
|
|
14
|
+
private includeTrace;
|
|
15
|
+
constructor(includeDebug?: boolean, includeTrace?: boolean);
|
|
16
|
+
error: LogFn;
|
|
17
|
+
warn: LogFn;
|
|
18
|
+
info: LogFn;
|
|
19
|
+
debug: LogFn;
|
|
20
|
+
trace: LogFn;
|
|
21
|
+
}
|
|
22
|
+
export declare let logger: Logger;
|
|
23
|
+
export declare function setLogger(userLogger: Logger): void;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
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.setLogger = exports.logger = exports.CheckpointLogger = void 0;
|
|
17
|
+
const chalk = require("chalk");
|
|
18
|
+
const figures = require("figures");
|
|
19
|
+
const errorPrefix = chalk.red(figures.cross);
|
|
20
|
+
const warnPrefix = chalk.yellow(figures.warning);
|
|
21
|
+
const infoPrefix = chalk.green(figures.tick);
|
|
22
|
+
const debugPrefix = chalk.gray(figures.pointer);
|
|
23
|
+
const tracePrefix = chalk.dim.gray(figures.pointerSmall);
|
|
24
|
+
class CheckpointLogger {
|
|
25
|
+
constructor(includeDebug = false, includeTrace = false) {
|
|
26
|
+
this.error = (...args) => {
|
|
27
|
+
console.error(`${errorPrefix}`, ...args);
|
|
28
|
+
};
|
|
29
|
+
this.warn = (...args) => {
|
|
30
|
+
console.warn(`${warnPrefix}`, ...args);
|
|
31
|
+
};
|
|
32
|
+
this.info = (...args) => {
|
|
33
|
+
console.info(`${infoPrefix}`, ...args);
|
|
34
|
+
};
|
|
35
|
+
this.debug = (...args) => {
|
|
36
|
+
if (this.includeDebug)
|
|
37
|
+
console.debug(`${debugPrefix}`, ...args);
|
|
38
|
+
};
|
|
39
|
+
this.trace = (...args) => {
|
|
40
|
+
if (this.includeTrace)
|
|
41
|
+
console.debug(`${tracePrefix}`, ...args);
|
|
42
|
+
};
|
|
43
|
+
this.includeDebug = includeDebug;
|
|
44
|
+
this.includeTrace = includeTrace;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.CheckpointLogger = CheckpointLogger;
|
|
48
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
49
|
+
exports.logger = new CheckpointLogger(true);
|
|
50
|
+
function setLogger(userLogger) {
|
|
51
|
+
exports.logger = userLogger;
|
|
52
|
+
}
|
|
53
|
+
exports.setLogger = setLogger;
|
|
54
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Logger } from './logger';
|
|
2
|
+
import { Version } from '../version';
|
|
3
|
+
interface PullRequestBodyOptions {
|
|
4
|
+
header?: string;
|
|
5
|
+
footer?: string;
|
|
6
|
+
extra?: string;
|
|
7
|
+
useComponents?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class PullRequestBody {
|
|
10
|
+
header: string;
|
|
11
|
+
footer: string;
|
|
12
|
+
extra?: string;
|
|
13
|
+
releaseData: ReleaseData[];
|
|
14
|
+
useComponents: boolean;
|
|
15
|
+
constructor(releaseData: ReleaseData[], options?: PullRequestBodyOptions);
|
|
16
|
+
static parse(body: string, logger?: Logger): PullRequestBody | undefined;
|
|
17
|
+
notes(): string;
|
|
18
|
+
toString(): string;
|
|
19
|
+
}
|
|
20
|
+
export interface ReleaseData {
|
|
21
|
+
component?: string;
|
|
22
|
+
version?: Version;
|
|
23
|
+
notes: string;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,147 @@
|
|
|
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.PullRequestBody = void 0;
|
|
17
|
+
const logger_1 = require("./logger");
|
|
18
|
+
const node_html_parser_1 = require("node-html-parser");
|
|
19
|
+
const version_1 = require("../version");
|
|
20
|
+
const DEFAULT_HEADER = ':robot: I have created a release *beep* *boop*';
|
|
21
|
+
const DEFAULT_FOOTER = 'This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).';
|
|
22
|
+
const NOTES_DELIMITER = '---';
|
|
23
|
+
class PullRequestBody {
|
|
24
|
+
constructor(releaseData, options) {
|
|
25
|
+
var _a;
|
|
26
|
+
this.header = (options === null || options === void 0 ? void 0 : options.header) || DEFAULT_HEADER;
|
|
27
|
+
this.footer = (options === null || options === void 0 ? void 0 : options.footer) || DEFAULT_FOOTER;
|
|
28
|
+
this.extra = options === null || options === void 0 ? void 0 : options.extra;
|
|
29
|
+
this.releaseData = releaseData;
|
|
30
|
+
this.useComponents = (_a = options === null || options === void 0 ? void 0 : options.useComponents) !== null && _a !== void 0 ? _a : this.releaseData.length > 1;
|
|
31
|
+
}
|
|
32
|
+
static parse(body, logger = logger_1.logger) {
|
|
33
|
+
const parts = splitBody(body);
|
|
34
|
+
if (!parts) {
|
|
35
|
+
logger.error('Pull request body did not match');
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
let data = extractMultipleReleases(parts.content, logger);
|
|
39
|
+
let useComponents = true;
|
|
40
|
+
if (data.length === 0) {
|
|
41
|
+
data = extractSingleRelease(parts.content, logger);
|
|
42
|
+
useComponents = false;
|
|
43
|
+
if (data.length === 0) {
|
|
44
|
+
logger.warn('Failed to parse releases.');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return new PullRequestBody(data, {
|
|
48
|
+
header: parts.header,
|
|
49
|
+
footer: parts.footer,
|
|
50
|
+
useComponents,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
notes() {
|
|
54
|
+
if (this.useComponents) {
|
|
55
|
+
return this.releaseData
|
|
56
|
+
.map(release => {
|
|
57
|
+
var _a;
|
|
58
|
+
return `<details><summary>${release.component ? `${release.component}: ` : ''}${(_a = release.version) === null || _a === void 0 ? void 0 : _a.toString()}</summary>\n\n${release.notes}\n</details>`;
|
|
59
|
+
})
|
|
60
|
+
.join('\n\n');
|
|
61
|
+
}
|
|
62
|
+
return this.releaseData.map(release => release.notes).join('\n\n');
|
|
63
|
+
}
|
|
64
|
+
toString() {
|
|
65
|
+
const notes = this.notes();
|
|
66
|
+
return `${this.header}
|
|
67
|
+
${NOTES_DELIMITER}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
${notes}
|
|
71
|
+
|
|
72
|
+
${NOTES_DELIMITER}${this.extra ? `\n\n${this.extra}\n` : ''}
|
|
73
|
+
${this.footer}`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.PullRequestBody = PullRequestBody;
|
|
77
|
+
function splitBody(body) {
|
|
78
|
+
const lines = body.trim().replace(/\r\n/g, '\n').split('\n');
|
|
79
|
+
const index = lines.indexOf(NOTES_DELIMITER);
|
|
80
|
+
if (index === -1) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
let lastIndex = lines.lastIndexOf(NOTES_DELIMITER);
|
|
84
|
+
if (lastIndex === index) {
|
|
85
|
+
lastIndex = lines.length - 1;
|
|
86
|
+
}
|
|
87
|
+
const header = lines.slice(0, index).join('\n').trim();
|
|
88
|
+
const content = lines.slice(index + 1, lastIndex).join('\n');
|
|
89
|
+
const footer = lines.slice(lastIndex + 1).join('\n');
|
|
90
|
+
return {
|
|
91
|
+
header,
|
|
92
|
+
footer,
|
|
93
|
+
content,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
const SUMMARY_PATTERN = /^(?<component>.*[^:]):? (?<version>\d+\.\d+\.\d+.*)$/;
|
|
97
|
+
const COMPONENTLESS_SUMMARY_PATTERN = /^(?<version>\d+\.\d+\.\d+.*)$/;
|
|
98
|
+
function extractMultipleReleases(notes, logger) {
|
|
99
|
+
const data = [];
|
|
100
|
+
const root = (0, node_html_parser_1.parse)(notes);
|
|
101
|
+
for (const detail of root.getElementsByTagName('details')) {
|
|
102
|
+
const summaryNode = detail.getElementsByTagName('summary')[0];
|
|
103
|
+
const summary = summaryNode === null || summaryNode === void 0 ? void 0 : summaryNode.textContent;
|
|
104
|
+
const match = summary.match(SUMMARY_PATTERN);
|
|
105
|
+
if (match === null || match === void 0 ? void 0 : match.groups) {
|
|
106
|
+
detail.removeChild(summaryNode);
|
|
107
|
+
const notes = detail.textContent.trim();
|
|
108
|
+
data.push({
|
|
109
|
+
component: match.groups.component,
|
|
110
|
+
version: version_1.Version.parse(match.groups.version),
|
|
111
|
+
notes,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const componentlessMatch = summary.match(COMPONENTLESS_SUMMARY_PATTERN);
|
|
116
|
+
if (!(componentlessMatch === null || componentlessMatch === void 0 ? void 0 : componentlessMatch.groups)) {
|
|
117
|
+
logger.warn(`Summary: ${summary} did not match the expected pattern`);
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
detail.removeChild(summaryNode);
|
|
121
|
+
const notes = detail.textContent.trim();
|
|
122
|
+
data.push({
|
|
123
|
+
version: version_1.Version.parse(componentlessMatch.groups.version),
|
|
124
|
+
notes,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return data;
|
|
129
|
+
}
|
|
130
|
+
const COMPARE_REGEX = /^#{2,} \[?(?<version>\d+\.\d+\.\d+[^\]]*)\]?/;
|
|
131
|
+
function extractSingleRelease(body, logger) {
|
|
132
|
+
var _a;
|
|
133
|
+
body = body.trim();
|
|
134
|
+
const match = body.match(COMPARE_REGEX);
|
|
135
|
+
const versionString = (_a = match === null || match === void 0 ? void 0 : match.groups) === null || _a === void 0 ? void 0 : _a.version;
|
|
136
|
+
if (!versionString) {
|
|
137
|
+
logger.warn('Failed to find version in release notes');
|
|
138
|
+
return [];
|
|
139
|
+
}
|
|
140
|
+
return [
|
|
141
|
+
{
|
|
142
|
+
version: version_1.Version.parse(versionString),
|
|
143
|
+
notes: body,
|
|
144
|
+
},
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=pull-request-body.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { PullRequestBody } from './pull-request-body';
|
|
2
|
+
import { Scm } from '../scm';
|
|
3
|
+
import { PullRequest } from '../pull-request';
|
|
4
|
+
import { Logger } from './logger';
|
|
5
|
+
import { ReleasePullRequest } from '../release-pull-request';
|
|
6
|
+
/**
|
|
7
|
+
* Interface for managing the pull request body contents when the content
|
|
8
|
+
* is too large to fit into a pull request.
|
|
9
|
+
*/
|
|
10
|
+
export interface PullRequestOverflowHandler {
|
|
11
|
+
/**
|
|
12
|
+
* If a pull request's body is too big, store it somewhere and return
|
|
13
|
+
* a new pull request body with information about the new location.
|
|
14
|
+
* @param {ReleasePullRequest} pullRequest The candidate release pull request
|
|
15
|
+
* @returns {string} The new pull request body which may contain a link to
|
|
16
|
+
* the full content.
|
|
17
|
+
*/
|
|
18
|
+
handleOverflow(pullRequest: ReleasePullRequest, maxSize?: number): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Given a pull request, parse the pull request body from the pull request
|
|
21
|
+
* or storage if the body was too big to store in the pull request body.
|
|
22
|
+
* @param {PullRequest} pullRequest The pull request from GitHub
|
|
23
|
+
* @return {PullRequestBody} The parsed pull request body
|
|
24
|
+
*/
|
|
25
|
+
parseOverflow(pullRequest: PullRequest): Promise<PullRequestBody | undefined>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* This implementation of PullRequestOverflowHandler stores the full release
|
|
29
|
+
* notes on a new git branch. The branch name is derived from the head branch
|
|
30
|
+
* name of the release pull request.
|
|
31
|
+
*/
|
|
32
|
+
export declare class FilePullRequestOverflowHandler implements PullRequestOverflowHandler {
|
|
33
|
+
private github;
|
|
34
|
+
private logger;
|
|
35
|
+
constructor(github: Scm, logger?: Logger);
|
|
36
|
+
/**
|
|
37
|
+
* Optionally store the full release notes into `release-notes.md` file
|
|
38
|
+
* on a new branch if they do not fit into the body of a pull request.
|
|
39
|
+
*
|
|
40
|
+
* The new release notes will have a link to the GitHub UI for that file
|
|
41
|
+
* which should render the release notes nicely.
|
|
42
|
+
* @param {ReleasePullRequest} pullRequest The candidate release pull request
|
|
43
|
+
* @returns {string} The new pull request body which contains a link to
|
|
44
|
+
* the full content.
|
|
45
|
+
*/
|
|
46
|
+
handleOverflow(pullRequest: ReleasePullRequest, maxSize?: number): Promise<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Given a pull request, retrieve the full release notes from the stored
|
|
49
|
+
* file if the body was too big to store in the pull request body.
|
|
50
|
+
* @param {PullRequest} pullRequest The pull request from GitHub
|
|
51
|
+
* @return {PullRequestBody} The parsed pull request body
|
|
52
|
+
*/
|
|
53
|
+
parseOverflow(pullRequest: PullRequest): Promise<PullRequestBody | undefined>;
|
|
54
|
+
}
|