release-please 12.5.0 → 13.0.0-candidate.2
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 +7 -0
- package/README.md +4 -0
- package/build/src/bin/release-please.d.ts +55 -11
- package/build/src/bin/release-please.js +419 -152
- package/build/src/bootstrapper.d.ts +12 -0
- package/build/src/bootstrapper.js +60 -0
- package/build/src/changelog-notes/default.d.ts +17 -0
- package/build/src/changelog-notes/default.js +72 -0
- package/build/src/changelog-notes.d.ts +17 -0
- package/build/src/{updaters/java/readme.js → changelog-notes.js} +2 -7
- 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 +160 -150
- package/build/src/github.d.ts +154 -884
- package/build/src/github.js +608 -1036
- package/build/src/manifest.d.ts +191 -47
- package/build/src/manifest.js +599 -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/pom-xml.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/release-pull-request.js +16 -0
- 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 +10 -0
- package/build/src/strategies/php-yoshi.js +213 -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 +100 -0
- package/build/src/strategy.js +233 -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/{pubspec-yaml.js → dart/pubspec-yaml.js} +13 -12
- 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/dart.d.ts +0 -9
- package/build/src/releasers/dart.js +0 -65
- 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 -76
- 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-backport.d.ts +0 -9
- package/build/src/releasers/java-backport.js +0 -43
- 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/pubspec-yaml.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,17 +13,19 @@
|
|
|
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
|
-
|
|
17
|
-
const cu = require("@lerna/collect-updates");
|
|
18
|
-
const package_1 = require("@lerna/package");
|
|
16
|
+
exports.NodeWorkspace = void 0;
|
|
19
17
|
const package_graph_1 = require("@lerna/package-graph");
|
|
20
|
-
const
|
|
21
|
-
const
|
|
18
|
+
const package_1 = require("@lerna/package");
|
|
19
|
+
const logger_1 = require("../util/logger");
|
|
20
|
+
const manifest_1 = require("../manifest");
|
|
21
|
+
const version_1 = require("../version");
|
|
22
|
+
const raw_content_1 = require("../updaters/raw-content");
|
|
23
|
+
const pull_request_title_1 = require("../util/pull-request-title");
|
|
24
|
+
const pull_request_body_1 = require("../util/pull-request-body");
|
|
25
|
+
const branch_name_1 = require("../util/branch-name");
|
|
22
26
|
const json_stringify_1 = require("../util/json-stringify");
|
|
23
|
-
const checkpoint_1 = require("../util/checkpoint");
|
|
24
|
-
const constants_1 = require("../constants");
|
|
25
|
-
const conventional_commits_1 = require("../conventional-commits");
|
|
26
27
|
const changelog_1 = require("../updaters/changelog");
|
|
28
|
+
const workspace_1 = require("./workspace");
|
|
27
29
|
class Package extends package_1.Package {
|
|
28
30
|
constructor(rawContent, location, pkg) {
|
|
29
31
|
super(pkg !== null && pkg !== void 0 ? pkg : JSON.parse(rawContent), location);
|
|
@@ -33,301 +35,262 @@ class Package extends package_1.Package {
|
|
|
33
35
|
return new Package(this.rawContent, this.location, this.toJSON());
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return pathPkgs;
|
|
38
|
+
/**
|
|
39
|
+
* The plugin analyzed a cargo workspace and will bump dependencies
|
|
40
|
+
* of managed packages if those dependencies are being updated.
|
|
41
|
+
*
|
|
42
|
+
* If multiple node packages are being updated, it will merge them
|
|
43
|
+
* into a single node package.
|
|
44
|
+
*/
|
|
45
|
+
class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
|
46
|
+
constructor(github, targetBranch, repositoryConfig, options = {}) {
|
|
47
|
+
super(github, targetBranch, repositoryConfig, options);
|
|
48
|
+
this.alwaysLinkLocal = options.alwaysLinkLocal === false ? false : true;
|
|
51
49
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
async buildAllPackages(candidates) {
|
|
51
|
+
const candidatesByPath = new Map();
|
|
52
|
+
for (const candidate of candidates) {
|
|
53
|
+
candidatesByPath.set(candidate.path, candidate);
|
|
54
|
+
}
|
|
55
|
+
const candidatesByPackage = {};
|
|
56
|
+
const packagesByPath = new Map();
|
|
57
|
+
for (const path in this.repositoryConfig) {
|
|
58
|
+
const config = this.repositoryConfig[path];
|
|
59
|
+
if (config.releaseType !== 'node') {
|
|
58
60
|
continue;
|
|
59
61
|
}
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const candidate = candidatesByPath.get(path);
|
|
63
|
+
if (candidate) {
|
|
64
|
+
logger_1.logger.debug(`Found candidate pull request for path: ${candidate.path}`);
|
|
65
|
+
const packagePath = addPath(candidate.path, 'package.json');
|
|
66
|
+
const packageUpdate = candidate.pullRequest.updates.find(update => update.path === packagePath);
|
|
67
|
+
if (packageUpdate === null || packageUpdate === void 0 ? void 0 : packageUpdate.cachedFileContents) {
|
|
68
|
+
const pkg = new Package(packageUpdate.cachedFileContents.parsedContent, candidate.path);
|
|
69
|
+
packagesByPath.set(candidate.path, pkg);
|
|
70
|
+
candidatesByPackage[pkg.name] = candidate;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const contents = await this.github.getFileContentsOnBranch(packagePath, this.targetBranch);
|
|
74
|
+
const pkg = new Package(contents.parsedContent, candidate.path);
|
|
75
|
+
packagesByPath.set(candidate.path, pkg);
|
|
76
|
+
candidatesByPackage[pkg.name] = candidate;
|
|
77
|
+
}
|
|
65
78
|
}
|
|
66
79
|
else {
|
|
67
|
-
const
|
|
68
|
-
|
|
80
|
+
const packagePath = addPath(path, 'package.json');
|
|
81
|
+
logger_1.logger.debug(`No candidate pull request for path: ${path} - inspect package from ${packagePath}`);
|
|
82
|
+
const contents = await this.github.getFileContentsOnBranch(packagePath, this.targetBranch);
|
|
83
|
+
packagesByPath.set(path, new Package(contents.parsedContent, path));
|
|
69
84
|
}
|
|
70
|
-
this.log(`loaded ${path} from ${alreadyUpdated ? 'existing changes' : 'github'}`, checkpoint_1.CheckpointType.Success);
|
|
71
|
-
nodePkgs.set(path, new Package(contents, path));
|
|
72
85
|
}
|
|
73
|
-
|
|
86
|
+
const allPackages = Array.from(packagesByPath.values());
|
|
87
|
+
this.packageGraph = new package_graph_1.PackageGraph(allPackages, 'allDependencies', this.alwaysLinkLocal);
|
|
88
|
+
return {
|
|
89
|
+
allPackages,
|
|
90
|
+
candidatesByPackage,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
bumpVersion(pkg) {
|
|
94
|
+
const version = version_1.Version.parse(pkg.version);
|
|
95
|
+
version.patch += 1;
|
|
96
|
+
return version;
|
|
74
97
|
}
|
|
75
|
-
|
|
98
|
+
updateCandidate(existingCandidate, pkg, updatedVersions) {
|
|
76
99
|
var _a;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
// packages as they need to be patch bumped.
|
|
88
|
-
const isCandidate = (node) => rpUpdatedPkgs.has(node.location);
|
|
89
|
-
const updatesWithDependents = cu.collectPackages(packageGraph, {
|
|
90
|
-
isCandidate,
|
|
91
|
-
onInclude: name => this.log(`${name} collected for update (dependency-only = ${!isCandidate(packageGraph.get(name))})`, checkpoint_1.CheckpointType.Success),
|
|
92
|
-
excludeDependents: false,
|
|
93
|
-
});
|
|
94
|
-
// our implementation of producing a Map<pkgName, newVersion> similar to
|
|
95
|
-
// `this.updatesVersions` which is used to set updated package
|
|
96
|
-
// (https://git.io/JqfD7) and dependency (https://git.io/JqU3q) versions
|
|
97
|
-
//
|
|
98
|
-
// `lerna version` accomplishes this with:
|
|
99
|
-
// `getVersionsForUpdates` (https://git.io/JqfyI)
|
|
100
|
-
// -> `getVersion` + `reduceVersions` (https://git.io/JqfDI)
|
|
101
|
-
const updatesVersions = new Map();
|
|
102
|
-
const invalidVersions = new Set();
|
|
103
|
-
for (const node of updatesWithDependents) {
|
|
104
|
-
let version;
|
|
105
|
-
let source;
|
|
106
|
-
if (rpUpdatedPkgs.has(node.location)) {
|
|
107
|
-
version = node.version;
|
|
108
|
-
source = constants_1.RELEASE_PLEASE;
|
|
100
|
+
const graphPackage = (_a = this.packageGraph) === null || _a === void 0 ? void 0 : _a.get(pkg.name);
|
|
101
|
+
if (!graphPackage) {
|
|
102
|
+
throw new Error(`Could not find graph package for ${pkg.name}`);
|
|
103
|
+
}
|
|
104
|
+
const updatedPackage = pkg.clone();
|
|
105
|
+
for (const [depName, resolved] of graphPackage.localDependencies) {
|
|
106
|
+
const depVersion = updatedVersions.get(depName);
|
|
107
|
+
if (depVersion && resolved.type !== 'directory') {
|
|
108
|
+
updatedPackage.updateLocalDependency(resolved, depVersion.toString(), '^');
|
|
109
|
+
logger_1.logger.info(`${pkg.name}.${depName} updated to ^${depVersion.toString()}`);
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.log(`Checking node "${node.location}" against parsed package "${pkgPath}"`, match ? checkpoint_1.CheckpointType.Success : checkpoint_1.CheckpointType.Failure);
|
|
117
|
-
return match;
|
|
118
|
-
});
|
|
119
|
-
if (!pkgConfig) {
|
|
120
|
-
this.log(`No pkgConfig found for ${node.location}`, checkpoint_1.CheckpointType.Failure);
|
|
121
|
-
}
|
|
122
|
-
else if (!pkgConfig.releaseAs) {
|
|
123
|
-
this.log(`No pkgConfig.releaseAs for ${node.location}`, checkpoint_1.CheckpointType.Failure);
|
|
111
|
+
}
|
|
112
|
+
const dependencyNotes = getChangelogDepsNotes(pkg, updatedPackage);
|
|
113
|
+
existingCandidate.pullRequest.updates =
|
|
114
|
+
existingCandidate.pullRequest.updates.map(update => {
|
|
115
|
+
if (update.path === addPath(existingCandidate.path, 'package.json')) {
|
|
116
|
+
update.updater = new raw_content_1.RawContent(json_stringify_1.jsonStringify(updatedPackage.toJSON(), updatedPackage.rawContent));
|
|
124
117
|
}
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
source = 'release-as configuration';
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
const patch = semver.inc(node.version, 'patch');
|
|
131
|
-
if (patch === null) {
|
|
132
|
-
this.log(`Don't know how to patch ${node.name}'s version(${node.version})`, checkpoint_1.CheckpointType.Failure);
|
|
133
|
-
invalidVersions.add(node.name);
|
|
134
|
-
version = node.version;
|
|
135
|
-
source = 'failed to patch bump';
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
version = patch;
|
|
139
|
-
source = 'dependency bump';
|
|
140
|
-
}
|
|
118
|
+
else if (update.updater instanceof changelog_1.Changelog) {
|
|
119
|
+
update.updater.changelogEntry = appendDependenciesSectionToChangelog(update.updater.changelogEntry, dependencyNotes);
|
|
141
120
|
}
|
|
121
|
+
return update;
|
|
122
|
+
});
|
|
123
|
+
// append dependency notes
|
|
124
|
+
if (dependencyNotes) {
|
|
125
|
+
if (existingCandidate.pullRequest.body.releaseData.length > 0) {
|
|
126
|
+
existingCandidate.pullRequest.body.releaseData[0].notes =
|
|
127
|
+
appendDependenciesSectionToChangelog(existingCandidate.pullRequest.body.releaseData[0].notes, dependencyNotes);
|
|
142
128
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
pkg.set('version', updatesVersions.get(pkg.name));
|
|
150
|
-
const graphPkg = packageGraph.get(pkg.name);
|
|
151
|
-
for (const [depName, resolved] of graphPkg.localDependencies) {
|
|
152
|
-
const depVersion = updatesVersions.get(depName);
|
|
153
|
-
if (depVersion && resolved.type !== 'directory') {
|
|
154
|
-
pkg.updateLocalDependency(resolved, depVersion, '^');
|
|
155
|
-
this.log(`${pkg.name}.${depName} updated to ^${depVersion}`, checkpoint_1.CheckpointType.Success);
|
|
156
|
-
}
|
|
129
|
+
else {
|
|
130
|
+
existingCandidate.pullRequest.body.releaseData.push({
|
|
131
|
+
component: updatedPackage.name,
|
|
132
|
+
version: existingCandidate.pullRequest.version,
|
|
133
|
+
notes: appendDependenciesSectionToChangelog('', dependencyNotes),
|
|
134
|
+
});
|
|
157
135
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
// https://git.io/Jqfyp
|
|
161
|
-
const allUpdated = (await run_topologically_1.runTopologically(updatesWithDependents.map(node => node.pkg), runner, {
|
|
162
|
-
graphType: 'allDependencies',
|
|
163
|
-
concurrency: 1,
|
|
164
|
-
rejectCycles: false,
|
|
165
|
-
}));
|
|
166
|
-
return new Map(allUpdated.map(p => [p.location, p]));
|
|
136
|
+
}
|
|
137
|
+
return existingCandidate;
|
|
167
138
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
139
|
+
newCandidate(pkg, updatedVersions) {
|
|
140
|
+
var _a;
|
|
141
|
+
const graphPackage = (_a = this.packageGraph) === null || _a === void 0 ? void 0 : _a.get(pkg.name);
|
|
142
|
+
if (!graphPackage) {
|
|
143
|
+
throw new Error(`Could not find graph package for ${pkg.name}`);
|
|
144
|
+
}
|
|
145
|
+
const updatedPackage = pkg.clone();
|
|
146
|
+
for (const [depName, resolved] of graphPackage.localDependencies) {
|
|
147
|
+
const depVersion = updatedVersions.get(depName);
|
|
148
|
+
if (depVersion && resolved.type !== 'directory') {
|
|
149
|
+
updatedPackage.updateLocalDependency(resolved, depVersion.toString(), '^');
|
|
150
|
+
logger_1.logger.info(`${pkg.name}.${depName} updated to ^${depVersion.toString()}`);
|
|
174
151
|
}
|
|
175
|
-
const filePath = `${data.config.path}/package.json`;
|
|
176
|
-
const updated = allUpdated.get(filePath); // bug if not defined
|
|
177
|
-
data.prData.changes.set(filePath, {
|
|
178
|
-
content: json_stringify_1.jsonStringify(updated.toJSON(), updated.rawContent),
|
|
179
|
-
mode: '100644',
|
|
180
|
-
});
|
|
181
|
-
await this.setChangelogEntry(data.config, data.prData.changes, updated, allOrigPkgs.get(filePath).toJSON() // bug if undefined.
|
|
182
|
-
);
|
|
183
|
-
allUpdated.delete(filePath);
|
|
184
152
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
153
|
+
const dependencyNotes = getChangelogDepsNotes(pkg, updatedPackage);
|
|
154
|
+
const packageJson = updatedPackage.toJSON();
|
|
155
|
+
const version = version_1.Version.parse(packageJson.version);
|
|
156
|
+
const pullRequest = {
|
|
157
|
+
title: pull_request_title_1.PullRequestTitle.ofTargetBranch(this.targetBranch),
|
|
158
|
+
body: new pull_request_body_1.PullRequestBody([
|
|
159
|
+
{
|
|
160
|
+
component: updatedPackage.name,
|
|
161
|
+
version,
|
|
162
|
+
notes: appendDependenciesSectionToChangelog('', dependencyNotes),
|
|
163
|
+
},
|
|
164
|
+
]),
|
|
165
|
+
updates: [
|
|
166
|
+
{
|
|
167
|
+
path: addPath(updatedPackage.location, 'package.json'),
|
|
168
|
+
createIfMissing: false,
|
|
169
|
+
updater: new raw_content_1.RawContent(json_stringify_1.jsonStringify(packageJson, updatedPackage.rawContent)),
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
path: addPath(updatedPackage.location, 'CHANGELOG.md'),
|
|
173
|
+
createIfMissing: false,
|
|
174
|
+
updater: new changelog_1.Changelog({
|
|
175
|
+
version,
|
|
176
|
+
changelogEntry: dependencyNotes,
|
|
177
|
+
}),
|
|
199
178
|
},
|
|
179
|
+
],
|
|
180
|
+
labels: [],
|
|
181
|
+
headRefName: branch_name_1.BranchName.ofTargetBranch(this.targetBranch).toString(),
|
|
182
|
+
version,
|
|
183
|
+
draft: false,
|
|
184
|
+
};
|
|
185
|
+
return {
|
|
186
|
+
path: updatedPackage.location,
|
|
187
|
+
pullRequest,
|
|
188
|
+
config: {
|
|
189
|
+
releaseType: 'node',
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
async buildGraph(allPackages) {
|
|
194
|
+
var _a, _b, _c, _d;
|
|
195
|
+
const graph = new Map();
|
|
196
|
+
const workspacePackageNames = new Set(allPackages.map(packageJson => packageJson.name));
|
|
197
|
+
for (const packageJson of allPackages) {
|
|
198
|
+
const allDeps = Object.keys({
|
|
199
|
+
...((_a = packageJson.dependencies) !== null && _a !== void 0 ? _a : {}),
|
|
200
|
+
...((_b = packageJson.devDependencies) !== null && _b !== void 0 ? _b : {}),
|
|
201
|
+
...((_c = packageJson.optionalDependencies) !== null && _c !== void 0 ? _c : {}),
|
|
202
|
+
...((_d = packageJson.peerDependencies) !== null && _d !== void 0 ? _d : {}),
|
|
203
|
+
});
|
|
204
|
+
const workspaceDeps = allDeps.filter(dep => workspacePackageNames.has(dep));
|
|
205
|
+
graph.set(packageJson.name, {
|
|
206
|
+
deps: workspaceDeps,
|
|
207
|
+
value: packageJson,
|
|
200
208
|
});
|
|
201
|
-
newManifestVersions.set(filePath.replace(/\/package.json$/, ''), updated.version);
|
|
202
209
|
}
|
|
210
|
+
return graph;
|
|
203
211
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
212
|
+
inScope(candidate) {
|
|
213
|
+
return (candidate.config.releaseType === 'node' &&
|
|
214
|
+
candidate.path !== manifest_1.ROOT_PROJECT_PATH);
|
|
215
|
+
}
|
|
216
|
+
packageNameFromPackage(pkg) {
|
|
217
|
+
return pkg.name;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
exports.NodeWorkspace = NodeWorkspace;
|
|
221
|
+
function getChangelogDepsNotes(original, updated) {
|
|
222
|
+
var _a;
|
|
223
|
+
let depUpdateNotes = '';
|
|
224
|
+
const depTypes = [
|
|
225
|
+
'dependencies',
|
|
226
|
+
'devDependencies',
|
|
227
|
+
'peerDependencies',
|
|
228
|
+
'optionalDependencies',
|
|
229
|
+
];
|
|
230
|
+
const updates = new Map();
|
|
231
|
+
for (const depType of depTypes) {
|
|
232
|
+
const depUpdates = [];
|
|
233
|
+
const pkgDepTypes = updated[depType];
|
|
234
|
+
if (pkgDepTypes === undefined) {
|
|
235
|
+
continue;
|
|
229
236
|
}
|
|
230
|
-
for (const [
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
237
|
+
for (const [depName, currentDepVer] of Object.entries(pkgDepTypes)) {
|
|
238
|
+
const origDepVer = (_a = original[depType]) === null || _a === void 0 ? void 0 : _a[depName];
|
|
239
|
+
if (currentDepVer !== origDepVer) {
|
|
240
|
+
depUpdates.push(`\n * ${depName} bumped from ${origDepVer} to ${currentDepVer}`);
|
|
234
241
|
}
|
|
235
242
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
updateChangelogEntry(exChangelog, changelogEntry, pkg) {
|
|
239
|
-
changelogEntry = changelogEntry.replace(new RegExp(`^###? \\[${pkg.version}\\].*### Dependencies`, 's'), '### Dependencies');
|
|
240
|
-
const match = exChangelog.match(new RegExp(`(?<before>^.*?###? \\[${pkg.version}\\].*?\n)(?<after>###? [0-9[].*)`, 's'));
|
|
241
|
-
if (!match) {
|
|
242
|
-
this.log(`Appending update notes to end of changelog for ${pkg.name}`, checkpoint_1.CheckpointType.Failure);
|
|
243
|
-
changelogEntry = `${exChangelog}\n\n\n${changelogEntry}`;
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
const { before, after } = match.groups;
|
|
247
|
-
changelogEntry = `${before.trim()}\n\n\n${changelogEntry}\n\n${after.trim()}`;
|
|
243
|
+
if (depUpdates.length > 0) {
|
|
244
|
+
updates.set(depType, depUpdates);
|
|
248
245
|
}
|
|
249
|
-
return changelogEntry;
|
|
250
246
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
247
|
+
for (const [dt, notes] of updates) {
|
|
248
|
+
depUpdateNotes += `\n * ${dt}`;
|
|
249
|
+
for (const note of notes) {
|
|
250
|
+
depUpdateNotes += note;
|
|
255
251
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
252
|
+
}
|
|
253
|
+
if (depUpdateNotes) {
|
|
254
|
+
return `* The following workspace dependencies were updated${depUpdateNotes}`;
|
|
255
|
+
}
|
|
256
|
+
return '';
|
|
257
|
+
}
|
|
258
|
+
const DEPENDENCY_HEADER = new RegExp('### Dependencies');
|
|
259
|
+
function appendDependenciesSectionToChangelog(changelog, notes) {
|
|
260
|
+
if (!changelog) {
|
|
261
|
+
return `### Dependencies\n\n${notes}`;
|
|
262
|
+
}
|
|
263
|
+
const newLines = [];
|
|
264
|
+
let seenDependenciesSection = false;
|
|
265
|
+
let seenDependencySectionSpacer = false;
|
|
266
|
+
let injected = false;
|
|
267
|
+
for (const line of changelog.split('\n')) {
|
|
268
|
+
if (seenDependenciesSection) {
|
|
269
|
+
const trimmedLine = line.trim();
|
|
270
|
+
if (seenDependencySectionSpacer &&
|
|
271
|
+
!injected &&
|
|
272
|
+
!trimmedLine.startsWith('*')) {
|
|
273
|
+
newLines.push(changelog);
|
|
274
|
+
injected = true;
|
|
260
275
|
}
|
|
261
|
-
|
|
262
|
-
|
|
276
|
+
if (trimmedLine === '') {
|
|
277
|
+
seenDependencySectionSpacer = true;
|
|
263
278
|
}
|
|
264
279
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
changelogEntry,
|
|
268
|
-
version: pkg.version,
|
|
269
|
-
packageName: pkg.name,
|
|
270
|
-
});
|
|
271
|
-
return changelogUpdater.updateContent(changelog);
|
|
272
|
-
}
|
|
273
|
-
async setChangelogEntry(config, changes, pkg, origPkgJson) {
|
|
274
|
-
var _a, _b, _c;
|
|
275
|
-
const depUpdateNotes = this.getChangelogDepsNotes(pkg, origPkgJson);
|
|
276
|
-
if (!depUpdateNotes) {
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
const cc = new conventional_commits_1.ConventionalCommits({
|
|
280
|
-
changelogSections: [{ type: 'deps', section: 'Dependencies' }],
|
|
281
|
-
commits: [
|
|
282
|
-
{
|
|
283
|
-
sha: '',
|
|
284
|
-
message: 'deps: The following workspace dependencies were updated',
|
|
285
|
-
files: [],
|
|
286
|
-
},
|
|
287
|
-
],
|
|
288
|
-
owner: this.gh.owner,
|
|
289
|
-
repository: this.gh.repo,
|
|
290
|
-
bumpMinorPreMajor: config.bumpMinorPreMajor,
|
|
291
|
-
});
|
|
292
|
-
let tagPrefix = ((_a = config.packageName) === null || _a === void 0 ? void 0 : _a.match(/^@[\w-]+\//)) ? config.packageName.split('/')[1]
|
|
293
|
-
: config.packageName;
|
|
294
|
-
tagPrefix += '-v';
|
|
295
|
-
let changelogEntry = await cc.generateChangelogEntry({
|
|
296
|
-
version: pkg.version,
|
|
297
|
-
currentTag: tagPrefix + pkg.version,
|
|
298
|
-
previousTag: tagPrefix + origPkgJson.version,
|
|
299
|
-
});
|
|
300
|
-
changelogEntry += depUpdateNotes;
|
|
301
|
-
let updatedChangelog;
|
|
302
|
-
let changelogPath = (_b = config.changelogPath) !== null && _b !== void 0 ? _b : 'CHANGELOG.md';
|
|
303
|
-
if (config.path !== '.') {
|
|
304
|
-
changelogPath = `${config.path}/${changelogPath}`;
|
|
305
|
-
}
|
|
306
|
-
const exChangelog = (_c = changes.get(changelogPath)) === null || _c === void 0 ? void 0 : _c.content;
|
|
307
|
-
if (exChangelog) {
|
|
308
|
-
updatedChangelog = this.updateChangelogEntry(exChangelog, changelogEntry, pkg);
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
updatedChangelog = await this.newChangelogEntry(changelogEntry, changelogPath, pkg);
|
|
312
|
-
}
|
|
313
|
-
if (updatedChangelog) {
|
|
314
|
-
changes.set(changelogPath, {
|
|
315
|
-
content: updatedChangelog,
|
|
316
|
-
mode: '100644',
|
|
317
|
-
});
|
|
280
|
+
if (line.match(DEPENDENCY_HEADER)) {
|
|
281
|
+
seenDependenciesSection = true;
|
|
318
282
|
}
|
|
283
|
+
newLines.push(line);
|
|
319
284
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
* Inspired by and using a subset of the logic from `lerna version`
|
|
323
|
-
*/
|
|
324
|
-
async run(newManifestVersions, pkgsWithPRData) {
|
|
325
|
-
const rpUpdatedPkgs = this.filterPackages(pkgsWithPRData);
|
|
326
|
-
const allPkgs = await this.getAllWorkspacePackages(rpUpdatedPkgs);
|
|
327
|
-
const allUpdated = await this.runLernaVersion(rpUpdatedPkgs, allPkgs);
|
|
328
|
-
await this.updatePkgsWithPRData(pkgsWithPRData, newManifestVersions, allUpdated, allPkgs);
|
|
329
|
-
return [newManifestVersions, pkgsWithPRData];
|
|
285
|
+
if (injected) {
|
|
286
|
+
return newLines.join('\n');
|
|
330
287
|
}
|
|
288
|
+
if (seenDependenciesSection) {
|
|
289
|
+
return `${changelog}\n${notes}`;
|
|
290
|
+
}
|
|
291
|
+
return `${changelog}\n\n\n### Dependencies\n\n${notes}`;
|
|
292
|
+
}
|
|
293
|
+
function addPath(path, file) {
|
|
294
|
+
return path === manifest_1.ROOT_PROJECT_PATH ? file : `${path}/${file}`;
|
|
331
295
|
}
|
|
332
|
-
exports.default = NodeWorkspaceDependencyUpdates;
|
|
333
296
|
//# sourceMappingURL=node-workspace.js.map
|