@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,727 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
// Copyright 2019 Google LLC
|
|
4
|
+
//
|
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
// you may not use this file except in compliance with the License.
|
|
7
|
+
// You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
// See the License for the specific language governing permissions and
|
|
15
|
+
// limitations under the License.
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.handleError = exports.parser = void 0;
|
|
18
|
+
const coerce_option_1 = require("../util/coerce-option");
|
|
19
|
+
const yargs = require("yargs");
|
|
20
|
+
const github_1 = require("../github");
|
|
21
|
+
const github_api_1 = require("../github-api");
|
|
22
|
+
const manifest_1 = require("../manifest");
|
|
23
|
+
const changelog_notes_1 = require("../changelog-notes");
|
|
24
|
+
const logger_1 = require("../util/logger");
|
|
25
|
+
const factory_1 = require("../factory");
|
|
26
|
+
const bootstrapper_1 = require("../bootstrapper");
|
|
27
|
+
const diff_1 = require("diff");
|
|
28
|
+
const local_github_1 = require("../local-github");
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
30
|
+
const parseGithubRepoUrl = require('parse-github-repo-url');
|
|
31
|
+
function gitHubOptions(yargs) {
|
|
32
|
+
return yargs
|
|
33
|
+
.option('token', { describe: 'GitHub token with repo write permissions' })
|
|
34
|
+
.option('api-url', {
|
|
35
|
+
describe: 'URL to use when making API requests',
|
|
36
|
+
default: github_api_1.GH_API_URL,
|
|
37
|
+
type: 'string',
|
|
38
|
+
})
|
|
39
|
+
.option('graphql-url', {
|
|
40
|
+
describe: 'URL to use when making GraphQL requests',
|
|
41
|
+
default: github_api_1.GH_GRAPHQL_URL,
|
|
42
|
+
type: 'string',
|
|
43
|
+
})
|
|
44
|
+
.option('default-branch', {
|
|
45
|
+
describe: 'The branch to open release PRs against and tag releases on',
|
|
46
|
+
type: 'string',
|
|
47
|
+
deprecated: 'use --target-branch instead',
|
|
48
|
+
})
|
|
49
|
+
.option('target-branch', {
|
|
50
|
+
describe: 'The branch to open release PRs against and tag releases on',
|
|
51
|
+
type: 'string',
|
|
52
|
+
})
|
|
53
|
+
.option('repo-url', {
|
|
54
|
+
describe: 'GitHub URL to generate release for',
|
|
55
|
+
demand: true,
|
|
56
|
+
})
|
|
57
|
+
.option('dry-run', {
|
|
58
|
+
describe: 'Prepare but do not take action',
|
|
59
|
+
type: 'boolean',
|
|
60
|
+
default: false,
|
|
61
|
+
})
|
|
62
|
+
.option('local', {
|
|
63
|
+
describe: 'Whether to use local clone',
|
|
64
|
+
type: 'boolean',
|
|
65
|
+
default: false,
|
|
66
|
+
})
|
|
67
|
+
.option('local-path', {
|
|
68
|
+
describe: 'Path to local clone directory. If not set, uses a temporary directory.',
|
|
69
|
+
type: 'string',
|
|
70
|
+
})
|
|
71
|
+
.option('local-clone-depth', {
|
|
72
|
+
describe: 'Depth of local clone. Defaults to the entire repo.',
|
|
73
|
+
type: 'number',
|
|
74
|
+
})
|
|
75
|
+
.middleware(_argv => {
|
|
76
|
+
const argv = _argv;
|
|
77
|
+
// allow secrets to be loaded from file path
|
|
78
|
+
// rather than being passed directly to the bin.
|
|
79
|
+
if (argv.token)
|
|
80
|
+
argv.token = (0, coerce_option_1.coerceOption)(argv.token);
|
|
81
|
+
if (argv.apiUrl)
|
|
82
|
+
argv.apiUrl = (0, coerce_option_1.coerceOption)(argv.apiUrl);
|
|
83
|
+
if (argv.graphqlUrl)
|
|
84
|
+
argv.graphqlUrl = (0, coerce_option_1.coerceOption)(argv.graphqlUrl);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function releaseOptions(yargs) {
|
|
88
|
+
return yargs
|
|
89
|
+
.option('draft', {
|
|
90
|
+
describe: 'mark release as a draft. no tag is created but tag_name and ' +
|
|
91
|
+
'target_commitish are associated with the release for future ' +
|
|
92
|
+
'tag creation upon "un-drafting" the release.',
|
|
93
|
+
type: 'boolean',
|
|
94
|
+
default: false,
|
|
95
|
+
})
|
|
96
|
+
.option('force-tag-creation', {
|
|
97
|
+
describe: 'Force the creation of a Git tag for the release.',
|
|
98
|
+
type: 'boolean',
|
|
99
|
+
default: false,
|
|
100
|
+
})
|
|
101
|
+
.option('prerelease', {
|
|
102
|
+
describe: 'mark release that have prerelease versions ' +
|
|
103
|
+
'as as a prerelease on Github',
|
|
104
|
+
type: 'boolean',
|
|
105
|
+
default: false,
|
|
106
|
+
})
|
|
107
|
+
.option('label', {
|
|
108
|
+
default: 'autorelease: pending',
|
|
109
|
+
describe: 'comma-separated list of labels to remove to from release PR',
|
|
110
|
+
})
|
|
111
|
+
.option('release-label', {
|
|
112
|
+
describe: 'set a pull request label other than "autorelease: tagged"',
|
|
113
|
+
default: 'autorelease: tagged',
|
|
114
|
+
type: 'string',
|
|
115
|
+
})
|
|
116
|
+
.option('snapshot-label', {
|
|
117
|
+
describe: 'set a java snapshot pull request label other than "autorelease: snapshot"',
|
|
118
|
+
default: 'autorelease: snapshot',
|
|
119
|
+
type: 'string',
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function pullRequestOptions(yargs) {
|
|
123
|
+
// common to ReleasePR and GitHubRelease
|
|
124
|
+
return yargs
|
|
125
|
+
.option('label', {
|
|
126
|
+
default: 'autorelease: pending',
|
|
127
|
+
describe: 'comma-separated list of labels to add to from release PR',
|
|
128
|
+
})
|
|
129
|
+
.option('skip-labeling', {
|
|
130
|
+
describe: 'skip application of labels to pull requests',
|
|
131
|
+
type: 'boolean',
|
|
132
|
+
default: false,
|
|
133
|
+
})
|
|
134
|
+
.option('fork', {
|
|
135
|
+
describe: 'should the PR be created from a fork',
|
|
136
|
+
type: 'boolean',
|
|
137
|
+
default: false,
|
|
138
|
+
})
|
|
139
|
+
.option('draft-pull-request', {
|
|
140
|
+
describe: 'mark pull request as a draft',
|
|
141
|
+
type: 'boolean',
|
|
142
|
+
default: false,
|
|
143
|
+
})
|
|
144
|
+
.option('signoff', {
|
|
145
|
+
describe: 'Add Signed-off-by line at the end of the commit log message using the user and email provided. (format "Name <email@example.com>").',
|
|
146
|
+
type: 'string',
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function pullRequestStrategyOptions(yargs) {
|
|
150
|
+
return yargs
|
|
151
|
+
.option('release-as', {
|
|
152
|
+
describe: 'override the semantically determined release version',
|
|
153
|
+
type: 'string',
|
|
154
|
+
})
|
|
155
|
+
.option('bump-minor-pre-major', {
|
|
156
|
+
describe: 'should we bump the semver minor prior to the first major release',
|
|
157
|
+
default: false,
|
|
158
|
+
type: 'boolean',
|
|
159
|
+
})
|
|
160
|
+
.option('bump-patch-for-minor-pre-major', {
|
|
161
|
+
describe: 'should we bump the semver patch instead of the minor for non-breaking' +
|
|
162
|
+
' changes prior to the first major release',
|
|
163
|
+
default: false,
|
|
164
|
+
type: 'boolean',
|
|
165
|
+
})
|
|
166
|
+
.option('prerelease-type', {
|
|
167
|
+
describe: 'type of the prerelease, e.g., alpha',
|
|
168
|
+
type: 'string',
|
|
169
|
+
})
|
|
170
|
+
.option('extra-files', {
|
|
171
|
+
describe: 'extra files for the strategy to consider',
|
|
172
|
+
type: 'string',
|
|
173
|
+
coerce(arg) {
|
|
174
|
+
if (arg) {
|
|
175
|
+
return arg.split(',');
|
|
176
|
+
}
|
|
177
|
+
return arg;
|
|
178
|
+
},
|
|
179
|
+
})
|
|
180
|
+
.option('version-file', {
|
|
181
|
+
describe: 'path to version file to update, e.g., version.rb',
|
|
182
|
+
type: 'string',
|
|
183
|
+
})
|
|
184
|
+
.option('snapshot', {
|
|
185
|
+
describe: 'is it a snapshot (or pre-release) being generated?',
|
|
186
|
+
type: 'boolean',
|
|
187
|
+
default: false,
|
|
188
|
+
})
|
|
189
|
+
.option('versioning-strategy', {
|
|
190
|
+
describe: 'strategy used for bumping versions',
|
|
191
|
+
choices: (0, factory_1.getVersioningStrategyTypes)(),
|
|
192
|
+
default: 'default',
|
|
193
|
+
})
|
|
194
|
+
.option('changelog-path', {
|
|
195
|
+
default: 'CHANGELOG.md',
|
|
196
|
+
describe: 'where can the CHANGELOG be found in the project?',
|
|
197
|
+
type: 'string',
|
|
198
|
+
})
|
|
199
|
+
.option('changelog-type', {
|
|
200
|
+
describe: 'type of changelog to build',
|
|
201
|
+
choices: (0, factory_1.getChangelogTypes)(),
|
|
202
|
+
})
|
|
203
|
+
.option('changelog-sections', {
|
|
204
|
+
describe: 'comma-separated list of scopes to include in the changelog',
|
|
205
|
+
type: 'string',
|
|
206
|
+
coerce: (arg) => {
|
|
207
|
+
if (arg) {
|
|
208
|
+
return (0, changelog_notes_1.buildChangelogSections)(arg.split(','));
|
|
209
|
+
}
|
|
210
|
+
return arg;
|
|
211
|
+
},
|
|
212
|
+
})
|
|
213
|
+
.option('changelog-host', {
|
|
214
|
+
describe: 'host for hyperlinks in the changelog',
|
|
215
|
+
type: 'string',
|
|
216
|
+
})
|
|
217
|
+
.option('last-package-version', {
|
|
218
|
+
describe: 'last version # that package was released as',
|
|
219
|
+
type: 'string',
|
|
220
|
+
deprecated: 'use --latest-tag-version instead',
|
|
221
|
+
})
|
|
222
|
+
.option('latest-tag-version', {
|
|
223
|
+
describe: 'Override the detected latest tag version',
|
|
224
|
+
type: 'string',
|
|
225
|
+
})
|
|
226
|
+
.option('latest-tag-sha', {
|
|
227
|
+
describe: 'Override the detected latest tag SHA',
|
|
228
|
+
type: 'string',
|
|
229
|
+
})
|
|
230
|
+
.option('latest-tag-name', {
|
|
231
|
+
describe: 'Override the detected latest tag name',
|
|
232
|
+
type: 'string',
|
|
233
|
+
})
|
|
234
|
+
.option('date-format', {
|
|
235
|
+
describe: 'format in strftime format for updating dates',
|
|
236
|
+
type: 'string',
|
|
237
|
+
})
|
|
238
|
+
.middleware(_argv => {
|
|
239
|
+
const argv = _argv;
|
|
240
|
+
if (argv.defaultBranch) {
|
|
241
|
+
logger_1.logger.warn('--default-branch is deprecated. Please use --target-branch instead.');
|
|
242
|
+
argv.targetBranch = argv.targetBranch || argv.defaultBranch;
|
|
243
|
+
}
|
|
244
|
+
if (argv.lastPackageVersion) {
|
|
245
|
+
logger_1.logger.warn('--latest-package-version is deprecated. Please use --latest-tag-version instead.');
|
|
246
|
+
argv.latestTagVersion =
|
|
247
|
+
argv.latestTagVersion || argv.lastPackageVersion;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function manifestConfigOptions(yargs, defaultType) {
|
|
252
|
+
return yargs
|
|
253
|
+
.option('path', {
|
|
254
|
+
describe: 'release from path other than root directory',
|
|
255
|
+
type: 'string',
|
|
256
|
+
})
|
|
257
|
+
.option('component', {
|
|
258
|
+
describe: 'name of component release is being minted for',
|
|
259
|
+
type: 'string',
|
|
260
|
+
})
|
|
261
|
+
.option('package-name', {
|
|
262
|
+
describe: 'name of package release is being minted for',
|
|
263
|
+
type: 'string',
|
|
264
|
+
})
|
|
265
|
+
.option('release-type', {
|
|
266
|
+
describe: 'what type of repo is a release being created for?',
|
|
267
|
+
choices: (0, factory_1.getReleaserTypes)(),
|
|
268
|
+
default: defaultType,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function manifestOptions(yargs) {
|
|
272
|
+
return yargs
|
|
273
|
+
.option('config-file', {
|
|
274
|
+
default: 'release-please-config.json',
|
|
275
|
+
describe: 'where can the config file be found in the project?',
|
|
276
|
+
})
|
|
277
|
+
.option('manifest-file', {
|
|
278
|
+
default: '.release-please-manifest.json',
|
|
279
|
+
describe: 'where can the manifest file be found in the project?',
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
function taggingOptions(yargs) {
|
|
283
|
+
return yargs
|
|
284
|
+
.option('include-v-in-tags', {
|
|
285
|
+
describe: 'include "v" in tag versions',
|
|
286
|
+
type: 'boolean',
|
|
287
|
+
default: true,
|
|
288
|
+
})
|
|
289
|
+
.option('monorepo-tags', {
|
|
290
|
+
describe: 'include library name in tags and release branches',
|
|
291
|
+
type: 'boolean',
|
|
292
|
+
default: false,
|
|
293
|
+
})
|
|
294
|
+
.option('pull-request-title-pattern', {
|
|
295
|
+
describe: 'Title pattern to make release PR',
|
|
296
|
+
type: 'string',
|
|
297
|
+
})
|
|
298
|
+
.option('pull-request-header', {
|
|
299
|
+
describe: 'Header for release PR',
|
|
300
|
+
type: 'string',
|
|
301
|
+
})
|
|
302
|
+
.option('pull-request-footer', {
|
|
303
|
+
describe: 'Footer for release PR',
|
|
304
|
+
type: 'string',
|
|
305
|
+
})
|
|
306
|
+
.option('component-no-space', {
|
|
307
|
+
describe: 'release-please automatically adds ` ` (space) in front of parsed ${component}. Should this be disabled?',
|
|
308
|
+
type: 'boolean',
|
|
309
|
+
default: false,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
const createReleasePullRequestCommand = {
|
|
313
|
+
command: 'release-pr',
|
|
314
|
+
describe: 'create or update a PR representing the next release',
|
|
315
|
+
builder(yargs) {
|
|
316
|
+
return manifestOptions(manifestConfigOptions(taggingOptions(pullRequestOptions(pullRequestStrategyOptions(gitHubOptions(yargs))))));
|
|
317
|
+
},
|
|
318
|
+
async handler(argv) {
|
|
319
|
+
const github = await buildGitHub(argv);
|
|
320
|
+
const targetBranch = argv.targetBranch || github.repository.defaultBranch;
|
|
321
|
+
let manifest;
|
|
322
|
+
if (argv.releaseType) {
|
|
323
|
+
manifest = await manifest_1.Manifest.fromConfig(github, targetBranch, {
|
|
324
|
+
releaseType: argv.releaseType,
|
|
325
|
+
component: argv.component,
|
|
326
|
+
packageName: argv.packageName,
|
|
327
|
+
draftPullRequest: argv.draftPullRequest,
|
|
328
|
+
bumpMinorPreMajor: argv.bumpMinorPreMajor,
|
|
329
|
+
bumpPatchForMinorPreMajor: argv.bumpPatchForMinorPreMajor,
|
|
330
|
+
prereleaseType: argv.prereleaseType,
|
|
331
|
+
changelogPath: argv.changelogPath,
|
|
332
|
+
changelogType: argv.changelogType,
|
|
333
|
+
changelogHost: argv.changelogHost,
|
|
334
|
+
pullRequestTitlePattern: argv.pullRequestTitlePattern,
|
|
335
|
+
pullRequestHeader: argv.pullRequestHeader,
|
|
336
|
+
pullRequestFooter: argv.pullRequestFooter,
|
|
337
|
+
componentNoSpace: argv.componentNoSpace,
|
|
338
|
+
changelogSections: argv.changelogSections,
|
|
339
|
+
releaseAs: argv.releaseAs,
|
|
340
|
+
versioning: argv.versioningStrategy,
|
|
341
|
+
extraFiles: argv.extraFiles,
|
|
342
|
+
versionFile: argv.versionFile,
|
|
343
|
+
includeComponentInTag: argv.monorepoTags,
|
|
344
|
+
includeVInTag: argv.includeVInTags,
|
|
345
|
+
}, extractManifestOptions(argv), argv.path);
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
const manifestOptions = extractManifestOptions(argv);
|
|
349
|
+
manifest = await manifest_1.Manifest.fromManifest(github, targetBranch, argv.configFile, argv.manifestFile, manifestOptions, argv.path, argv.releaseAs);
|
|
350
|
+
}
|
|
351
|
+
if (argv.dryRun) {
|
|
352
|
+
const pullRequests = await manifest.buildPullRequests();
|
|
353
|
+
console.log(`Would open ${pullRequests.length} pull requests`);
|
|
354
|
+
console.log('fork:', manifest.fork);
|
|
355
|
+
for (const pullRequest of pullRequests) {
|
|
356
|
+
console.log('title:', pullRequest.title.toString());
|
|
357
|
+
console.log('branch:', pullRequest.headRefName);
|
|
358
|
+
console.log('draft:', pullRequest.draft);
|
|
359
|
+
console.log('body:', pullRequest.body.toString());
|
|
360
|
+
console.log('updates:', pullRequest.updates.length);
|
|
361
|
+
const changes = await github.buildChangeSet(pullRequest.updates, targetBranch);
|
|
362
|
+
for (const update of pullRequest.updates) {
|
|
363
|
+
console.log(` ${update.path}: `,
|
|
364
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
365
|
+
update.updater.constructor);
|
|
366
|
+
if (argv.trace) {
|
|
367
|
+
const change = changes.get(update.path);
|
|
368
|
+
if (change) {
|
|
369
|
+
const patch = (0, diff_1.createPatch)(update.path, change.originalContent || '', change.content || '');
|
|
370
|
+
console.log(patch);
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
console.warn(`no change found for ${update.path}`);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
const pullRequestNumbers = await manifest.createPullRequests();
|
|
381
|
+
console.log(pullRequestNumbers);
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
};
|
|
385
|
+
const createReleaseCommand = {
|
|
386
|
+
command: 'github-release',
|
|
387
|
+
describe: 'create a GitHub release from a release PR',
|
|
388
|
+
builder(yargs) {
|
|
389
|
+
return releaseOptions(manifestOptions(manifestConfigOptions(taggingOptions(gitHubOptions(yargs)))));
|
|
390
|
+
},
|
|
391
|
+
async handler(argv) {
|
|
392
|
+
const github = await buildGitHub(argv);
|
|
393
|
+
const targetBranch = argv.targetBranch ||
|
|
394
|
+
argv.defaultBranch ||
|
|
395
|
+
github.repository.defaultBranch;
|
|
396
|
+
let manifest;
|
|
397
|
+
if (argv.releaseType) {
|
|
398
|
+
manifest = await manifest_1.Manifest.fromConfig(github, targetBranch, {
|
|
399
|
+
releaseType: argv.releaseType,
|
|
400
|
+
component: argv.component,
|
|
401
|
+
packageName: argv.packageName,
|
|
402
|
+
draft: argv.draft,
|
|
403
|
+
forceTag: argv.forceTag,
|
|
404
|
+
prerelease: argv.prerelease,
|
|
405
|
+
includeComponentInTag: argv.monorepoTags,
|
|
406
|
+
includeVInTag: argv.includeVInTags,
|
|
407
|
+
}, extractManifestOptions(argv), argv.path);
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
const manifestOptions = extractManifestOptions(argv);
|
|
411
|
+
manifest = await manifest_1.Manifest.fromManifest(github, targetBranch, argv.configFile, argv.manifestFile, manifestOptions);
|
|
412
|
+
}
|
|
413
|
+
if (argv.dryRun) {
|
|
414
|
+
const releases = await manifest.buildReleases();
|
|
415
|
+
logger_1.logger.info(`Would tag ${releases.length} releases:`);
|
|
416
|
+
for (const release of releases) {
|
|
417
|
+
logger_1.logger.info({
|
|
418
|
+
name: release.name,
|
|
419
|
+
tag: release.tag.toString(),
|
|
420
|
+
notes: release.notes,
|
|
421
|
+
sha: release.sha,
|
|
422
|
+
draft: release.draft,
|
|
423
|
+
prerelease: release.prerelease,
|
|
424
|
+
pullNumber: release.pullRequest.number,
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
const releaseNumbers = await manifest.createReleases();
|
|
430
|
+
console.log(releaseNumbers);
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
};
|
|
434
|
+
const createManifestPullRequestCommand = {
|
|
435
|
+
command: 'manifest-pr',
|
|
436
|
+
describe: 'create a release-PR using a manifest file',
|
|
437
|
+
deprecated: 'use release-pr instead.',
|
|
438
|
+
builder(yargs) {
|
|
439
|
+
return manifestOptions(pullRequestOptions(gitHubOptions(yargs)));
|
|
440
|
+
},
|
|
441
|
+
async handler(argv) {
|
|
442
|
+
logger_1.logger.warn('manifest-pr is deprecated. Please use release-pr instead.');
|
|
443
|
+
const github = await buildGitHub(argv);
|
|
444
|
+
const targetBranch = argv.targetBranch ||
|
|
445
|
+
argv.defaultBranch ||
|
|
446
|
+
github.repository.defaultBranch;
|
|
447
|
+
const manifestOptions = extractManifestOptions(argv);
|
|
448
|
+
const manifest = await manifest_1.Manifest.fromManifest(github, targetBranch, argv.configFile, argv.manifestFile, manifestOptions);
|
|
449
|
+
if (argv.dryRun) {
|
|
450
|
+
const pullRequests = await manifest.buildPullRequests();
|
|
451
|
+
console.log(`Would open ${pullRequests.length} pull requests`);
|
|
452
|
+
console.log('fork:', manifest.fork);
|
|
453
|
+
for (const pullRequest of pullRequests) {
|
|
454
|
+
console.log('title:', pullRequest.title.toString());
|
|
455
|
+
console.log('branch:', pullRequest.headRefName);
|
|
456
|
+
console.log('draft:', pullRequest.draft);
|
|
457
|
+
console.log('body:', pullRequest.body.toString());
|
|
458
|
+
console.log('updates:', pullRequest.updates.length);
|
|
459
|
+
for (const update of pullRequest.updates) {
|
|
460
|
+
console.log(` ${update.path}: `,
|
|
461
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
462
|
+
update.updater.constructor);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
const pullRequestNumbers = await manifest.createPullRequests();
|
|
468
|
+
console.log(pullRequestNumbers);
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
};
|
|
472
|
+
const createManifestReleaseCommand = {
|
|
473
|
+
command: 'manifest-release',
|
|
474
|
+
describe: 'create releases/tags from last release-PR using a manifest file',
|
|
475
|
+
deprecated: 'use github-release instead',
|
|
476
|
+
builder(yargs) {
|
|
477
|
+
return manifestOptions(releaseOptions(gitHubOptions(yargs)));
|
|
478
|
+
},
|
|
479
|
+
async handler(argv) {
|
|
480
|
+
logger_1.logger.warn('manifest-release is deprecated. Please use github-release instead.');
|
|
481
|
+
const github = await buildGitHub(argv);
|
|
482
|
+
const targetBranch = argv.targetBranch ||
|
|
483
|
+
argv.defaultBranch ||
|
|
484
|
+
github.repository.defaultBranch;
|
|
485
|
+
const manifestOptions = extractManifestOptions(argv);
|
|
486
|
+
const manifest = await manifest_1.Manifest.fromManifest(github, targetBranch, argv.configFile, argv.manifestFile, manifestOptions);
|
|
487
|
+
if (argv.dryRun) {
|
|
488
|
+
const releases = await manifest.buildReleases();
|
|
489
|
+
logger_1.logger.info(releases);
|
|
490
|
+
}
|
|
491
|
+
else {
|
|
492
|
+
const releaseNumbers = await manifest.createReleases();
|
|
493
|
+
console.log(releaseNumbers);
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
};
|
|
497
|
+
const bootstrapCommand = {
|
|
498
|
+
command: 'bootstrap',
|
|
499
|
+
describe: 'configure release manifest',
|
|
500
|
+
builder(yargs) {
|
|
501
|
+
return manifestConfigOptions(manifestOptions(releaseOptions(pullRequestStrategyOptions(gitHubOptions(yargs)))))
|
|
502
|
+
.option('initial-version', {
|
|
503
|
+
description: 'current version',
|
|
504
|
+
})
|
|
505
|
+
.coerce('path', arg => {
|
|
506
|
+
return arg || manifest_1.ROOT_PROJECT_PATH;
|
|
507
|
+
});
|
|
508
|
+
},
|
|
509
|
+
async handler(argv) {
|
|
510
|
+
const github = await buildGitHub(argv);
|
|
511
|
+
const targetBranch = argv.targetBranch ||
|
|
512
|
+
argv.defaultBranch ||
|
|
513
|
+
github.repository.defaultBranch;
|
|
514
|
+
const bootstrapper = new bootstrapper_1.Bootstrapper(github, targetBranch, argv.manifestFile, argv.configFile, argv.initialVersion);
|
|
515
|
+
const path = argv.path || manifest_1.ROOT_PROJECT_PATH;
|
|
516
|
+
const releaserConfig = {
|
|
517
|
+
releaseType: argv.releaseType,
|
|
518
|
+
component: argv.component,
|
|
519
|
+
packageName: argv.packageName,
|
|
520
|
+
draft: argv.draft,
|
|
521
|
+
forceTag: argv.forceTag,
|
|
522
|
+
prerelease: argv.prerelease,
|
|
523
|
+
draftPullRequest: argv.draftPullRequest,
|
|
524
|
+
bumpMinorPreMajor: argv.bumpMinorPreMajor,
|
|
525
|
+
bumpPatchForMinorPreMajor: argv.bumpPatchForMinorPreMajor,
|
|
526
|
+
prereleaseType: argv.prereleaseType,
|
|
527
|
+
changelogPath: argv.changelogPath,
|
|
528
|
+
changelogHost: argv.changelogHost,
|
|
529
|
+
changelogSections: argv.changelogSections,
|
|
530
|
+
releaseAs: argv.releaseAs,
|
|
531
|
+
versioning: argv.versioningStrategy,
|
|
532
|
+
extraFiles: argv.extraFiles,
|
|
533
|
+
versionFile: argv.versionFile,
|
|
534
|
+
};
|
|
535
|
+
if (argv.dryRun) {
|
|
536
|
+
const pullRequest = await await bootstrapper.buildPullRequest(path, releaserConfig);
|
|
537
|
+
console.log('Would open 1 pull request');
|
|
538
|
+
console.log('title:', pullRequest.title);
|
|
539
|
+
console.log('branch:', pullRequest.headBranchName);
|
|
540
|
+
console.log('body:', pullRequest.body);
|
|
541
|
+
console.log('updates:', pullRequest.updates.length);
|
|
542
|
+
const changes = await github.buildChangeSet(pullRequest.updates, targetBranch);
|
|
543
|
+
for (const update of pullRequest.updates) {
|
|
544
|
+
console.log(` ${update.path}: `,
|
|
545
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
546
|
+
update.updater.constructor);
|
|
547
|
+
if (argv.trace) {
|
|
548
|
+
const change = changes.get(update.path);
|
|
549
|
+
if (change) {
|
|
550
|
+
const patch = (0, diff_1.createPatch)(update.path, change.originalContent || '', change.content || '');
|
|
551
|
+
console.log(patch);
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
console.warn(`no change found for ${update.path}`);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
const pullRequest = await bootstrapper.bootstrap(path, releaserConfig);
|
|
561
|
+
console.log(pullRequest);
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
};
|
|
565
|
+
const debugConfigCommand = {
|
|
566
|
+
command: 'debug-config',
|
|
567
|
+
describe: 'debug manifest config',
|
|
568
|
+
builder(yargs) {
|
|
569
|
+
return manifestConfigOptions(manifestOptions(gitHubOptions(yargs)));
|
|
570
|
+
},
|
|
571
|
+
async handler(argv) {
|
|
572
|
+
const github = await buildGitHub(argv);
|
|
573
|
+
const manifestOptions = extractManifestOptions(argv);
|
|
574
|
+
const targetBranch = argv.targetBranch ||
|
|
575
|
+
argv.defaultBranch ||
|
|
576
|
+
github.repository.defaultBranch;
|
|
577
|
+
const manifest = await manifest_1.Manifest.fromManifest(github, targetBranch, argv.configFile, argv.manifestFile, manifestOptions);
|
|
578
|
+
console.log(manifest);
|
|
579
|
+
},
|
|
580
|
+
};
|
|
581
|
+
async function buildGitHub(argv) {
|
|
582
|
+
const [owner, repo] = parseGithubRepoUrl(argv.repoUrl);
|
|
583
|
+
if (argv.local) {
|
|
584
|
+
const localGitHub = await local_github_1.LocalGitHub.create({
|
|
585
|
+
owner,
|
|
586
|
+
repo,
|
|
587
|
+
token: argv.token,
|
|
588
|
+
apiUrl: argv.apiUrl,
|
|
589
|
+
graphqlUrl: argv.graphqlUrl,
|
|
590
|
+
localRepoPath: argv.localPath,
|
|
591
|
+
cloneDepth: argv.localCloneDepth,
|
|
592
|
+
});
|
|
593
|
+
return localGitHub;
|
|
594
|
+
}
|
|
595
|
+
else {
|
|
596
|
+
const github = await github_1.GitHub.create({
|
|
597
|
+
owner,
|
|
598
|
+
repo,
|
|
599
|
+
token: argv.token,
|
|
600
|
+
apiUrl: argv.apiUrl,
|
|
601
|
+
graphqlUrl: argv.graphqlUrl,
|
|
602
|
+
});
|
|
603
|
+
return github;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
exports.parser = yargs
|
|
607
|
+
.command(createReleasePullRequestCommand)
|
|
608
|
+
.command(createReleaseCommand)
|
|
609
|
+
.command(createManifestPullRequestCommand)
|
|
610
|
+
.command(createManifestReleaseCommand)
|
|
611
|
+
.command(bootstrapCommand)
|
|
612
|
+
.command(debugConfigCommand)
|
|
613
|
+
.option('debug', {
|
|
614
|
+
describe: 'print verbose errors (use only for local debugging).',
|
|
615
|
+
default: false,
|
|
616
|
+
type: 'boolean',
|
|
617
|
+
})
|
|
618
|
+
.option('trace', {
|
|
619
|
+
describe: 'print extra verbose errors (use only for local debugging).',
|
|
620
|
+
default: false,
|
|
621
|
+
type: 'boolean',
|
|
622
|
+
})
|
|
623
|
+
.middleware(argv => {
|
|
624
|
+
if (argv.trace) {
|
|
625
|
+
(0, logger_1.setLogger)(new logger_1.CheckpointLogger(true, true));
|
|
626
|
+
}
|
|
627
|
+
else if (argv.debug) {
|
|
628
|
+
(0, logger_1.setLogger)(new logger_1.CheckpointLogger(true));
|
|
629
|
+
}
|
|
630
|
+
})
|
|
631
|
+
.option('plugin', {
|
|
632
|
+
describe: 'load plugin named release-please-<plugin-name>',
|
|
633
|
+
type: 'array',
|
|
634
|
+
default: [],
|
|
635
|
+
})
|
|
636
|
+
.middleware(argv => {
|
|
637
|
+
for (const pluginName of argv.plugin) {
|
|
638
|
+
console.log(`requiring plugin: ${pluginName}`);
|
|
639
|
+
try {
|
|
640
|
+
const plugin = require(pluginName.toString());
|
|
641
|
+
if (plugin === null || plugin === void 0 ? void 0 : plugin.init) {
|
|
642
|
+
console.log(`loading plugin: ${pluginName}`);
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
console.warn(`plugin: ${pluginName} did not have an init() function.`);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
catch (e) {
|
|
649
|
+
console.warn(`failed to require plugin: ${pluginName}:`, e);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
})
|
|
653
|
+
.demandCommand(1)
|
|
654
|
+
.strict(true)
|
|
655
|
+
.scriptName('release-please');
|
|
656
|
+
function extractManifestOptions(argv) {
|
|
657
|
+
const manifestOptions = {};
|
|
658
|
+
if ('fork' in argv && argv.fork !== undefined) {
|
|
659
|
+
manifestOptions.fork = argv.fork;
|
|
660
|
+
}
|
|
661
|
+
if (argv.label !== undefined) {
|
|
662
|
+
let labels = argv.label.split(',');
|
|
663
|
+
if (labels.length === 1 && labels[0] === '')
|
|
664
|
+
labels = [];
|
|
665
|
+
manifestOptions.labels = labels;
|
|
666
|
+
}
|
|
667
|
+
if ('skipLabeling' in argv && argv.skipLabeling !== undefined) {
|
|
668
|
+
manifestOptions.skipLabeling = argv.skipLabeling;
|
|
669
|
+
}
|
|
670
|
+
if ('releaseLabel' in argv && argv.releaseLabel) {
|
|
671
|
+
manifestOptions.releaseLabels = argv.releaseLabel.split(',');
|
|
672
|
+
}
|
|
673
|
+
if ('snapshotLabel' in argv && argv.snapshotLabel) {
|
|
674
|
+
manifestOptions.snapshotLabels = argv.snapshotLabel.split(',');
|
|
675
|
+
}
|
|
676
|
+
if ('signoff' in argv && argv.signoff) {
|
|
677
|
+
manifestOptions.signoff = argv.signoff;
|
|
678
|
+
}
|
|
679
|
+
if ('draft' in argv && argv.draft !== undefined) {
|
|
680
|
+
manifestOptions.draft = argv.draft;
|
|
681
|
+
}
|
|
682
|
+
if ('draftPullRequest' in argv && argv.draftPullRequest !== undefined) {
|
|
683
|
+
manifestOptions.draftPullRequest = argv.draftPullRequest;
|
|
684
|
+
}
|
|
685
|
+
return manifestOptions;
|
|
686
|
+
}
|
|
687
|
+
// The errors returned by octokit currently contain the
|
|
688
|
+
// request object, this contains information we don't want to
|
|
689
|
+
// leak. For this reason, we capture exceptions and print
|
|
690
|
+
// a less verbose error message (run with --debug to output
|
|
691
|
+
// the request object, don't do this in CI/CD).
|
|
692
|
+
const handleError = (err) => {
|
|
693
|
+
var _a, _b;
|
|
694
|
+
let status = '';
|
|
695
|
+
if (exports.handleError.yargsArgs === undefined) {
|
|
696
|
+
throw new Error('Set handleError.yargsArgs with a yargs.Arguments instance.');
|
|
697
|
+
}
|
|
698
|
+
const ya = exports.handleError.yargsArgs;
|
|
699
|
+
const errorLogger = (_a = exports.handleError.logger) !== null && _a !== void 0 ? _a : logger_1.logger;
|
|
700
|
+
const command = ((_b = ya === null || ya === void 0 ? void 0 : ya._) === null || _b === void 0 ? void 0 : _b.length) ? ya._[0] : '';
|
|
701
|
+
if (err.status) {
|
|
702
|
+
status = '' + err.status;
|
|
703
|
+
}
|
|
704
|
+
errorLogger.error(`command ${command} failed${status ? ` with status ${status}` : ''}`);
|
|
705
|
+
if (ya === null || ya === void 0 ? void 0 : ya.debug) {
|
|
706
|
+
logger_1.logger.error('---------');
|
|
707
|
+
logger_1.logger.error(err.stack);
|
|
708
|
+
}
|
|
709
|
+
process.exitCode = 1;
|
|
710
|
+
};
|
|
711
|
+
exports.handleError = handleError;
|
|
712
|
+
// Only run parser if executed with node bin, this allows
|
|
713
|
+
// for the parser to be easily tested:
|
|
714
|
+
let argv;
|
|
715
|
+
if (require.main === module) {
|
|
716
|
+
(async () => {
|
|
717
|
+
argv = await exports.parser.parseAsync();
|
|
718
|
+
exports.handleError.yargsArgs = argv;
|
|
719
|
+
process.on('unhandledRejection', err => {
|
|
720
|
+
(0, exports.handleError)(err);
|
|
721
|
+
});
|
|
722
|
+
process.on('uncaughtException', err => {
|
|
723
|
+
(0, exports.handleError)(err);
|
|
724
|
+
});
|
|
725
|
+
})();
|
|
726
|
+
}
|
|
727
|
+
//# sourceMappingURL=release-please.js.map
|