@release-please-oss/release-please 0.0.0 → 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 +280 -0
- 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 +113 -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,163 @@
|
|
|
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.PrereleaseVersioningStrategy = void 0;
|
|
17
|
+
const default_1 = require("./default");
|
|
18
|
+
const version_1 = require("../version");
|
|
19
|
+
const versioning_strategy_1 = require("../versioning-strategy");
|
|
20
|
+
/**
|
|
21
|
+
* Regex to match the last set of numbers in a string
|
|
22
|
+
* Example: 1.2.3-beta01-01 -> 01
|
|
23
|
+
*/
|
|
24
|
+
const PRERELEASE_NUMBER = /(?<number>\d+)(?=\D*$)/;
|
|
25
|
+
class AbstractPrereleaseVersionUpdate {
|
|
26
|
+
constructor(prereleaseType) {
|
|
27
|
+
this.prereleaseType = prereleaseType;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Returns the new bumped prerelease version
|
|
31
|
+
*
|
|
32
|
+
* That is, if the current version is 1.2.3-beta01, the next prerelease version
|
|
33
|
+
* will be 1.2.3-beta02. If no number is found, the prerelease version will be
|
|
34
|
+
* 1.2.3-beta. If multiple numbers are found, the last set of numbers will be
|
|
35
|
+
* incremented, e.g. 1.2.3-beta01-01 -> 1.2.3-beta01-02.
|
|
36
|
+
*
|
|
37
|
+
* @param {prerelease} string The current version
|
|
38
|
+
* @returns {Version} The bumped version
|
|
39
|
+
*/
|
|
40
|
+
bumpPrerelease(prerelease) {
|
|
41
|
+
const match = prerelease.match(PRERELEASE_NUMBER);
|
|
42
|
+
let nextPrerelease = `${prerelease}.1`;
|
|
43
|
+
if (match === null || match === void 0 ? void 0 : match.groups) {
|
|
44
|
+
const numberLength = match.groups.number.length;
|
|
45
|
+
const nextPrereleaseNumber = Number(match.groups.number) + 1;
|
|
46
|
+
const paddedNextPrereleaseNumber = `${nextPrereleaseNumber}`.padStart(numberLength, '0');
|
|
47
|
+
nextPrerelease = prerelease.replace(PRERELEASE_NUMBER, paddedNextPrereleaseNumber);
|
|
48
|
+
}
|
|
49
|
+
return nextPrerelease;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
class PrereleasePatchVersionUpdate extends AbstractPrereleaseVersionUpdate {
|
|
53
|
+
/**
|
|
54
|
+
* Returns the new bumped version
|
|
55
|
+
*
|
|
56
|
+
* @param {Version} version The current version
|
|
57
|
+
* @returns {Version} The bumped version
|
|
58
|
+
*/
|
|
59
|
+
bump(version) {
|
|
60
|
+
if (version.preRelease) {
|
|
61
|
+
const nextPrerelease = this.bumpPrerelease(version.preRelease);
|
|
62
|
+
return new version_1.Version(version.major, version.minor, version.patch, nextPrerelease, version.build);
|
|
63
|
+
}
|
|
64
|
+
return new version_1.Version(version.major, version.minor, version.patch + 1, this.prereleaseType, version.build);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
class PrereleaseMinorVersionUpdate extends AbstractPrereleaseVersionUpdate {
|
|
68
|
+
/**
|
|
69
|
+
* Returns the new bumped version
|
|
70
|
+
*
|
|
71
|
+
* @param {Version} version The current version
|
|
72
|
+
* @returns {Version} The bumped version
|
|
73
|
+
*/
|
|
74
|
+
bump(version) {
|
|
75
|
+
if (version.preRelease) {
|
|
76
|
+
if (version.patch === 0) {
|
|
77
|
+
const nextPrerelease = this.bumpPrerelease(version.preRelease);
|
|
78
|
+
return new version_1.Version(version.major, version.minor, version.patch, nextPrerelease, version.build);
|
|
79
|
+
}
|
|
80
|
+
return new versioning_strategy_1.MinorVersionUpdate().bump(version);
|
|
81
|
+
}
|
|
82
|
+
return new version_1.Version(version.major, version.minor + 1, 0, this.prereleaseType, version.build);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
class PrereleaseMajorVersionUpdate extends AbstractPrereleaseVersionUpdate {
|
|
86
|
+
/**
|
|
87
|
+
* Returns the new bumped version
|
|
88
|
+
*
|
|
89
|
+
* @param {Version} version The current version
|
|
90
|
+
* @returns {Version} The bumped version
|
|
91
|
+
*/
|
|
92
|
+
bump(version) {
|
|
93
|
+
if (version.preRelease) {
|
|
94
|
+
if (version.patch === 0 && version.minor === 0) {
|
|
95
|
+
const nextPrerelease = this.bumpPrerelease(version.preRelease);
|
|
96
|
+
return new version_1.Version(version.major, version.minor, version.patch, nextPrerelease, version.build);
|
|
97
|
+
}
|
|
98
|
+
return new versioning_strategy_1.MajorVersionUpdate().bump(version);
|
|
99
|
+
}
|
|
100
|
+
return new version_1.Version(version.major + 1, 0, 0, this.prereleaseType, version.build);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* This versioning strategy will increment the pre-release number for patch
|
|
105
|
+
* bumps if there is a pre-release number (preserving any leading 0s).
|
|
106
|
+
* Example: 1.2.3-beta01 -> 1.2.3-beta02.
|
|
107
|
+
*/
|
|
108
|
+
class PrereleaseVersioningStrategy extends default_1.DefaultVersioningStrategy {
|
|
109
|
+
constructor(options = {}) {
|
|
110
|
+
super(options);
|
|
111
|
+
this.prereleaseType = options.prereleaseType;
|
|
112
|
+
this.prerelease = options.prerelease === true;
|
|
113
|
+
}
|
|
114
|
+
determineReleaseType(version, commits) {
|
|
115
|
+
// iterate through list of commits and find biggest commit type
|
|
116
|
+
let breaking = 0;
|
|
117
|
+
let features = 0;
|
|
118
|
+
for (const commit of commits) {
|
|
119
|
+
const releaseAs = commit.notes.find(note => note.title === 'RELEASE AS');
|
|
120
|
+
if (releaseAs) {
|
|
121
|
+
// commits are handled newest to oldest, so take the first one (newest) found
|
|
122
|
+
this.logger.debug(`found Release-As: ${releaseAs.text}, forcing version`);
|
|
123
|
+
return new versioning_strategy_1.CustomVersionUpdate(version_1.Version.parse(releaseAs.text).toString());
|
|
124
|
+
}
|
|
125
|
+
// Conventional Commits types are case-insensitive, so `Feat:` counts
|
|
126
|
+
// as a feature, the same way the changelog lists it.
|
|
127
|
+
const type = commit.type.toLowerCase();
|
|
128
|
+
if (commit.breaking) {
|
|
129
|
+
breaking++;
|
|
130
|
+
}
|
|
131
|
+
else if (type === 'feat' || type === 'feature') {
|
|
132
|
+
features++;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
let bumpedVersionUpdater;
|
|
136
|
+
if (breaking > 0) {
|
|
137
|
+
if (version.isPreMajor && this.bumpMinorPreMajor) {
|
|
138
|
+
bumpedVersionUpdater = new PrereleaseMinorVersionUpdate(this.prereleaseType);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
bumpedVersionUpdater = new PrereleaseMajorVersionUpdate(this.prereleaseType);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else if (features > 0) {
|
|
145
|
+
if (version.isPreMajor && this.bumpPatchForMinorPreMajor) {
|
|
146
|
+
bumpedVersionUpdater = new PrereleasePatchVersionUpdate(this.prereleaseType);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
bumpedVersionUpdater = new PrereleaseMinorVersionUpdate(this.prereleaseType);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
bumpedVersionUpdater = new PrereleasePatchVersionUpdate(this.prereleaseType);
|
|
154
|
+
}
|
|
155
|
+
if (!this.prerelease) {
|
|
156
|
+
const bumpedVersion = bumpedVersionUpdater.bump(version);
|
|
157
|
+
return new versioning_strategy_1.CustomVersionUpdate(version_1.Version.parse(`${bumpedVersion.major}.${bumpedVersion.minor}.${bumpedVersion.patch}`).toString());
|
|
158
|
+
}
|
|
159
|
+
return bumpedVersionUpdater;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.PrereleaseVersioningStrategy = PrereleaseVersioningStrategy;
|
|
163
|
+
//# sourceMappingURL=prerelease.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Version } from '../version';
|
|
2
|
+
import { DefaultVersioningStrategy } from './default';
|
|
3
|
+
import { ConventionalCommit } from '../commit';
|
|
4
|
+
import { VersionUpdater } from '../versioning-strategy';
|
|
5
|
+
/**
|
|
6
|
+
* This VersioningStrategy is used for "service pack" versioning. In this
|
|
7
|
+
* strategy, we use the pre-release field with a pattern of `sp-\d+` where
|
|
8
|
+
* the number is an auto-incrementing integer starting with 1.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ServicePackVersioningStrategy extends DefaultVersioningStrategy {
|
|
11
|
+
determineReleaseType(_version: Version, _commits: ConventionalCommit[]): VersionUpdater;
|
|
12
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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.ServicePackVersioningStrategy = void 0;
|
|
17
|
+
const version_1 = require("../version");
|
|
18
|
+
const default_1 = require("./default");
|
|
19
|
+
const SERVICE_PACK_PATTERN = /sp\.(\d+)/;
|
|
20
|
+
/**
|
|
21
|
+
* This version updater knows how to bump from a non-service pack
|
|
22
|
+
* version to a service pack version and increment the service
|
|
23
|
+
* pack number in subsequent releases.
|
|
24
|
+
*/
|
|
25
|
+
class ServicePackVersionUpdate {
|
|
26
|
+
bump(version) {
|
|
27
|
+
var _a;
|
|
28
|
+
const match = (_a = version.preRelease) === null || _a === void 0 ? void 0 : _a.match(SERVICE_PACK_PATTERN);
|
|
29
|
+
if (match) {
|
|
30
|
+
const spNumber = Number(match[1]);
|
|
31
|
+
return new version_1.Version(version.major, version.minor, version.patch, `sp.${spNumber + 1}`, version.build);
|
|
32
|
+
}
|
|
33
|
+
return new version_1.Version(version.major, version.minor, version.patch, 'sp.1', version.build);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* This VersioningStrategy is used for "service pack" versioning. In this
|
|
38
|
+
* strategy, we use the pre-release field with a pattern of `sp-\d+` where
|
|
39
|
+
* the number is an auto-incrementing integer starting with 1.
|
|
40
|
+
*/
|
|
41
|
+
class ServicePackVersioningStrategy extends default_1.DefaultVersioningStrategy {
|
|
42
|
+
determineReleaseType(_version, _commits) {
|
|
43
|
+
return new ServicePackVersionUpdate();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.ServicePackVersioningStrategy = ServicePackVersioningStrategy;
|
|
47
|
+
//# sourceMappingURL=service-pack.js.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Version } from './version';
|
|
2
|
+
import { ConventionalCommit } from './commit';
|
|
3
|
+
/**
|
|
4
|
+
* An interface for updating a version.
|
|
5
|
+
*/
|
|
6
|
+
export interface VersionUpdater {
|
|
7
|
+
/**
|
|
8
|
+
* Returns the new bumped version
|
|
9
|
+
*
|
|
10
|
+
* @param {Version} version The current version
|
|
11
|
+
* @returns {Version} The bumped version
|
|
12
|
+
*/
|
|
13
|
+
bump(version: Version): Version;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* This VersionUpdater performs a SemVer major version bump.
|
|
17
|
+
*/
|
|
18
|
+
export declare class MajorVersionUpdate implements VersionUpdater {
|
|
19
|
+
/**
|
|
20
|
+
* Returns the new bumped version
|
|
21
|
+
*
|
|
22
|
+
* @param {Version} version The current version
|
|
23
|
+
* @returns {Version} The bumped version
|
|
24
|
+
*/
|
|
25
|
+
bump(version: Version): Version;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* This VersionUpdater performs a SemVer minor version bump.
|
|
29
|
+
*/
|
|
30
|
+
export declare class MinorVersionUpdate implements VersionUpdater {
|
|
31
|
+
/**
|
|
32
|
+
* Returns the new bumped version
|
|
33
|
+
*
|
|
34
|
+
* @param {Version} version The current version
|
|
35
|
+
* @returns {Version} The bumped version
|
|
36
|
+
*/
|
|
37
|
+
bump(version: Version): Version;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* This VersionUpdater performs a SemVer patch version bump.
|
|
41
|
+
*/
|
|
42
|
+
export declare class PatchVersionUpdate implements VersionUpdater {
|
|
43
|
+
/**
|
|
44
|
+
* Returns the new bumped version
|
|
45
|
+
*
|
|
46
|
+
* @param {Version} version The current version
|
|
47
|
+
* @returns {Version} The bumped version
|
|
48
|
+
*/
|
|
49
|
+
bump(version: Version): Version;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* This VersionUpdater sets the version to a specific version.
|
|
53
|
+
*/
|
|
54
|
+
export declare class CustomVersionUpdate implements VersionUpdater {
|
|
55
|
+
private versionString;
|
|
56
|
+
constructor(versionString: string);
|
|
57
|
+
/**
|
|
58
|
+
* Returns the new bumped version. This version is specified
|
|
59
|
+
* at initialization.
|
|
60
|
+
*
|
|
61
|
+
* @param {Version} version The current version
|
|
62
|
+
* @returns {Version} The bumped version
|
|
63
|
+
*/
|
|
64
|
+
bump(_version: Version): Version;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Implement this interface to create a new versioning scheme.
|
|
68
|
+
*/
|
|
69
|
+
export interface VersioningStrategy {
|
|
70
|
+
/**
|
|
71
|
+
* Given the current version of an artifact and a list of commits,
|
|
72
|
+
* return the next version.
|
|
73
|
+
*
|
|
74
|
+
* @param {Version} version The current version
|
|
75
|
+
* @param {ConventionalCommit[]} commits The list of commits to consider
|
|
76
|
+
* @returns {Version} The next version
|
|
77
|
+
*/
|
|
78
|
+
bump(version: Version, commits: ConventionalCommit[]): Version;
|
|
79
|
+
/**
|
|
80
|
+
* Given the current version of an artifact and a list of commits,
|
|
81
|
+
* return a VersionUpdater that knows how to bump the version.
|
|
82
|
+
*
|
|
83
|
+
* This is useful for chaining together versioning strategies.
|
|
84
|
+
*
|
|
85
|
+
* @param {Version} version The current version
|
|
86
|
+
* @param {ConventionalCommit[]} commits The list of commits to consider
|
|
87
|
+
* @returns {VersionUpdater} Updater for bumping the next version.
|
|
88
|
+
*/
|
|
89
|
+
determineReleaseType(version: Version, commits: ConventionalCommit[]): VersionUpdater;
|
|
90
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
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.CustomVersionUpdate = exports.PatchVersionUpdate = exports.MinorVersionUpdate = exports.MajorVersionUpdate = void 0;
|
|
17
|
+
const version_1 = require("./version");
|
|
18
|
+
/**
|
|
19
|
+
* This VersionUpdater performs a SemVer major version bump.
|
|
20
|
+
*/
|
|
21
|
+
class MajorVersionUpdate {
|
|
22
|
+
/**
|
|
23
|
+
* Returns the new bumped version
|
|
24
|
+
*
|
|
25
|
+
* @param {Version} version The current version
|
|
26
|
+
* @returns {Version} The bumped version
|
|
27
|
+
*/
|
|
28
|
+
bump(version) {
|
|
29
|
+
return new version_1.Version(version.major + 1, 0, 0, version.preRelease, version.build);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.MajorVersionUpdate = MajorVersionUpdate;
|
|
33
|
+
/**
|
|
34
|
+
* This VersionUpdater performs a SemVer minor version bump.
|
|
35
|
+
*/
|
|
36
|
+
class MinorVersionUpdate {
|
|
37
|
+
/**
|
|
38
|
+
* Returns the new bumped version
|
|
39
|
+
*
|
|
40
|
+
* @param {Version} version The current version
|
|
41
|
+
* @returns {Version} The bumped version
|
|
42
|
+
*/
|
|
43
|
+
bump(version) {
|
|
44
|
+
return new version_1.Version(version.major, version.minor + 1, 0, version.preRelease, version.build);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.MinorVersionUpdate = MinorVersionUpdate;
|
|
48
|
+
/**
|
|
49
|
+
* This VersionUpdater performs a SemVer patch version bump.
|
|
50
|
+
*/
|
|
51
|
+
class PatchVersionUpdate {
|
|
52
|
+
/**
|
|
53
|
+
* Returns the new bumped version
|
|
54
|
+
*
|
|
55
|
+
* @param {Version} version The current version
|
|
56
|
+
* @returns {Version} The bumped version
|
|
57
|
+
*/
|
|
58
|
+
bump(version) {
|
|
59
|
+
return new version_1.Version(version.major, version.minor, version.patch + 1, version.preRelease, version.build);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.PatchVersionUpdate = PatchVersionUpdate;
|
|
63
|
+
/**
|
|
64
|
+
* This VersionUpdater sets the version to a specific version.
|
|
65
|
+
*/
|
|
66
|
+
class CustomVersionUpdate {
|
|
67
|
+
constructor(versionString) {
|
|
68
|
+
this.versionString = versionString;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Returns the new bumped version. This version is specified
|
|
72
|
+
* at initialization.
|
|
73
|
+
*
|
|
74
|
+
* @param {Version} version The current version
|
|
75
|
+
* @returns {Version} The bumped version
|
|
76
|
+
*/
|
|
77
|
+
bump(_version) {
|
|
78
|
+
return version_1.Version.parse(this.versionString);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.CustomVersionUpdate = CustomVersionUpdate;
|
|
82
|
+
//# sourceMappingURL=versioning-strategy.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,116 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@release-please-oss/release-please",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"version": "17.11.3",
|
|
4
|
+
"description": "generate release PRs based on the conventionalcommits.org spec",
|
|
5
|
+
"main": "./build/src/index.js",
|
|
6
|
+
"bin": "./build/src/bin/release-please.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "cross-env ENVIRONMENT=test LC_ALL=en c8 mocha --recursive --timeout=5000 build/test",
|
|
9
|
+
"docs": "echo add docs tests",
|
|
10
|
+
"test:snap": "cross-env SNAPSHOT_UPDATE=1 LC_ALL=en npm test",
|
|
11
|
+
"clean": "gts clean",
|
|
12
|
+
"prepare": "npm run compile",
|
|
13
|
+
"lint": "gts check",
|
|
14
|
+
"compile": "tsc -p .",
|
|
15
|
+
"fix": "gts fix",
|
|
16
|
+
"pretest": "npm run compile"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"build/src",
|
|
20
|
+
"templates",
|
|
21
|
+
"!build/src/**/*.map",
|
|
22
|
+
"schemas"
|
|
23
|
+
],
|
|
24
|
+
"repository": "release-please-oss/release-please",
|
|
25
|
+
"keywords": [
|
|
26
|
+
"release",
|
|
27
|
+
"conventional-commits"
|
|
28
|
+
],
|
|
29
|
+
"author": "Google Inc.",
|
|
30
|
+
"license": "Apache-2.0",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/release-please-oss/release-please/issues"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/release-please-oss/release-please#readme",
|
|
38
|
+
"config": {
|
|
39
|
+
"snap-shot-it": {
|
|
40
|
+
"sortSnapshots": true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@octokit/types": "9.0.0",
|
|
45
|
+
"@types/async-retry": "1.4.9",
|
|
46
|
+
"@types/chai": "4.3.4",
|
|
47
|
+
"@types/diff": "5.0.2",
|
|
48
|
+
"@types/iarna__toml": "2.0.2",
|
|
49
|
+
"@types/inquirer": "9.0.3",
|
|
50
|
+
"@types/js-yaml": "4.0.5",
|
|
51
|
+
"@types/jsonpath": "0.2.0",
|
|
52
|
+
"@types/mocha": "10.0.10",
|
|
53
|
+
"@types/node": "22.19.21",
|
|
54
|
+
"@types/npmlog": "7.0.0",
|
|
55
|
+
"@types/semver": "7.3.13",
|
|
56
|
+
"@types/sinon": "17.0.3",
|
|
57
|
+
"@types/xmldom": "0.1.31",
|
|
58
|
+
"@types/yargs": "17.0.20",
|
|
59
|
+
"ajv": "8.18.0",
|
|
60
|
+
"ajv-formats": "3.0.1",
|
|
61
|
+
"c8": "10.0.0",
|
|
62
|
+
"chai": "4.3.7",
|
|
63
|
+
"config-chain": "1.1.13",
|
|
64
|
+
"cross-env": "7.0.3",
|
|
65
|
+
"gts": "3.1.1",
|
|
66
|
+
"mocha": "10.8.2",
|
|
67
|
+
"nock": "13.3.0",
|
|
68
|
+
"node-fetch": "2.6.8",
|
|
69
|
+
"sinon": "18.0.1",
|
|
70
|
+
"snap-shot-it": "7.9.10"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"@conventional-commits/parser": "^0.4.1",
|
|
74
|
+
"@google-automations/git-file-utils": "^3.2.0",
|
|
75
|
+
"@iarna/toml": "^3.0.0",
|
|
76
|
+
"@octokit/graphql": "^7.1.0",
|
|
77
|
+
"@octokit/request": "^8.3.1",
|
|
78
|
+
"@octokit/request-error": "^5.1.0",
|
|
79
|
+
"@octokit/rest": "^20.1.1",
|
|
80
|
+
"@types/npm-package-arg": "^6.1.0",
|
|
81
|
+
"@xmldom/xmldom": "^0.8.4",
|
|
82
|
+
"async-retry": "^1.3.3",
|
|
83
|
+
"chalk": "^4.0.0",
|
|
84
|
+
"conventional-changelog-conventionalcommits": "^6.0.0",
|
|
85
|
+
"conventional-changelog-writer": "^6.0.0",
|
|
86
|
+
"conventional-commits-filter": "^3.0.0",
|
|
87
|
+
"detect-indent": "^6.1.0",
|
|
88
|
+
"diff": "^8.0.3",
|
|
89
|
+
"figures": "^3.0.0",
|
|
90
|
+
"http-proxy-agent": "^7.0.0",
|
|
91
|
+
"https-proxy-agent": "^7.0.0",
|
|
92
|
+
"js-yaml": "^4.3.2",
|
|
93
|
+
"jsonpath-plus": "^10.0.0",
|
|
94
|
+
"node-html-parser": "^6.0.0",
|
|
95
|
+
"parse-github-repo-url": "^1.4.1",
|
|
96
|
+
"semver": "^7.5.3",
|
|
97
|
+
"type-fest": "^3.0.0",
|
|
98
|
+
"typescript": "^4.6.4",
|
|
99
|
+
"unist-util-visit": "^2.0.3",
|
|
100
|
+
"unist-util-visit-parents": "^3.1.1",
|
|
101
|
+
"xpath": "^0.0.34",
|
|
102
|
+
"yaml": "^2.2.2",
|
|
103
|
+
"yargs": "^17.0.0"
|
|
104
|
+
},
|
|
105
|
+
"engines": {
|
|
106
|
+
"node": ">=22.0.0"
|
|
107
|
+
},
|
|
108
|
+
"overrides": {
|
|
109
|
+
"tmp": "^0.2.7",
|
|
110
|
+
"serialize-javascript": "^7.1.3",
|
|
111
|
+
"js-yaml": "^4.3.2",
|
|
112
|
+
"brace-expansion": "^5.0.8",
|
|
113
|
+
"debug": "^4.3.4",
|
|
114
|
+
"minimatch": "^11.0.1"
|
|
115
|
+
}
|
|
7
116
|
}
|