@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,18 @@
|
|
|
1
|
+
import { Scm } from './scm';
|
|
2
|
+
import { ReleaserConfig } from './manifest';
|
|
3
|
+
import { PullRequest } from './pull-request';
|
|
4
|
+
import { Update } from './update';
|
|
5
|
+
interface BootstrapPullRequest extends PullRequest {
|
|
6
|
+
updates: Update[];
|
|
7
|
+
}
|
|
8
|
+
export declare class Bootstrapper {
|
|
9
|
+
private github;
|
|
10
|
+
private targetBranch;
|
|
11
|
+
private manifestFile;
|
|
12
|
+
private configFile;
|
|
13
|
+
private initialVersion;
|
|
14
|
+
constructor(github: Scm, targetBranch: string, manifestFile?: string, configFile?: string, initialVersionString?: string);
|
|
15
|
+
bootstrap(path: string, config: ReleaserConfig): Promise<PullRequest>;
|
|
16
|
+
buildPullRequest(path: string, config: ReleaserConfig): Promise<BootstrapPullRequest>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
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 pullRequest = await this.buildPullRequest(path, config);
|
|
31
|
+
return await this.github.createPullRequest(pullRequest, this.targetBranch, pullRequest.title, pullRequest.updates, {});
|
|
32
|
+
}
|
|
33
|
+
async buildPullRequest(path, config) {
|
|
34
|
+
const message = `chore: bootstrap releases for path: ${path}`;
|
|
35
|
+
const branchName = path === manifest_1.ROOT_PROJECT_PATH ? 'default' : path;
|
|
36
|
+
const version = this.initialVersion;
|
|
37
|
+
const versionsMap = new Map();
|
|
38
|
+
versionsMap.set(path, version);
|
|
39
|
+
const updates = [
|
|
40
|
+
{
|
|
41
|
+
path: this.manifestFile,
|
|
42
|
+
createIfMissing: true,
|
|
43
|
+
updater: new release_please_manifest_1.ReleasePleaseManifest({ version, versionsMap }),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
path: this.configFile,
|
|
47
|
+
createIfMissing: true,
|
|
48
|
+
updater: new release_please_config_1.ReleasePleaseConfig(path, config),
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
return {
|
|
52
|
+
title: message,
|
|
53
|
+
body: `Configuring release-please for path: ${path}`,
|
|
54
|
+
baseBranchName: this.targetBranch,
|
|
55
|
+
headBranchName: `release-please/bootstrap/${branchName}`,
|
|
56
|
+
updates,
|
|
57
|
+
number: -1,
|
|
58
|
+
labels: [],
|
|
59
|
+
files: [],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.Bootstrapper = Bootstrapper;
|
|
64
|
+
//# 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,96 @@
|
|
|
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
|
+
var _a;
|
|
30
|
+
const context = {
|
|
31
|
+
host: options.host || DEFAULT_HOST,
|
|
32
|
+
owner: options.owner,
|
|
33
|
+
repository: options.repository,
|
|
34
|
+
version: options.version,
|
|
35
|
+
previousTag: options.previousTag,
|
|
36
|
+
currentTag: options.currentTag,
|
|
37
|
+
linkCompare: !!options.previousTag,
|
|
38
|
+
};
|
|
39
|
+
const config = {};
|
|
40
|
+
if (options.changelogSections) {
|
|
41
|
+
config.types = options.changelogSections;
|
|
42
|
+
}
|
|
43
|
+
const preset = await presetFactory(config);
|
|
44
|
+
// Replace the default ", closes" keyword with ", refs" to prevent GitHub from
|
|
45
|
+
// automatically closing referenced issues when the release PR is merged.
|
|
46
|
+
preset.writerOpts.commitPartial =
|
|
47
|
+
this.commitPartial ||
|
|
48
|
+
((_a = preset.writerOpts.commitPartial) === null || _a === void 0 ? void 0 : _a.replace(/,\s*closes/g, ', refs'));
|
|
49
|
+
preset.writerOpts.headerPartial =
|
|
50
|
+
this.headerPartial || preset.writerOpts.headerPartial;
|
|
51
|
+
preset.writerOpts.mainTemplate =
|
|
52
|
+
this.mainTemplate || preset.writerOpts.mainTemplate;
|
|
53
|
+
const changelogCommits = commits.map(commit => {
|
|
54
|
+
const notes = commit.notes
|
|
55
|
+
.filter(note => note.title === 'BREAKING CHANGE')
|
|
56
|
+
.map(note => replaceIssueLink(note, context.host, context.owner, context.repository));
|
|
57
|
+
let subject = htmlEscape(commit.bareMessage);
|
|
58
|
+
// Append author info if enabled and author is available
|
|
59
|
+
if (options.includeCommitAuthors && commit.author) {
|
|
60
|
+
const authorDisplay = commit.author.username
|
|
61
|
+
? `@${commit.author.username}`
|
|
62
|
+
: commit.author.name;
|
|
63
|
+
subject = `${subject} (${authorDisplay})`;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
body: '',
|
|
67
|
+
subject,
|
|
68
|
+
type: commit.type,
|
|
69
|
+
scope: commit.scope,
|
|
70
|
+
notes,
|
|
71
|
+
references: commit.references,
|
|
72
|
+
mentions: [],
|
|
73
|
+
merge: null,
|
|
74
|
+
revert: null,
|
|
75
|
+
header: commit.message,
|
|
76
|
+
footer: commit.notes
|
|
77
|
+
.filter(note => note.title === 'RELEASE AS')
|
|
78
|
+
.map(note => `Release-As: ${note.text}`)
|
|
79
|
+
.join('\n'),
|
|
80
|
+
hash: commit.sha,
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
return conventionalChangelogWriter
|
|
84
|
+
.parseArray(changelogCommits, context, preset.writerOpts)
|
|
85
|
+
.trim();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.DefaultChangelogNotes = DefaultChangelogNotes;
|
|
89
|
+
function replaceIssueLink(note, host, owner, repo) {
|
|
90
|
+
note.text = note.text.replace(/\(#(\d+)\)/, `([#$1](${host}/${owner}/${repo}/issues/$1))`);
|
|
91
|
+
return note;
|
|
92
|
+
}
|
|
93
|
+
function htmlEscape(message) {
|
|
94
|
+
return message.replace(/``[^`].*[^`]``|`[^`]*`|<|>/g, match => match.length > 1 ? match : match === '<' ? '<' : '>');
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=default.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChangelogNotes, BuildNotesOptions } from '../changelog-notes';
|
|
2
|
+
import { ConventionalCommit } from '../commit';
|
|
3
|
+
import { Scm } from '../scm';
|
|
4
|
+
export declare class GitHubChangelogNotes implements ChangelogNotes {
|
|
5
|
+
private github;
|
|
6
|
+
constructor(github: Scm);
|
|
7
|
+
buildNotes(_commits: ConventionalCommit[], options: BuildNotesOptions): Promise<string>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
const body = await this.github.generateReleaseNotes(options.currentTag, options.targetBranch, options.previousTag);
|
|
23
|
+
const date = new Date().toLocaleDateString('en-CA');
|
|
24
|
+
const header = `## ${options.version} (${date})`;
|
|
25
|
+
return `${header}\n\n${body}`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.GitHubChangelogNotes = GitHubChangelogNotes;
|
|
29
|
+
//# sourceMappingURL=github.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Commit, 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
|
+
commits?: Commit[];
|
|
12
|
+
includeCommitAuthors?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ChangelogNotes {
|
|
15
|
+
buildNotes(commits: ConventionalCommit[], options: BuildNotesOptions): Promise<string>;
|
|
16
|
+
}
|
|
17
|
+
export interface ChangelogSection {
|
|
18
|
+
type: string;
|
|
19
|
+
section: string;
|
|
20
|
+
hidden?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function buildChangelogSections(scopes: string[]): ChangelogSection[];
|
|
@@ -0,0 +1,40 @@
|
|
|
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.buildChangelogSections = void 0;
|
|
17
|
+
const DEFAULT_HEADINGS = {
|
|
18
|
+
feat: 'Features',
|
|
19
|
+
fix: 'Bug Fixes',
|
|
20
|
+
perf: 'Performance Improvements',
|
|
21
|
+
deps: 'Dependencies',
|
|
22
|
+
revert: 'Reverts',
|
|
23
|
+
docs: 'Documentation',
|
|
24
|
+
style: 'Styles',
|
|
25
|
+
chore: 'Miscellaneous Chores',
|
|
26
|
+
refactor: 'Code Refactoring',
|
|
27
|
+
test: 'Tests',
|
|
28
|
+
build: 'Build System',
|
|
29
|
+
ci: 'Continuous Integration',
|
|
30
|
+
};
|
|
31
|
+
function buildChangelogSections(scopes) {
|
|
32
|
+
return scopes.map(scope => {
|
|
33
|
+
return {
|
|
34
|
+
type: scope,
|
|
35
|
+
section: DEFAULT_HEADINGS[scope] || scope,
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
exports.buildChangelogSections = buildChangelogSections;
|
|
40
|
+
//# sourceMappingURL=changelog-notes.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PullRequest } from './pull-request';
|
|
2
|
+
import { Logger } from './util/logger';
|
|
3
|
+
import * as parser from '@conventional-commits/parser';
|
|
4
|
+
export interface CommitAuthor {
|
|
5
|
+
name: string;
|
|
6
|
+
email?: string;
|
|
7
|
+
username?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Commit {
|
|
10
|
+
sha: string;
|
|
11
|
+
message: string;
|
|
12
|
+
files?: string[];
|
|
13
|
+
pullRequest?: PullRequest;
|
|
14
|
+
author?: CommitAuthor;
|
|
15
|
+
}
|
|
16
|
+
export interface ConventionalCommit extends Commit {
|
|
17
|
+
type: string;
|
|
18
|
+
scope: string | null;
|
|
19
|
+
notes: parser.Note[];
|
|
20
|
+
references: parser.Reference[];
|
|
21
|
+
bareMessage: string;
|
|
22
|
+
breaking: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Given a list of raw commits, parse and expand into conventional commits.
|
|
26
|
+
*
|
|
27
|
+
* @param commits {Commit[]} The input commits
|
|
28
|
+
*
|
|
29
|
+
* @returns {ConventionalCommit[]} Parsed and expanded commits. There may be
|
|
30
|
+
* more commits returned as a single raw commit may contain multiple release
|
|
31
|
+
* messages.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseConventionalCommits(commits: Commit[], logger?: Logger): ConventionalCommit[];
|