release-please 12.3.0 → 13.0.0-candidate.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +5 -0
- package/build/src/bin/release-please.d.ts +51 -11
- package/build/src/bin/release-please.js +409 -150
- package/build/src/bootstrapper.d.ts +12 -0
- package/build/src/bootstrapper.js +60 -0
- package/build/src/commit.d.ts +26 -0
- package/build/src/{util/to-conventional-changelog-format.js → commit.js} +97 -2
- package/build/src/errors/index.d.ts +0 -5
- package/build/src/errors/index.js +1 -10
- package/build/src/factory.d.ts +25 -37
- package/build/src/factory.js +159 -150
- package/build/src/github.d.ts +151 -883
- package/build/src/github.js +584 -1013
- package/build/src/manifest.d.ts +177 -48
- package/build/src/manifest.js +583 -487
- package/build/src/plugin.d.ts +20 -0
- package/build/src/{plugins/plugin.js → plugin.js} +10 -9
- package/build/src/plugins/cargo-workspace.d.ts +48 -18
- package/build/src/plugins/cargo-workspace.js +247 -328
- package/build/src/plugins/merge.d.ts +11 -0
- package/build/src/plugins/merge.js +83 -0
- package/build/src/plugins/node-workspace.d.ts +35 -17
- package/build/src/plugins/node-workspace.js +234 -271
- package/build/src/plugins/workspace.d.ts +102 -0
- package/build/src/plugins/workspace.js +170 -0
- package/build/src/pull-request.d.ts +10 -0
- package/build/src/{updaters/java/readme.js → pull-request.js} +2 -7
- package/build/src/release-notes.d.ts +29 -0
- package/build/src/release-notes.js +71 -0
- package/build/src/release-pull-request.d.ts +13 -0
- package/build/src/{updaters/java/pom-xml.js → release-pull-request.js} +2 -7
- package/build/src/release.d.ts +6 -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/strategies/dart.d.ts +8 -0
- package/build/src/strategies/dart.js +63 -0
- package/build/src/strategies/elixir.d.ts +5 -0
- package/build/src/{releasers → strategies}/elixir.js +18 -14
- package/build/src/strategies/go-yoshi.d.ts +13 -0
- package/build/src/strategies/go-yoshi.js +106 -0
- package/build/src/strategies/go.d.ts +5 -0
- package/build/src/{releasers → strategies}/go.js +11 -12
- package/build/src/strategies/helm.d.ts +8 -0
- package/build/src/strategies/helm.js +63 -0
- package/build/src/strategies/java-yoshi.d.ts +24 -0
- package/build/src/strategies/java-yoshi.js +203 -0
- package/build/src/strategies/krm-blueprint.d.ts +7 -0
- package/build/src/{releasers → strategies}/krm-blueprint.js +26 -22
- package/build/src/strategies/node.d.ts +9 -0
- package/build/src/strategies/node.js +82 -0
- package/build/src/strategies/ocaml.d.ts +5 -0
- package/build/src/{releasers → strategies}/ocaml.js +34 -28
- package/build/src/strategies/php-yoshi.d.ts +9 -0
- package/build/src/strategies/php-yoshi.js +214 -0
- package/build/src/strategies/php.d.ts +6 -0
- package/build/src/{releasers → strategies}/php.js +24 -23
- package/build/src/strategies/python.d.ts +8 -0
- package/build/src/strategies/python.js +117 -0
- package/build/src/strategies/ruby-yoshi.d.ts +17 -0
- package/build/src/strategies/ruby-yoshi.js +116 -0
- package/build/src/strategies/ruby.d.ts +13 -0
- package/build/src/{releasers → strategies}/ruby.js +26 -27
- package/build/src/strategies/rust.d.ts +20 -0
- package/build/src/strategies/rust.js +120 -0
- package/build/src/strategies/simple.d.ts +5 -0
- package/build/src/{releasers → strategies}/simple.js +18 -14
- package/build/src/strategies/terraform-module.d.ts +7 -0
- package/build/src/{releasers → strategies}/terraform-module.js +29 -23
- package/build/src/strategy.d.ts +99 -0
- package/build/src/strategy.js +237 -0
- package/build/src/update.d.ts +23 -0
- package/build/src/{updaters/update.js → update.js} +1 -1
- package/build/src/updaters/changelog.d.ts +7 -10
- package/build/src/updaters/changelog.js +3 -9
- package/build/src/updaters/changelog.js.map +1 -1
- package/build/src/updaters/composite.d.ts +19 -0
- package/build/src/updaters/composite.js +42 -0
- package/build/src/updaters/dart/pubspec-yaml.d.ts +12 -0
- package/build/src/updaters/dart/pubspec-yaml.js +45 -0
- package/build/src/updaters/default.d.ts +21 -0
- package/build/src/updaters/{version-txt.js → default.js} +16 -10
- package/build/src/updaters/dotnet/csproj.d.ts +12 -0
- package/build/src/updaters/{java/google-utils.js → dotnet/csproj.js} +16 -13
- package/build/src/updaters/elixir/elixir-mix-exs.d.ts +12 -0
- package/build/src/updaters/{elixir-mix-exs.js → elixir/elixir-mix-exs.js} +12 -10
- package/build/src/updaters/helm/chart-yaml.d.ts +10 -11
- package/build/src/updaters/helm/chart-yaml.js +12 -10
- package/build/src/updaters/java/java-update.d.ts +14 -0
- package/build/src/updaters/java/{java_update.js → java-update.js} +22 -22
- package/build/src/updaters/java/versions-manifest.d.ts +12 -2
- package/build/src/updaters/java/versions-manifest.js +20 -4
- package/build/src/updaters/krm/krm-blueprint-version.d.ts +10 -11
- package/build/src/updaters/krm/krm-blueprint-version.js +13 -12
- package/build/src/updaters/node/package-json.d.ts +12 -0
- package/build/src/updaters/{package-json.js → node/package-json.js} +14 -16
- package/build/src/updaters/node/package-lock-json.d.ts +8 -0
- package/build/src/updaters/node/package-lock-json.js +36 -0
- package/build/src/updaters/node/samples-package-json.d.ts +23 -0
- package/build/src/updaters/{samples-package-json.js → node/samples-package-json.js} +19 -8
- package/build/src/updaters/ocaml/dune-project.d.ts +10 -11
- package/build/src/updaters/ocaml/dune-project.js +11 -9
- package/build/src/updaters/ocaml/esy-json.d.ts +10 -11
- package/build/src/updaters/ocaml/esy-json.js +12 -10
- package/build/src/updaters/ocaml/opam.d.ts +10 -11
- package/build/src/updaters/ocaml/opam.js +11 -9
- package/build/src/updaters/php/php-client-version.d.ts +12 -0
- package/build/src/updaters/{php-client-version.js → php/php-client-version.js} +10 -9
- package/build/src/updaters/php/php-manifest.d.ts +13 -0
- package/build/src/updaters/{php-manifest.js → php/php-manifest.js} +17 -15
- package/build/src/updaters/php/root-composer-update-packages.d.ts +12 -0
- package/build/src/updaters/{root-composer-update-packages.js → php/root-composer-update-packages.js} +17 -16
- package/build/src/updaters/python/pyproject-toml.d.ts +10 -11
- package/build/src/updaters/python/pyproject-toml.js +13 -11
- package/build/src/updaters/python/python-file-with-version.d.ts +7 -11
- package/build/src/updaters/python/python-file-with-version.js +7 -8
- package/build/src/updaters/python/setup-cfg.d.ts +10 -11
- package/build/src/updaters/python/setup-cfg.js +10 -8
- package/build/src/updaters/python/setup-py.d.ts +10 -11
- package/build/src/updaters/python/setup-py.js +10 -8
- package/build/src/updaters/raw-content.d.ts +19 -0
- package/build/src/{plugins/index.js → updaters/raw-content.js} +23 -12
- package/build/src/updaters/release-please-config.d.ts +8 -0
- package/build/src/updaters/release-please-config.js +41 -0
- package/build/src/updaters/release-please-manifest.d.ts +2 -11
- package/build/src/updaters/release-please-manifest.js +11 -14
- package/build/src/updaters/ruby/version-rb.d.ts +12 -0
- package/build/src/updaters/{version-rb.js → ruby/version-rb.js} +10 -8
- package/build/src/updaters/rust/cargo-lock.d.ts +7 -11
- package/build/src/updaters/rust/cargo-lock.js +14 -16
- package/build/src/updaters/rust/cargo-toml.d.ts +7 -11
- package/build/src/updaters/rust/cargo-toml.js +19 -21
- package/build/src/updaters/terraform/module-version.d.ts +10 -11
- package/build/src/updaters/terraform/module-version.js +11 -9
- package/build/src/updaters/terraform/readme.d.ts +10 -11
- package/build/src/updaters/terraform/readme.js +11 -10
- package/build/src/updaters/terraform/readme.js.map +1 -1
- package/build/src/util/branch-name.d.ts +5 -4
- package/build/src/util/branch-name.js +13 -10
- package/build/src/{commit-split.d.ts → util/commit-split.d.ts} +2 -4
- package/build/src/{commit-split.js → util/commit-split.js} +4 -2
- package/build/src/util/indent-commit.d.ts +1 -1
- package/build/src/util/logger.d.ts +5 -2
- package/build/src/util/logger.js +9 -4
- package/build/src/util/pull-request-body.d.ts +20 -0
- package/build/src/util/pull-request-body.js +129 -0
- package/build/src/util/pull-request-title.d.ts +8 -6
- package/build/src/util/pull-request-title.js +20 -6
- package/build/src/util/tag-name.d.ts +9 -0
- package/build/src/util/tag-name.js +41 -0
- package/build/src/{updaters → util}/toml-edit.d.ts +0 -0
- package/build/src/{updaters → util}/toml-edit.js +0 -0
- package/build/src/version.d.ts +11 -0
- package/build/src/version.js +45 -0
- package/build/src/versioning-strategies/always-bump-patch.d.ts +7 -0
- package/build/src/{updaters/package-lock-json.js → versioning-strategies/always-bump-patch.js} +8 -11
- package/build/src/versioning-strategies/default.d.ts +15 -0
- package/build/src/versioning-strategies/default.js +67 -0
- package/build/src/versioning-strategies/dependency-manifest.d.ts +7 -0
- package/build/src/versioning-strategies/dependency-manifest.js +90 -0
- package/build/src/versioning-strategies/java-add-snapshot.d.ts +9 -0
- package/build/src/versioning-strategies/java-add-snapshot.js +53 -0
- package/build/src/versioning-strategies/java-snapshot.d.ts +9 -0
- package/build/src/versioning-strategies/java-snapshot.js +67 -0
- package/build/src/versioning-strategies/service-pack.d.ts +7 -0
- package/build/src/versioning-strategies/service-pack.js +40 -0
- package/build/src/versioning-strategy.d.ts +28 -0
- package/build/src/versioning-strategy.js +55 -0
- package/package.json +9 -8
- package/build/src/constants.d.ts +0 -6
- package/build/src/constants.js +0 -23
- package/build/src/conventional-commits.d.ts +0 -53
- package/build/src/conventional-commits.js +0 -167
- package/build/src/github-release.d.ts +0 -34
- package/build/src/github-release.js +0 -92
- package/build/src/graphql-to-commits.d.ts +0 -60
- package/build/src/graphql-to-commits.js +0 -112
- package/build/src/index.d.ts +0 -94
- package/build/src/index.js +0 -32
- package/build/src/plugins/index.d.ts +0 -5
- package/build/src/plugins/plugin.d.ts +0 -21
- package/build/src/release-pr.d.ts +0 -101
- package/build/src/release-pr.js +0 -461
- package/build/src/releasers/elixir.d.ts +0 -5
- package/build/src/releasers/go-yoshi.d.ts +0 -10
- package/build/src/releasers/go-yoshi.js +0 -162
- package/build/src/releasers/go.d.ts +0 -6
- package/build/src/releasers/helm.d.ts +0 -9
- package/build/src/releasers/helm.js +0 -66
- package/build/src/releasers/index.d.ts +0 -7
- package/build/src/releasers/index.js +0 -72
- package/build/src/releasers/java/bump_type.d.ts +0 -4
- package/build/src/releasers/java/bump_type.js +0 -38
- package/build/src/releasers/java/stability.d.ts +0 -5
- package/build/src/releasers/java/stability.js +0 -37
- package/build/src/releasers/java/version.d.ts +0 -13
- package/build/src/releasers/java/version.js +0 -112
- package/build/src/releasers/java-bom.d.ts +0 -16
- package/build/src/releasers/java-bom.js +0 -83
- package/build/src/releasers/java-lts.d.ts +0 -9
- package/build/src/releasers/java-lts.js +0 -47
- package/build/src/releasers/java-yoshi.d.ts +0 -28
- package/build/src/releasers/java-yoshi.js +0 -304
- package/build/src/releasers/krm-blueprint.d.ts +0 -6
- package/build/src/releasers/node.d.ts +0 -10
- package/build/src/releasers/node.js +0 -84
- package/build/src/releasers/ocaml.d.ts +0 -5
- package/build/src/releasers/php-yoshi.d.ts +0 -5
- package/build/src/releasers/php-yoshi.js +0 -191
- package/build/src/releasers/php.d.ts +0 -7
- package/build/src/releasers/python.d.ts +0 -11
- package/build/src/releasers/python.js +0 -127
- package/build/src/releasers/ruby-yoshi.d.ts +0 -5
- package/build/src/releasers/ruby-yoshi.js +0 -142
- package/build/src/releasers/ruby.d.ts +0 -11
- package/build/src/releasers/rust.d.ts +0 -30
- package/build/src/releasers/rust.js +0 -163
- package/build/src/releasers/simple.d.ts +0 -5
- package/build/src/releasers/terraform-module.d.ts +0 -6
- package/build/src/updaters/elixir-mix-exs.d.ts +0 -13
- package/build/src/updaters/java/google-utils.d.ts +0 -13
- package/build/src/updaters/java/java_update.d.ts +0 -13
- package/build/src/updaters/java/pom-xml.d.ts +0 -3
- package/build/src/updaters/java/readme.d.ts +0 -3
- package/build/src/updaters/java/readme.js.map +0 -1
- package/build/src/updaters/package-json.d.ts +0 -16
- package/build/src/updaters/package-lock-json.d.ts +0 -7
- package/build/src/updaters/php-client-version.d.ts +0 -13
- package/build/src/updaters/php-manifest.d.ts +0 -13
- package/build/src/updaters/root-composer-update-package.d.ts +0 -13
- package/build/src/updaters/root-composer-update-package.js +0 -45
- package/build/src/updaters/root-composer-update-packages.d.ts +0 -13
- package/build/src/updaters/samples-package-json.d.ts +0 -13
- package/build/src/updaters/update.d.ts +0 -20
- package/build/src/updaters/version-rb.d.ts +0 -13
- package/build/src/updaters/version-txt.d.ts +0 -12
- package/build/src/updaters/version.d.ts +0 -13
- package/build/src/updaters/version.js +0 -31
- package/build/src/util/checkpoint.d.ts +0 -6
- package/build/src/util/checkpoint.js +0 -33
- package/build/src/util/release-notes.d.ts +0 -7
- package/build/src/util/release-notes.js +0 -34
- package/build/src/util/to-conventional-changelog-format.d.ts +0 -2
|
@@ -13,370 +13,289 @@
|
|
|
13
13
|
// See the License for the specific language governing permissions and
|
|
14
14
|
// limitations under the License.
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const cargo_lock_1 = require("../updaters/rust/cargo-lock");
|
|
21
|
-
const cargo_toml_1 = require("../updaters/rust/cargo-toml");
|
|
16
|
+
exports.CargoWorkspace = void 0;
|
|
17
|
+
const manifest_1 = require("../manifest");
|
|
18
|
+
const logger_1 = require("../util/logger");
|
|
19
|
+
const workspace_1 = require("./workspace");
|
|
22
20
|
const common_1 = require("../updaters/rust/common");
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
const version_1 = require("../version");
|
|
22
|
+
const cargo_toml_1 = require("../updaters/rust/cargo-toml");
|
|
23
|
+
const raw_content_1 = require("../updaters/raw-content");
|
|
24
|
+
const changelog_1 = require("../updaters/changelog");
|
|
25
|
+
const pull_request_title_1 = require("../util/pull-request-title");
|
|
26
|
+
const pull_request_body_1 = require("../util/pull-request-body");
|
|
27
|
+
const branch_name_1 = require("../util/branch-name");
|
|
28
|
+
/**
|
|
29
|
+
* The plugin analyzed a cargo workspace and will bump dependencies
|
|
30
|
+
* of managed packages if those dependencies are being updated.
|
|
31
|
+
*
|
|
32
|
+
* If multiple rust packages are being updated, it will merge them
|
|
33
|
+
* into a single rust package.
|
|
34
|
+
*/
|
|
35
|
+
class CargoWorkspace extends workspace_1.WorkspacePlugin {
|
|
36
|
+
constructor(github, targetBranch, repositoryConfig, options = {}) {
|
|
37
|
+
super(github, targetBranch, repositoryConfig, {
|
|
38
|
+
...options,
|
|
39
|
+
updateAllPackages: true,
|
|
40
|
+
});
|
|
29
41
|
}
|
|
30
|
-
async
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
async buildAllPackages(candidates) {
|
|
43
|
+
var _a, _b, _c, _d;
|
|
44
|
+
const cargoManifestContent = await this.github.getFileContentsOnBranch('Cargo.toml', this.targetBranch);
|
|
45
|
+
const cargoManifest = common_1.parseCargoManifest(cargoManifestContent.parsedContent);
|
|
46
|
+
if (!((_a = cargoManifest.workspace) === null || _a === void 0 ? void 0 : _a.members)) {
|
|
47
|
+
logger_1.logger.warn("cargo-workspace plugin used, but top-level Cargo.toml isn't a cargo workspace");
|
|
48
|
+
return { allPackages: [], candidatesByPackage: {} };
|
|
37
49
|
}
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
const allCrates = [];
|
|
51
|
+
const candidatesByPackage = {};
|
|
52
|
+
for (const path of cargoManifest.workspace.members) {
|
|
53
|
+
const manifestPath = addPath(path, 'Cargo.toml');
|
|
54
|
+
logger_1.logger.info(`looking for candidate with path: ${path}`);
|
|
55
|
+
const candidate = candidates.find(c => c.path === path);
|
|
56
|
+
// get original content of the crate
|
|
57
|
+
const manifestContent = ((_b = candidate === null || candidate === void 0 ? void 0 : candidate.pullRequest.updates.find(update => update.path === manifestPath)) === null || _b === void 0 ? void 0 : _b.cachedFileContents) ||
|
|
58
|
+
(await this.github.getFileContentsOnBranch(manifestPath, this.targetBranch));
|
|
59
|
+
const manifest = common_1.parseCargoManifest(manifestContent.parsedContent);
|
|
60
|
+
const packageName = (_c = manifest.package) === null || _c === void 0 ? void 0 : _c.name;
|
|
61
|
+
if (!packageName) {
|
|
62
|
+
throw new Error(`package manifest at ${manifestPath} is missing [package.name]`);
|
|
47
63
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// Try to upgrade /all/ packages, even those release-please did not bump
|
|
51
|
-
for (const crate of orderedCrates) {
|
|
52
|
-
// This should update all the dependencies that have been bumped by release-please
|
|
53
|
-
const dependencyUpdates = new cargo_toml_1.CargoToml({
|
|
54
|
-
path: crate.manifestPath,
|
|
55
|
-
changelogEntry: 'updating dependencies',
|
|
56
|
-
version: 'unused',
|
|
57
|
-
versions,
|
|
58
|
-
packageName: 'unused',
|
|
59
|
-
});
|
|
60
|
-
let newContent = dependencyUpdates.updateContent(crate.manifestContent);
|
|
61
|
-
if (newContent === crate.manifestContent) {
|
|
62
|
-
// guess that package didn't depend on any of the bumped packages
|
|
63
|
-
continue;
|
|
64
|
+
if (candidate) {
|
|
65
|
+
candidatesByPackage[packageName] = candidate;
|
|
64
66
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
};
|
|
69
|
-
if (crate.manifestPkg) {
|
|
70
|
-
// package was already bumped by release-please, just update the change
|
|
71
|
-
// to also include dependency updates.
|
|
72
|
-
crate.manifestPkg.prData.changes.set(crate.manifestPath, updatedManifest);
|
|
73
|
-
await this.setChangelogEntry(crate.manifestPkg.config, crate.manifestPkg.prData.changes, crate.manifestContent, updatedManifest.content // bug if undefined
|
|
74
|
-
);
|
|
67
|
+
const version = (_d = manifest.package) === null || _d === void 0 ? void 0 : _d.version;
|
|
68
|
+
if (!version) {
|
|
69
|
+
throw new Error(`package manifest at ${manifestPath} is missing [package.version]`);
|
|
75
70
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
71
|
+
allCrates.push({
|
|
72
|
+
path,
|
|
73
|
+
name: packageName,
|
|
74
|
+
version,
|
|
75
|
+
manifest,
|
|
76
|
+
manifestContent: manifestContent.parsedContent,
|
|
77
|
+
manifestPath,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
allPackages: allCrates,
|
|
82
|
+
candidatesByPackage,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
bumpVersion(pkg) {
|
|
86
|
+
const version = version_1.Version.parse(pkg.version);
|
|
87
|
+
version.patch += 1;
|
|
88
|
+
return version;
|
|
89
|
+
}
|
|
90
|
+
updateCandidate(existingCandidate, pkg, updatedVersions) {
|
|
91
|
+
const version = updatedVersions.get(pkg.name);
|
|
92
|
+
if (!version) {
|
|
93
|
+
throw new Error(`Didn't find updated version for ${pkg.name}`);
|
|
94
|
+
}
|
|
95
|
+
const updater = new cargo_toml_1.CargoToml({
|
|
96
|
+
version,
|
|
97
|
+
versionsMap: updatedVersions,
|
|
98
|
+
});
|
|
99
|
+
const updatedContent = updater.updateContent(pkg.manifestContent);
|
|
100
|
+
const originalManifest = common_1.parseCargoManifest(pkg.manifestContent);
|
|
101
|
+
const updatedManifest = common_1.parseCargoManifest(updatedContent);
|
|
102
|
+
const dependencyNotes = getChangelogDepsNotes(originalManifest, updatedManifest);
|
|
103
|
+
existingCandidate.pullRequest.updates =
|
|
104
|
+
existingCandidate.pullRequest.updates.map(update => {
|
|
105
|
+
if (update.path === addPath(existingCandidate.path, 'Cargo.toml')) {
|
|
106
|
+
update.updater = new raw_content_1.RawContent(updatedContent);
|
|
84
107
|
}
|
|
85
|
-
else {
|
|
86
|
-
|
|
108
|
+
else if (update.updater instanceof changelog_1.Changelog) {
|
|
109
|
+
update.updater.changelogEntry = appendDependenciesSectionToChangelog(update.updater.changelogEntry, dependencyNotes);
|
|
87
110
|
}
|
|
88
|
-
|
|
89
|
-
versions.set(crate.name, version);
|
|
90
|
-
newContent = dependencyUpdates.updateContent(crate.manifestContent);
|
|
91
|
-
updatedManifest = {
|
|
92
|
-
content: newContent,
|
|
93
|
-
mode: '100644',
|
|
94
|
-
};
|
|
95
|
-
const changes = new Map([[crate.manifestPath, updatedManifest]]);
|
|
96
|
-
newManifestVersions.set(crate.path, version);
|
|
97
|
-
const manifestPkg = {
|
|
98
|
-
config: {
|
|
99
|
-
releaseType: 'rust',
|
|
100
|
-
packageName: crate.name,
|
|
101
|
-
path: crate.path,
|
|
102
|
-
},
|
|
103
|
-
prData: {
|
|
104
|
-
changes,
|
|
105
|
-
version,
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
pkgsWithPRData.push(manifestPkg);
|
|
109
|
-
await this.setChangelogEntry(manifestPkg.config, manifestPkg.prData.changes, crate.manifestContent, updatedManifest.content // bug if undefined
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
// Upgrade package.lock
|
|
114
|
-
{
|
|
115
|
-
const lockfilePath = 'Cargo.lock';
|
|
116
|
-
const dependencyUpdates = new cargo_lock_1.CargoLock({
|
|
117
|
-
path: lockfilePath,
|
|
118
|
-
changelogEntry: 'updating cargo lockfile',
|
|
119
|
-
version: 'unused',
|
|
120
|
-
versions,
|
|
121
|
-
packageName: 'unused',
|
|
111
|
+
return update;
|
|
122
112
|
});
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
],
|
|
135
|
-
]);
|
|
136
|
-
pkgsWithPRData.push({
|
|
137
|
-
config: {
|
|
138
|
-
path: '.',
|
|
139
|
-
packageName: 'cargo workspace',
|
|
140
|
-
releaseType: 'rust',
|
|
141
|
-
},
|
|
142
|
-
prData: {
|
|
143
|
-
changes,
|
|
144
|
-
version: 'lockfile maintenance',
|
|
145
|
-
},
|
|
113
|
+
// append dependency notes
|
|
114
|
+
if (dependencyNotes) {
|
|
115
|
+
if (existingCandidate.pullRequest.body.releaseData.length > 0) {
|
|
116
|
+
existingCandidate.pullRequest.body.releaseData[0].notes =
|
|
117
|
+
appendDependenciesSectionToChangelog(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
existingCandidate.pullRequest.body.releaseData.push({
|
|
121
|
+
component: pkg.name,
|
|
122
|
+
version: existingCandidate.pullRequest.version,
|
|
123
|
+
notes: appendDependenciesSectionToChangelog('', dependencyNotes),
|
|
146
124
|
});
|
|
147
125
|
}
|
|
148
126
|
}
|
|
149
|
-
return
|
|
127
|
+
return existingCandidate;
|
|
150
128
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const depUpdateNotes = this.getChangelogDepsNotes(originalManifest, updatedManifest);
|
|
156
|
-
if (!depUpdateNotes) {
|
|
157
|
-
return;
|
|
129
|
+
newCandidate(pkg, updatedVersions) {
|
|
130
|
+
const version = updatedVersions.get(pkg.name);
|
|
131
|
+
if (!version) {
|
|
132
|
+
throw new Error(`Didn't find updated version for ${pkg.name}`);
|
|
158
133
|
}
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
134
|
+
const updater = new cargo_toml_1.CargoToml({
|
|
135
|
+
version,
|
|
136
|
+
versionsMap: updatedVersions,
|
|
137
|
+
});
|
|
138
|
+
const updatedContent = updater.updateContent(pkg.manifestContent);
|
|
139
|
+
const originalManifest = common_1.parseCargoManifest(pkg.manifestContent);
|
|
140
|
+
const updatedManifest = common_1.parseCargoManifest(updatedContent);
|
|
141
|
+
const dependencyNotes = getChangelogDepsNotes(originalManifest, updatedManifest);
|
|
142
|
+
const pullRequest = {
|
|
143
|
+
title: pull_request_title_1.PullRequestTitle.ofTargetBranch(this.targetBranch),
|
|
144
|
+
body: new pull_request_body_1.PullRequestBody([
|
|
145
|
+
{
|
|
146
|
+
component: pkg.name,
|
|
147
|
+
version,
|
|
148
|
+
notes: appendDependenciesSectionToChangelog('', dependencyNotes),
|
|
149
|
+
},
|
|
150
|
+
]),
|
|
151
|
+
updates: [
|
|
162
152
|
{
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
153
|
+
path: addPath(pkg.path, 'Cargo.toml'),
|
|
154
|
+
createIfMissing: false,
|
|
155
|
+
updater: new raw_content_1.RawContent(updatedContent),
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
path: addPath(pkg.path, 'CHANGELOG.md'),
|
|
159
|
+
createIfMissing: false,
|
|
160
|
+
updater: new changelog_1.Changelog({
|
|
161
|
+
version,
|
|
162
|
+
changelogEntry: dependencyNotes,
|
|
163
|
+
}),
|
|
166
164
|
},
|
|
167
165
|
],
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
let tagPrefix = config.packageName;
|
|
173
|
-
tagPrefix += '-v';
|
|
174
|
-
const originalVersion = (_b = (_a = originalManifest.package) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : '?';
|
|
175
|
-
const updatedVersion = (_d = (_c = updatedManifest.package) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : '?';
|
|
176
|
-
let changelogEntry = await cc.generateChangelogEntry({
|
|
177
|
-
version: updatedVersion,
|
|
178
|
-
currentTag: tagPrefix + updatedVersion,
|
|
179
|
-
previousTag: tagPrefix + originalVersion,
|
|
180
|
-
});
|
|
181
|
-
changelogEntry += depUpdateNotes;
|
|
182
|
-
let updatedChangelog;
|
|
183
|
-
let changelogPath = (_e = config.changelogPath) !== null && _e !== void 0 ? _e : 'CHANGELOG.md';
|
|
184
|
-
if (config.path !== '.') {
|
|
185
|
-
changelogPath = `${config.path}/${changelogPath}`;
|
|
186
|
-
}
|
|
187
|
-
const exChangelog = (_f = changes.get(changelogPath)) === null || _f === void 0 ? void 0 : _f.content;
|
|
188
|
-
if (exChangelog) {
|
|
189
|
-
updatedChangelog = this.updateChangelogEntry(exChangelog, changelogEntry, updatedManifest);
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
updatedChangelog = await this.newChangelogEntry(changelogEntry, changelogPath, updatedManifest);
|
|
193
|
-
}
|
|
194
|
-
if (updatedChangelog) {
|
|
195
|
-
changes.set(changelogPath, {
|
|
196
|
-
content: updatedChangelog,
|
|
197
|
-
mode: '100644',
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
getChangelogDepsNotes(originalManifest, updatedManifest) {
|
|
202
|
-
var _a;
|
|
203
|
-
let depUpdateNotes = '';
|
|
204
|
-
const depTypes = [
|
|
205
|
-
'dependencies',
|
|
206
|
-
'dev-dependencies',
|
|
207
|
-
'build-dependencies',
|
|
208
|
-
];
|
|
209
|
-
const depVer = (s) => {
|
|
210
|
-
if (s === undefined) {
|
|
211
|
-
return undefined;
|
|
212
|
-
}
|
|
213
|
-
if (typeof s === 'string') {
|
|
214
|
-
return s;
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
return s.version;
|
|
218
|
-
}
|
|
166
|
+
labels: [],
|
|
167
|
+
headRefName: branch_name_1.BranchName.ofTargetBranch(this.targetBranch).toString(),
|
|
168
|
+
version,
|
|
169
|
+
draft: false,
|
|
219
170
|
};
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return result;
|
|
171
|
+
return {
|
|
172
|
+
path: pkg.path,
|
|
173
|
+
pullRequest,
|
|
174
|
+
config: {
|
|
175
|
+
releaseType: 'rust',
|
|
176
|
+
},
|
|
229
177
|
};
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
for (const [dt, notes] of updates) {
|
|
248
|
-
depUpdateNotes += `\n * ${dt}`;
|
|
249
|
-
for (const note of notes) {
|
|
250
|
-
depUpdateNotes += note;
|
|
251
|
-
}
|
|
178
|
+
}
|
|
179
|
+
async buildGraph(allPackages) {
|
|
180
|
+
var _a, _b, _c;
|
|
181
|
+
const workspaceCrateNames = new Set(allPackages.map(crateInfo => crateInfo.name));
|
|
182
|
+
const graph = new Map();
|
|
183
|
+
for (const crateInfo of allPackages) {
|
|
184
|
+
const allDeps = Object.keys({
|
|
185
|
+
...((_a = crateInfo.manifest.dependencies) !== null && _a !== void 0 ? _a : {}),
|
|
186
|
+
...((_b = crateInfo.manifest['dev-dependencies']) !== null && _b !== void 0 ? _b : {}),
|
|
187
|
+
...((_c = crateInfo.manifest['build-dependencies']) !== null && _c !== void 0 ? _c : {}),
|
|
188
|
+
});
|
|
189
|
+
const workspaceDeps = allDeps.filter(dep => workspaceCrateNames.has(dep));
|
|
190
|
+
graph.set(crateInfo.name, {
|
|
191
|
+
deps: workspaceDeps,
|
|
192
|
+
value: crateInfo,
|
|
193
|
+
});
|
|
252
194
|
}
|
|
253
|
-
return
|
|
195
|
+
return graph;
|
|
254
196
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
197
|
+
inScope(candidate) {
|
|
198
|
+
return (candidate.config.releaseType === 'rust' &&
|
|
199
|
+
candidate.path !== manifest_1.ROOT_PROJECT_PATH);
|
|
200
|
+
}
|
|
201
|
+
packageNameFromPackage(pkg) {
|
|
202
|
+
return pkg.name;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.CargoWorkspace = CargoWorkspace;
|
|
206
|
+
function getChangelogDepsNotes(originalManifest, updatedManifest) {
|
|
207
|
+
var _a;
|
|
208
|
+
let depUpdateNotes = '';
|
|
209
|
+
const depTypes = [
|
|
210
|
+
'dependencies',
|
|
211
|
+
'dev-dependencies',
|
|
212
|
+
'build-dependencies',
|
|
213
|
+
];
|
|
214
|
+
const depVer = (s) => {
|
|
215
|
+
if (s === undefined) {
|
|
216
|
+
return undefined;
|
|
264
217
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
changelogEntry = `${before.trim()}\n\n\n${changelogEntry}\n\n${after.trim()}`;
|
|
218
|
+
if (typeof s === 'string') {
|
|
219
|
+
return s;
|
|
268
220
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
async newChangelogEntry(changelogEntry, changelogPath, updatedManifest) {
|
|
272
|
-
var _a, _b, _c, _d;
|
|
273
|
-
let changelog;
|
|
274
|
-
try {
|
|
275
|
-
changelog = (await this.gh.getFileContents(changelogPath)).parsedContent;
|
|
221
|
+
else {
|
|
222
|
+
return s.version;
|
|
276
223
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
224
|
+
};
|
|
225
|
+
const getDepMap = (cargoDeps) => {
|
|
226
|
+
const result = {};
|
|
227
|
+
for (const [key, val] of Object.entries(cargoDeps)) {
|
|
228
|
+
const ver = depVer(val);
|
|
229
|
+
if (ver) {
|
|
230
|
+
result[key] = ver;
|
|
284
231
|
}
|
|
285
232
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const manifestPkg = pkgsWithPRData.find(pkg => pkg.config.path === pkgPath);
|
|
300
|
-
// original contents of the manifest for the target package
|
|
301
|
-
const manifestContent = (_b = (_a = manifestPkg === null || manifestPkg === void 0 ? void 0 : manifestPkg.prData.changes.get(manifestPath)) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : (await this.gh.getFileContents(manifestPath)).parsedContent;
|
|
302
|
-
const manifest = await common_1.parseCargoManifest(manifestContent);
|
|
303
|
-
const pkgName = (_c = manifest.package) === null || _c === void 0 ? void 0 : _c.name;
|
|
304
|
-
if (!pkgName) {
|
|
305
|
-
throw new Error(`package manifest at ${manifestPath} is missing [package.name]`);
|
|
306
|
-
}
|
|
307
|
-
const version = (_d = manifest.package) === null || _d === void 0 ? void 0 : _d.version;
|
|
308
|
-
if (!version) {
|
|
309
|
-
throw new Error(`package manifest at ${manifestPath} is missing [package.version]`);
|
|
233
|
+
return result;
|
|
234
|
+
};
|
|
235
|
+
const updates = new Map();
|
|
236
|
+
for (const depType of depTypes) {
|
|
237
|
+
const depUpdates = [];
|
|
238
|
+
const pkgDepTypes = updatedManifest[depType];
|
|
239
|
+
if (pkgDepTypes === undefined) {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
for (const [depName, currentDepVer] of Object.entries(getDepMap(pkgDepTypes))) {
|
|
243
|
+
const origDepVer = depVer((_a = originalManifest[depType]) === null || _a === void 0 ? void 0 : _a[depName]);
|
|
244
|
+
if (currentDepVer !== origDepVer) {
|
|
245
|
+
depUpdates.push(`\n * ${depName} bumped from ${origDepVer} to ${currentDepVer}`);
|
|
310
246
|
}
|
|
311
|
-
manifests.push({
|
|
312
|
-
path: pkgPath,
|
|
313
|
-
name: pkgName,
|
|
314
|
-
version,
|
|
315
|
-
manifest,
|
|
316
|
-
manifestContent,
|
|
317
|
-
manifestPath,
|
|
318
|
-
manifestPkg,
|
|
319
|
-
});
|
|
320
247
|
}
|
|
321
|
-
|
|
248
|
+
if (depUpdates.length > 0) {
|
|
249
|
+
updates.set(depType, depUpdates);
|
|
250
|
+
}
|
|
322
251
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
for (const crate of crateInfoMap.values()) {
|
|
329
|
-
const allDeps = Object.keys({
|
|
330
|
-
...((_a = crate.manifest.dependencies) !== null && _a !== void 0 ? _a : {}),
|
|
331
|
-
...((_b = crate.manifest['dev-dependencies']) !== null && _b !== void 0 ? _b : {}),
|
|
332
|
-
...((_c = crate.manifest['build-dependencies']) !== null && _c !== void 0 ? _c : {}),
|
|
333
|
-
});
|
|
334
|
-
console.log({ allDeps });
|
|
335
|
-
const workspaceDeps = allDeps.filter(dep => crateInfoMap.has(dep));
|
|
336
|
-
graph.set(crate.name, {
|
|
337
|
-
name: crate.name,
|
|
338
|
-
deps: workspaceDeps,
|
|
339
|
-
});
|
|
252
|
+
for (const [dt, notes] of updates) {
|
|
253
|
+
depUpdateNotes += `\n * ${dt}`;
|
|
254
|
+
for (const note of notes) {
|
|
255
|
+
depUpdateNotes += note;
|
|
256
|
+
}
|
|
340
257
|
}
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Given a list of graph nodes that form a DAG, returns the node names in
|
|
345
|
-
* post-order (reverse depth-first), suitable for dependency updates and bumping.
|
|
346
|
-
*/
|
|
347
|
-
function postOrder(graph) {
|
|
348
|
-
const result = [];
|
|
349
|
-
const resultSet = new Set();
|
|
350
|
-
// we're iterating the `Map` in insertion order (as per ECMA262), but
|
|
351
|
-
// that does not reflect any particular traversal of the graph, so we
|
|
352
|
-
// visit all nodes, opportunistically short-circuiting leafs when we've
|
|
353
|
-
// already visited them.
|
|
354
|
-
for (const node of graph.values()) {
|
|
355
|
-
visitPostOrder(graph, node, result, resultSet, []);
|
|
258
|
+
if (depUpdateNotes) {
|
|
259
|
+
return `* The following workspace dependencies were updated${depUpdateNotes}`;
|
|
356
260
|
}
|
|
357
|
-
return
|
|
261
|
+
return '';
|
|
358
262
|
}
|
|
359
|
-
|
|
360
|
-
function
|
|
361
|
-
if (
|
|
362
|
-
return
|
|
363
|
-
}
|
|
364
|
-
if (path.indexOf(node.name) !== -1) {
|
|
365
|
-
throw new Error(`found cycle in dependency graph: ${path.join(' -> ')} -> ${node.name}`);
|
|
263
|
+
const DEPENDENCY_HEADER = new RegExp('### Dependencies');
|
|
264
|
+
function appendDependenciesSectionToChangelog(changelog, notes) {
|
|
265
|
+
if (!changelog) {
|
|
266
|
+
return `### Dependencies\n\n${notes}`;
|
|
366
267
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
268
|
+
const newLines = [];
|
|
269
|
+
let seenDependenciesSection = false;
|
|
270
|
+
let seenDependencySectionSpacer = false;
|
|
271
|
+
let injected = false;
|
|
272
|
+
for (const line of changelog.split('\n')) {
|
|
273
|
+
if (seenDependenciesSection) {
|
|
274
|
+
const trimmedLine = line.trim();
|
|
275
|
+
if (seenDependencySectionSpacer &&
|
|
276
|
+
!injected &&
|
|
277
|
+
!trimmedLine.startsWith('*')) {
|
|
278
|
+
newLines.push(changelog);
|
|
279
|
+
injected = true;
|
|
280
|
+
}
|
|
281
|
+
if (trimmedLine === '') {
|
|
282
|
+
seenDependencySectionSpacer = true;
|
|
373
283
|
}
|
|
374
|
-
visitPostOrder(graph, dep, result, resultSet, nextPath);
|
|
375
284
|
}
|
|
285
|
+
if (line.match(DEPENDENCY_HEADER)) {
|
|
286
|
+
seenDependenciesSection = true;
|
|
287
|
+
}
|
|
288
|
+
newLines.push(line);
|
|
289
|
+
}
|
|
290
|
+
if (injected) {
|
|
291
|
+
return newLines.join('\n');
|
|
376
292
|
}
|
|
377
|
-
if (
|
|
378
|
-
|
|
379
|
-
result.push(node.name);
|
|
293
|
+
if (seenDependenciesSection) {
|
|
294
|
+
return `${changelog}\n${notes}`;
|
|
380
295
|
}
|
|
296
|
+
return `${changelog}\n\n\n### Dependencies\n\n${notes}`;
|
|
297
|
+
}
|
|
298
|
+
function addPath(path, file) {
|
|
299
|
+
return path === manifest_1.ROOT_PROJECT_PATH ? file : `${path}/${file}`;
|
|
381
300
|
}
|
|
382
301
|
//# sourceMappingURL=cargo-workspace.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ManifestPlugin } from '../plugin';
|
|
2
|
+
import { CandidateReleasePullRequest } from '../manifest';
|
|
3
|
+
/**
|
|
4
|
+
* This plugin merges multiple pull requests into a single
|
|
5
|
+
* release pull request.
|
|
6
|
+
*
|
|
7
|
+
* Release notes are broken up using `<summary>`/`<details>` blocks.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Merge extends ManifestPlugin {
|
|
10
|
+
run(candidates: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
|
|
11
|
+
}
|