@storm-software/workspace-tools 1.267.19 → 1.267.21
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 +24 -0
- package/README.md +1 -1
- package/dist/chunk-22UY7NFX.js +41 -0
- package/dist/chunk-23BZQTB2.mjs +425 -0
- package/dist/{chunk-7O34DHUG.js → chunk-2AVWFUXP.js} +4 -19
- package/dist/{chunk-VW3PZOJ4.mjs → chunk-2M22JVJQ.mjs} +307 -192
- package/dist/{chunk-5RJOBRYL.mjs → chunk-3EDSGFA5.mjs} +63 -54
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/{chunk-AC5SI4YZ.js → chunk-3TYXXJKV.js} +11 -8
- package/dist/{chunk-QSB5SLZS.mjs → chunk-3ZBMLG4D.mjs} +17 -14
- package/dist/chunk-437WGH2M.mjs +32 -0
- package/dist/{chunk-ULBTYC2B.js → chunk-4BECJRPP.js} +13 -42
- package/dist/chunk-4QRA66TH.mjs +379 -0
- package/dist/chunk-4S66IYQF.mjs +31 -0
- package/dist/{chunk-4JOIS7WW.js → chunk-4WHSR4FK.js} +24 -14
- package/dist/{chunk-JTAXCQX6.js → chunk-53DNHF7B.js} +7 -13
- package/dist/{chunk-GGGO542M.js → chunk-54FVHKCU.js} +36 -24
- package/dist/{chunk-B67R3JAF.mjs → chunk-5HUW3BTP.mjs} +37 -21
- package/dist/{chunk-GWYZDAH6.mjs → chunk-5LB2F3L4.mjs} +80 -65
- package/dist/{chunk-UF6KFXG5.js → chunk-5VY5IBBQ.js} +20 -17
- package/dist/{chunk-6QO3KMZA.js → chunk-5ZFTWEKB.js} +2 -16
- package/dist/chunk-6EMYX25V.js +7 -0
- package/dist/chunk-6QZSAZZ3.mjs +64 -0
- package/dist/{chunk-2JA7WAH7.mjs → chunk-7AN4JMFC.mjs} +2 -16
- package/dist/{chunk-N7XIQOHR.mjs → chunk-7HWV6U3E.mjs} +33 -18
- package/dist/{chunk-GKL4BY2Y.js → chunk-A5CKB6IJ.js} +7 -8
- package/dist/{chunk-Y5WKYMQB.mjs → chunk-ABE7UOMX.mjs} +24 -21
- package/dist/{chunk-L3WQZ3LY.mjs → chunk-AHLKRK7D.mjs} +33 -18
- package/dist/{chunk-6CGAYKQL.js → chunk-AJ3C2EDW.js} +69 -44
- package/dist/chunk-AMW7VHFM.mjs +52 -0
- package/dist/chunk-AOFWKOAI.js +31 -0
- package/dist/{chunk-7YRW5HNX.js → chunk-AX3RSZT7.js} +42 -31
- package/dist/chunk-BFD7HHVZ.mjs +32 -0
- package/dist/{chunk-ZMFVKBRM.js → chunk-BWGJVRAS.js} +2 -13
- package/dist/{chunk-M6NHJNGU.js → chunk-CWBHZBTN.js} +277 -169
- package/dist/{chunk-VGE6EHYW.mjs → chunk-EKWR7TBP.mjs} +36 -24
- package/dist/chunk-EU6N7QT3.js +32 -0
- package/dist/chunk-EYXDS7SG.js +105 -0
- package/dist/chunk-F66XEAID.mjs +113 -0
- package/dist/chunk-FOFNKU5G.js +379 -0
- package/dist/{chunk-7NNHBZC5.js → chunk-GNOIETZR.js} +28 -17
- package/dist/chunk-GQQLBQPQ.mjs +32 -0
- package/dist/{chunk-7PRHEOCT.js → chunk-H5NKKUPV.js} +31 -18
- package/dist/{chunk-5SVLMXLH.mjs → chunk-HMJTTE4A.mjs} +39 -30
- package/dist/{chunk-ZKMIASDR.mjs → chunk-HY3ZC5EZ.mjs} +10 -31
- package/dist/{chunk-OQPX75CG.js → chunk-I5MSPQMO.js} +31 -18
- package/dist/{chunk-L2DHGVS5.mjs → chunk-IEZKYJSF.mjs} +3 -6
- package/dist/{chunk-IWCQL3AQ.js → chunk-IL3R5ZVS.js} +10 -31
- package/dist/{chunk-P4OVFIT6.js → chunk-IZN2IVJ4.js} +19 -6
- package/dist/{chunk-UALZJZUK.js → chunk-J2Z4WP3E.js} +32 -16
- package/dist/{chunk-RBU35LQW.js → chunk-J4DYXH46.js} +70 -61
- package/dist/chunk-KP4RPOBI.mjs +105 -0
- package/dist/chunk-KR72GKIT.mjs +7 -0
- package/dist/chunk-L4NCVOB5.mjs +17 -0
- package/dist/{chunk-4Y6B6JDH.js → chunk-LBAVVYKU.js} +315 -136
- package/dist/{chunk-WMTEZ2PV.mjs → chunk-LSF4BHCI.mjs} +24 -14
- package/dist/chunk-M725BO42.mjs +32 -0
- package/dist/{chunk-7IAGL37F.mjs → chunk-MF6VZSIO.mjs} +30 -17
- package/dist/{chunk-7OOYI33U.mjs → chunk-MMBLGUC3.mjs} +311 -132
- package/dist/chunk-MZSZKV4N.mjs +47 -0
- package/dist/chunk-O6RRIC6I.js +32 -0
- package/dist/chunk-OKSECMVK.js +32 -0
- package/dist/chunk-Q2HYWACQ.mjs +50 -0
- package/dist/{chunk-62XRHQ44.mjs → chunk-QFWQZOVG.mjs} +14 -43
- package/dist/{chunk-DHGZTMND.js → chunk-QVYCDING.js} +4 -7
- package/dist/{chunk-Z4NKRWWJ.js → chunk-RJRBED5Q.js} +48 -32
- package/dist/chunk-S5Z4QGF3.js +64 -0
- package/dist/{chunk-CSHHIGIV.mjs → chunk-SITFTWPY.mjs} +23 -8
- package/dist/chunk-SNMXP6JV.mjs +41 -0
- package/dist/chunk-SPXJBMLY.js +50 -0
- package/dist/{chunk-7TLYMNLD.mjs → chunk-SW2E5MQJ.mjs} +4 -19
- package/dist/{chunk-OKW5O5P4.js → chunk-T7BALDKJ.js} +26 -22
- package/dist/chunk-TSYIV33W.js +32 -0
- package/dist/{chunk-H72YBOLR.mjs → chunk-U65XVJ4Y.mjs} +1 -12
- package/dist/{chunk-AVJVDD4L.mjs → chunk-U7JFVMCK.mjs} +6 -12
- package/dist/chunk-UIPUSUAB.js +425 -0
- package/dist/{chunk-LSG534D5.mjs → chunk-UYSJG2E5.mjs} +56 -31
- package/dist/{chunk-EHXSPF7W.mjs → chunk-VLOTOQYE.mjs} +11 -8
- package/dist/{chunk-EULJEPPD.mjs → chunk-W2C5IGWW.mjs} +3 -6
- package/dist/{chunk-G4QFSE5B.js → chunk-WE4HK4RN.js} +327 -212
- package/dist/{chunk-SUQKASD7.js → chunk-X2VJXJEF.js} +82 -67
- package/dist/{chunk-GY4AEA7P.mjs → chunk-X6PHOMFB.mjs} +32 -16
- package/dist/{chunk-PK2SUBWI.js → chunk-XZSS3YAB.js} +19 -16
- package/dist/chunk-YXBFVZ3K.js +47 -0
- package/dist/{chunk-CUPARBOS.js → chunk-ZP76EMBE.js} +41 -32
- package/dist/{chunk-HAXYCYZE.mjs → chunk-ZT4IIRQF.mjs} +254 -146
- package/dist/executors.js +21 -21
- package/dist/executors.mjs +20 -20
- package/dist/generators.js +17 -17
- package/dist/generators.mjs +18 -18
- package/dist/index.js +41 -41
- package/dist/index.mjs +42 -42
- package/dist/src/base/base-executor.js +7 -7
- package/dist/src/base/base-executor.mjs +6 -6
- package/dist/src/base/base-executor.untyped.js +1 -1
- package/dist/src/base/base-executor.untyped.mjs +1 -1
- package/dist/src/base/base-generator.js +7 -7
- package/dist/src/base/base-generator.mjs +6 -6
- package/dist/src/base/base-generator.untyped.js +1 -1
- package/dist/src/base/base-generator.untyped.mjs +1 -1
- package/dist/src/base/cargo-base-executor.untyped.js +3 -3
- package/dist/src/base/cargo-base-executor.untyped.mjs +2 -2
- package/dist/src/base/index.js +13 -13
- package/dist/src/base/index.mjs +12 -12
- package/dist/src/base/typescript-build-executor.untyped.js +3 -3
- package/dist/src/base/typescript-build-executor.untyped.mjs +2 -2
- package/dist/src/base/typescript-library-generator.untyped.js +3 -3
- package/dist/src/base/typescript-library-generator.untyped.mjs +2 -2
- package/dist/src/executors/cargo-build/executor.js +9 -9
- package/dist/src/executors/cargo-build/executor.mjs +8 -8
- package/dist/src/executors/cargo-build/untyped.js +3 -3
- package/dist/src/executors/cargo-build/untyped.mjs +2 -2
- package/dist/src/executors/cargo-check/executor.js +9 -9
- package/dist/src/executors/cargo-check/executor.mjs +8 -8
- package/dist/src/executors/cargo-check/untyped.js +3 -3
- package/dist/src/executors/cargo-check/untyped.mjs +2 -2
- package/dist/src/executors/cargo-clippy/executor.js +9 -9
- package/dist/src/executors/cargo-clippy/executor.mjs +8 -8
- package/dist/src/executors/cargo-clippy/untyped.js +3 -3
- package/dist/src/executors/cargo-clippy/untyped.mjs +2 -2
- package/dist/src/executors/cargo-doc/executor.js +9 -9
- package/dist/src/executors/cargo-doc/executor.mjs +8 -8
- package/dist/src/executors/cargo-doc/untyped.js +3 -3
- package/dist/src/executors/cargo-doc/untyped.mjs +2 -2
- package/dist/src/executors/cargo-format/executor.js +9 -9
- package/dist/src/executors/cargo-format/executor.mjs +8 -8
- package/dist/src/executors/cargo-format/untyped.js +3 -3
- package/dist/src/executors/cargo-format/untyped.mjs +2 -2
- package/dist/src/executors/cargo-publish/executor.js +4 -4
- package/dist/src/executors/cargo-publish/executor.mjs +3 -3
- package/dist/src/executors/cargo-publish/untyped.js +3 -3
- package/dist/src/executors/cargo-publish/untyped.mjs +2 -2
- package/dist/src/executors/clean-package/executor.js +84 -62
- package/dist/src/executors/clean-package/executor.mjs +84 -62
- package/dist/src/executors/clean-package/untyped.js +2 -4
- package/dist/src/executors/clean-package/untyped.mjs +2 -4
- package/dist/src/executors/esbuild/executor.js +8 -8
- package/dist/src/executors/esbuild/executor.mjs +7 -7
- package/dist/src/executors/esbuild/untyped.js +4 -8
- package/dist/src/executors/esbuild/untyped.mjs +3 -7
- package/dist/src/executors/npm-publish/executor.js +5 -5
- package/dist/src/executors/npm-publish/executor.mjs +4 -4
- package/dist/src/executors/npm-publish/untyped.js +1 -1
- package/dist/src/executors/npm-publish/untyped.mjs +1 -1
- package/dist/src/executors/size-limit/executor.js +8 -8
- package/dist/src/executors/size-limit/executor.mjs +7 -7
- package/dist/src/executors/size-limit/untyped.js +1 -1
- package/dist/src/executors/size-limit/untyped.mjs +1 -1
- package/dist/src/executors/typia/executor.js +8 -8
- package/dist/src/executors/typia/executor.mjs +7 -7
- package/dist/src/executors/typia/untyped.js +4 -12
- package/dist/src/executors/typia/untyped.mjs +4 -12
- package/dist/src/executors/unbuild/executor.js +8 -8
- package/dist/src/executors/unbuild/executor.mjs +7 -7
- package/dist/src/executors/unbuild/untyped.js +6 -13
- package/dist/src/executors/unbuild/untyped.mjs +5 -12
- package/dist/src/generators/browser-library/generator.js +10 -10
- package/dist/src/generators/browser-library/generator.mjs +9 -9
- package/dist/src/generators/browser-library/untyped.js +5 -11
- package/dist/src/generators/browser-library/untyped.mjs +4 -10
- package/dist/src/generators/config-schema/generator.js +8 -8
- package/dist/src/generators/config-schema/generator.mjs +7 -7
- package/dist/src/generators/config-schema/untyped.js +1 -1
- package/dist/src/generators/config-schema/untyped.mjs +1 -1
- package/dist/src/generators/init/init.js +3 -3
- package/dist/src/generators/init/init.mjs +2 -2
- package/dist/src/generators/init/untyped.js +1 -1
- package/dist/src/generators/init/untyped.mjs +1 -1
- package/dist/src/generators/neutral-library/generator.js +10 -10
- package/dist/src/generators/neutral-library/generator.mjs +9 -9
- package/dist/src/generators/neutral-library/untyped.js +5 -10
- package/dist/src/generators/neutral-library/untyped.mjs +4 -9
- package/dist/src/generators/node-library/generator.js +10 -10
- package/dist/src/generators/node-library/generator.mjs +9 -9
- package/dist/src/generators/node-library/untyped.js +5 -11
- package/dist/src/generators/node-library/untyped.mjs +4 -10
- package/dist/src/generators/preset/generator.js +8 -8
- package/dist/src/generators/preset/generator.mjs +7 -7
- package/dist/src/generators/preset/untyped.js +3 -11
- package/dist/src/generators/preset/untyped.mjs +3 -11
- package/dist/src/generators/release-version/generator.js +7 -7
- package/dist/src/generators/release-version/generator.mjs +6 -6
- package/dist/src/generators/release-version/untyped.js +3 -14
- package/dist/src/generators/release-version/untyped.mjs +3 -14
- package/dist/src/plugins/rust/cargo-toml.js +5 -5
- package/dist/src/plugins/rust/cargo-toml.mjs +4 -4
- package/dist/src/plugins/rust/index.js +5 -5
- package/dist/src/plugins/rust/index.mjs +4 -4
- package/dist/src/plugins/typescript/index.js +5 -5
- package/dist/src/plugins/typescript/index.mjs +4 -4
- package/dist/src/plugins/typescript/project-config.js +5 -5
- package/dist/src/plugins/typescript/project-config.mjs +4 -4
- package/dist/src/plugins/typescript/tsup.js +114 -109
- package/dist/src/plugins/typescript/tsup.mjs +116 -111
- package/dist/src/plugins/typescript/untyped-schema.js +93 -77
- package/dist/src/plugins/typescript/untyped-schema.mjs +96 -80
- package/dist/src/types.js +1 -1
- package/dist/src/types.mjs +1 -1
- package/dist/src/utils/apply-workspace-tokens.js +5 -5
- package/dist/src/utils/apply-workspace-tokens.mjs +4 -4
- package/dist/src/utils/cargo.js +3 -3
- package/dist/src/utils/cargo.mjs +2 -2
- package/dist/src/utils/create-cli-options.js +3 -3
- package/dist/src/utils/create-cli-options.mjs +2 -2
- package/dist/src/utils/get-project-configurations.js +5 -5
- package/dist/src/utils/get-project-configurations.mjs +4 -4
- package/dist/src/utils/index.js +15 -15
- package/dist/src/utils/index.mjs +14 -14
- package/dist/src/utils/lock-file.js +3 -3
- package/dist/src/utils/lock-file.mjs +2 -2
- package/dist/src/utils/package-helpers.js +5 -5
- package/dist/src/utils/package-helpers.mjs +4 -4
- package/dist/src/utils/plugin-helpers.js +4 -4
- package/dist/src/utils/plugin-helpers.mjs +3 -3
- package/dist/src/utils/pnpm-deps-update.js +4 -4
- package/dist/src/utils/pnpm-deps-update.mjs +3 -3
- package/dist/src/utils/project-tags.js +3 -3
- package/dist/src/utils/project-tags.mjs +2 -2
- package/dist/src/utils/toml.js +3 -3
- package/dist/src/utils/toml.mjs +2 -2
- package/dist/src/utils/typia-transform.js +3 -3
- package/dist/src/utils/typia-transform.mjs +2 -2
- package/dist/src/utils/versions.js +1 -1
- package/dist/src/utils/versions.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-3GQAWCBQ.js +0 -13
- package/dist/chunk-3IZ3O4OK.js +0 -30
- package/dist/chunk-6JJB5AYA.js +0 -51
- package/dist/chunk-6JTXR7YX.mjs +0 -18
- package/dist/chunk-6RHWGD7G.mjs +0 -48
- package/dist/chunk-7AXFMX2T.js +0 -37
- package/dist/chunk-A77TLQ44.mjs +0 -32
- package/dist/chunk-B3DVFXXD.js +0 -32
- package/dist/chunk-BC7L3S46.mjs +0 -51
- package/dist/chunk-BNMJYJOZ.mjs +0 -446
- package/dist/chunk-CUWWZLK7.mjs +0 -37
- package/dist/chunk-HOXPAVCL.js +0 -32
- package/dist/chunk-ICPUM2HS.js +0 -50
- package/dist/chunk-JJ4PSTY4.mjs +0 -32
- package/dist/chunk-JMCJJNBJ.mjs +0 -102
- package/dist/chunk-KEBNU3P2.js +0 -446
- package/dist/chunk-KTRA4YQT.mjs +0 -32
- package/dist/chunk-M2VZ44W7.mjs +0 -13
- package/dist/chunk-NG7BO4BF.mjs +0 -468
- package/dist/chunk-NSCWEC2S.js +0 -32
- package/dist/chunk-OQTJDGUH.js +0 -468
- package/dist/chunk-ORWCIVMB.mjs +0 -30
- package/dist/chunk-RUKOOSWL.js +0 -31
- package/dist/chunk-T6VIUVAL.mjs +0 -43
- package/dist/chunk-TET4GF3D.js +0 -43
- package/dist/chunk-XITP2BX2.js +0 -13
- package/dist/chunk-YMGMEPP5.mjs +0 -86
- package/dist/chunk-YW4UN25U.js +0 -86
- package/dist/chunk-ZJZOACSR.mjs +0 -31
- package/dist/chunk-ZTVHEV5N.mjs +0 -50
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
parseCargoToml,
|
|
4
4
|
parseCargoTomlWithTree,
|
|
5
5
|
stringifyCargoToml
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-U65XVJ4Y.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getConfig,
|
|
9
9
|
getStopwatch,
|
|
@@ -13,16 +13,20 @@ import {
|
|
|
13
13
|
writeInfo,
|
|
14
14
|
writeSuccess,
|
|
15
15
|
writeTrace
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2M22JVJQ.mjs";
|
|
17
17
|
import {
|
|
18
18
|
findWorkspaceRoot
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import {
|
|
21
|
-
__name
|
|
22
|
-
} from "./chunk-L2DHGVS5.mjs";
|
|
19
|
+
} from "./chunk-LSF4BHCI.mjs";
|
|
23
20
|
|
|
24
21
|
// src/generators/release-version/generator.ts
|
|
25
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
formatFiles,
|
|
24
|
+
joinPathFragments,
|
|
25
|
+
output,
|
|
26
|
+
readJson,
|
|
27
|
+
updateJson,
|
|
28
|
+
writeJson
|
|
29
|
+
} from "@nx/devkit";
|
|
26
30
|
import { resolveLocalPackageDependencies as resolveLocalPackageJsonDependencies } from "@nx/js/src/generators/release-version/utils/resolve-local-package-dependencies";
|
|
27
31
|
import { updateLockFile } from "@nx/js/src/release/utils/update-lock-file";
|
|
28
32
|
|
|
@@ -161,7 +165,9 @@ var DEFAULT_COMMIT_QUESTIONS = {
|
|
|
161
165
|
type: "select",
|
|
162
166
|
title: "Commit Type",
|
|
163
167
|
description: "Select the commit type that best describes your changes",
|
|
164
|
-
enum: Object.keys(DEFAULT_COMMIT_TYPES).filter(
|
|
168
|
+
enum: Object.keys(DEFAULT_COMMIT_TYPES).filter(
|
|
169
|
+
(type) => DEFAULT_COMMIT_TYPES[type].hidden !== true
|
|
170
|
+
).reduce((ret, type) => {
|
|
165
171
|
ret[type] = DEFAULT_COMMIT_TYPES[type];
|
|
166
172
|
return ret;
|
|
167
173
|
}, {}),
|
|
@@ -201,7 +207,7 @@ var DEFAULT_COMMIT_QUESTIONS = {
|
|
|
201
207
|
type: "input",
|
|
202
208
|
title: "Breaking Changes (Details)",
|
|
203
209
|
description: "A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself",
|
|
204
|
-
when:
|
|
210
|
+
when: (answers) => answers.isBreaking === true,
|
|
205
211
|
maxLength: 600,
|
|
206
212
|
minLength: 3
|
|
207
213
|
},
|
|
@@ -215,17 +221,11 @@ var DEFAULT_COMMIT_QUESTIONS = {
|
|
|
215
221
|
type: "input",
|
|
216
222
|
title: "Open Issue Affected (Details)",
|
|
217
223
|
description: "If issues are closed, the commit requires a body. Please enter a longer description of the commit itself",
|
|
218
|
-
when:
|
|
224
|
+
when: (answers) => answers.isIssueAffected === true,
|
|
219
225
|
maxLength: 600,
|
|
220
226
|
minLength: 3
|
|
221
227
|
}
|
|
222
228
|
};
|
|
223
|
-
var RuleConfigSeverity;
|
|
224
|
-
(function(RuleConfigSeverity2) {
|
|
225
|
-
RuleConfigSeverity2[RuleConfigSeverity2["Disabled"] = 0] = "Disabled";
|
|
226
|
-
RuleConfigSeverity2[RuleConfigSeverity2["Warning"] = 1] = "Warning";
|
|
227
|
-
RuleConfigSeverity2[RuleConfigSeverity2["Error"] = 2] = "Error";
|
|
228
|
-
})(RuleConfigSeverity || (RuleConfigSeverity = {}));
|
|
229
229
|
|
|
230
230
|
// ../git-tools/src/release/config.ts
|
|
231
231
|
var DEFAULT_CONVENTIONAL_COMMITS_CONFIG = {
|
|
@@ -237,10 +237,19 @@ var DEFAULT_CONVENTIONAL_COMMITS_CONFIG = {
|
|
|
237
237
|
import { exec, execSync } from "node:child_process";
|
|
238
238
|
import { relative } from "node:path";
|
|
239
239
|
import { IMPLICIT_DEFAULT_RELEASE_GROUP } from "nx/src/command-line/release/config/config";
|
|
240
|
-
import {
|
|
241
|
-
|
|
240
|
+
import {
|
|
241
|
+
getFirstGitCommit,
|
|
242
|
+
getLatestGitTagForPattern
|
|
243
|
+
} from "nx/src/command-line/release/utils/git";
|
|
244
|
+
import {
|
|
245
|
+
resolveSemverSpecifierFromConventionalCommits,
|
|
246
|
+
resolveSemverSpecifierFromPrompt
|
|
247
|
+
} from "nx/src/command-line/release/utils/resolve-semver-specifier";
|
|
242
248
|
import { isValidSemverSpecifier } from "nx/src/command-line/release/utils/semver";
|
|
243
|
-
import {
|
|
249
|
+
import {
|
|
250
|
+
deriveNewSemverVersion,
|
|
251
|
+
validReleaseVersionPrefixes
|
|
252
|
+
} from "nx/src/command-line/release/version-legacy";
|
|
244
253
|
import { interpolate } from "nx/src/tasks-runner/utils";
|
|
245
254
|
import { prerelease } from "semver";
|
|
246
255
|
async function releaseVersionGeneratorFn(tree, options, config) {
|
|
@@ -250,32 +259,46 @@ async function releaseVersionGeneratorFn(tree, options, config) {
|
|
|
250
259
|
const stopwatch = getStopwatch("Storm Release Version generator");
|
|
251
260
|
try {
|
|
252
261
|
const workspaceRoot = findWorkspaceRoot();
|
|
253
|
-
writeDebug(
|
|
254
|
-
|
|
262
|
+
writeDebug(
|
|
263
|
+
`Loading the Storm Config from environment variables and storm.config.js file...
|
|
264
|
+
- workspaceRoot: ${workspaceRoot}`,
|
|
265
|
+
config
|
|
266
|
+
);
|
|
255
267
|
config = await getConfig(workspaceRoot);
|
|
256
|
-
writeTrace(
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
268
|
+
writeTrace(
|
|
269
|
+
`Generator schema options \u2699\uFE0F
|
|
270
|
+
${Object.keys(options ?? {}).filter(
|
|
271
|
+
(key) => ![
|
|
272
|
+
"projects",
|
|
273
|
+
"releaseGroup",
|
|
274
|
+
"projectGraph",
|
|
275
|
+
"currentVersionResolverMetadata"
|
|
276
|
+
].includes(key)
|
|
277
|
+
).map((key) => ` - ${key}=${JSON.stringify(options[key])}`).join("\n")}`,
|
|
278
|
+
config
|
|
279
|
+
);
|
|
263
280
|
const versionData = {};
|
|
264
281
|
if (options.specifier) {
|
|
265
282
|
if (!isValidSemverSpecifier(options.specifier)) {
|
|
266
|
-
throw new Error(
|
|
283
|
+
throw new Error(
|
|
284
|
+
`The given version specifier "${options.specifier}" is not valid. You provide an exact version or a valid semver keyword such as "major", "minor", "patch", etc.`
|
|
285
|
+
);
|
|
267
286
|
}
|
|
268
287
|
options.specifier = options.specifier.replace(/^v/, "");
|
|
269
288
|
}
|
|
270
|
-
if (options.versionPrefix && validReleaseVersionPrefixes.indexOf(
|
|
271
|
-
|
|
289
|
+
if (options.versionPrefix && validReleaseVersionPrefixes.indexOf(
|
|
290
|
+
options.versionPrefix
|
|
291
|
+
) === -1) {
|
|
292
|
+
throw new Error(
|
|
293
|
+
`Invalid value for version.generatorOptions.versionPrefix: "${options.versionPrefix}"
|
|
272
294
|
|
|
273
|
-
Valid values are: ${validReleaseVersionPrefixes.map((s) => `"${s}"`).join(", ")}`
|
|
295
|
+
Valid values are: ${validReleaseVersionPrefixes.map((s) => `"${s}"`).join(", ")}`
|
|
296
|
+
);
|
|
274
297
|
}
|
|
275
298
|
options.fallbackCurrentVersionResolver ??= "disk";
|
|
276
299
|
options.currentVersionResolver ??= "git-tag";
|
|
277
300
|
const projects = options.projects;
|
|
278
|
-
const createResolvePackageRoot =
|
|
301
|
+
const createResolvePackageRoot = (customPackageRoot) => (projectNode) => {
|
|
279
302
|
if (projectNode?.data?.root === config?.workspaceRoot || projectNode?.data?.root === ".") {
|
|
280
303
|
return config?.workspaceRoot ?? findWorkspaceRoot();
|
|
281
304
|
}
|
|
@@ -287,11 +310,14 @@ Valid values are: ${validReleaseVersionPrefixes.map((s) => `"${s}"`).join(", ")}
|
|
|
287
310
|
projectRoot: projectNode.data.root,
|
|
288
311
|
projectName: projectNode.name
|
|
289
312
|
});
|
|
290
|
-
}
|
|
313
|
+
};
|
|
291
314
|
const resolvePackageRoot = createResolvePackageRoot(options.packageRoot);
|
|
292
315
|
const projectNameToPackageRootMap = /* @__PURE__ */ new Map();
|
|
293
316
|
for (const project of projects) {
|
|
294
|
-
projectNameToPackageRootMap.set(
|
|
317
|
+
projectNameToPackageRootMap.set(
|
|
318
|
+
project.name,
|
|
319
|
+
resolvePackageRoot(project)
|
|
320
|
+
);
|
|
295
321
|
}
|
|
296
322
|
let currentVersion = null;
|
|
297
323
|
let currentVersionResolvedFromFallback = false;
|
|
@@ -300,37 +326,56 @@ Valid values are: ${validReleaseVersionPrefixes.map((s) => `"${s}"`).join(", ")}
|
|
|
300
326
|
for (const project of projects) {
|
|
301
327
|
const projectName = project.name;
|
|
302
328
|
const packageRoot = projectNameToPackageRootMap.get(projectName);
|
|
303
|
-
const packageJsonPath = joinPathFragments(
|
|
304
|
-
|
|
329
|
+
const packageJsonPath = joinPathFragments(
|
|
330
|
+
packageRoot ?? "./",
|
|
331
|
+
"package.json"
|
|
332
|
+
);
|
|
333
|
+
const cargoTomlPath = joinPathFragments(
|
|
334
|
+
packageRoot ?? "./",
|
|
335
|
+
"Cargo.toml"
|
|
336
|
+
);
|
|
305
337
|
if (!tree.exists(packageJsonPath) && !tree.exists(cargoTomlPath)) {
|
|
306
|
-
throw new Error(
|
|
338
|
+
throw new Error(
|
|
339
|
+
`The project "${projectName}" does not have a package.json available at ${packageJsonPath} or a Cargo.toml file available at ${cargoTomlPath}.
|
|
307
340
|
|
|
308
|
-
To fix this you will either need to add a package.json or Cargo.toml file at that location, or configure "release" within your nx.json to exclude "${projectName}" from the current release group, or amend the packageRoot configuration to point to where the package.json should be.`
|
|
341
|
+
To fix this you will either need to add a package.json or Cargo.toml file at that location, or configure "release" within your nx.json to exclude "${projectName}" from the current release group, or amend the packageRoot configuration to point to where the package.json should be.`
|
|
342
|
+
);
|
|
309
343
|
}
|
|
310
|
-
const workspaceRelativePackagePath = relative(
|
|
311
|
-
|
|
344
|
+
const workspaceRelativePackagePath = relative(
|
|
345
|
+
config?.workspaceRoot ?? findWorkspaceRoot(),
|
|
346
|
+
tree.exists(packageJsonPath) ? packageJsonPath : cargoTomlPath
|
|
347
|
+
);
|
|
348
|
+
const log = (msg) => {
|
|
312
349
|
writeInfo(`${projectName}: ${msg}`, config);
|
|
313
|
-
}
|
|
350
|
+
};
|
|
314
351
|
writeInfo(`Running release version for project: ${project.name}`, config);
|
|
315
352
|
let packageName;
|
|
316
353
|
let currentVersionFromDisk;
|
|
317
354
|
if (tree.exists(packageJsonPath)) {
|
|
318
355
|
const projectPackageJson = readJson(tree, packageJsonPath);
|
|
319
|
-
log(
|
|
356
|
+
log(
|
|
357
|
+
`\u{1F50D} Reading data for package "${projectPackageJson.name}" from ${workspaceRelativePackagePath}`
|
|
358
|
+
);
|
|
320
359
|
packageName = projectPackageJson.name;
|
|
321
360
|
currentVersionFromDisk = projectPackageJson.version;
|
|
322
361
|
} else if (tree.exists(cargoTomlPath)) {
|
|
323
|
-
const cargoToml = parseCargoToml(
|
|
324
|
-
|
|
362
|
+
const cargoToml = parseCargoToml(
|
|
363
|
+
tree.read(cargoTomlPath)?.toString("utf-8")
|
|
364
|
+
);
|
|
365
|
+
log(
|
|
366
|
+
`\u{1F50D} Reading data for package "${cargoToml.package.name}" from ${workspaceRelativePackagePath}`
|
|
367
|
+
);
|
|
325
368
|
packageName = cargoToml.package.name;
|
|
326
369
|
currentVersionFromDisk = cargoToml.package.version;
|
|
327
370
|
if (options.currentVersionResolver === "registry") {
|
|
328
371
|
options.currentVersionResolver = "disk";
|
|
329
372
|
}
|
|
330
373
|
} else {
|
|
331
|
-
throw new Error(
|
|
374
|
+
throw new Error(
|
|
375
|
+
`The project "${projectName}" does not have a package.json available at ${workspaceRelativePackagePath} or a Cargo.toml file available at ${cargoTomlPath}.
|
|
332
376
|
|
|
333
|
-
To fix this you will either need to add a package.json or Cargo.toml file at that location, or configure "release" within your nx.json to exclude "${projectName}" from the current release group, or amend the packageRoot configuration to point to where the package.json should be.`
|
|
377
|
+
To fix this you will either need to add a package.json or Cargo.toml file at that location, or configure "release" within your nx.json to exclude "${projectName}" from the current release group, or amend the packageRoot configuration to point to where the package.json should be.`
|
|
378
|
+
);
|
|
334
379
|
}
|
|
335
380
|
switch (options.currentVersionResolver) {
|
|
336
381
|
case "registry": {
|
|
@@ -341,21 +386,9 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
|
|
|
341
386
|
if (options.releaseGroup.projectsRelationship === "independent") {
|
|
342
387
|
try {
|
|
343
388
|
currentVersion = await new Promise((resolve, reject) => {
|
|
344
|
-
exec(
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
if (stderr) {
|
|
349
|
-
return reject(stderr);
|
|
350
|
-
}
|
|
351
|
-
return resolve(stdout.trim());
|
|
352
|
-
});
|
|
353
|
-
});
|
|
354
|
-
log(`\u{1F4C4} Resolved the current version as ${currentVersion} for tag "${tag}" from registry ${npmRegistry}`);
|
|
355
|
-
} catch (_) {
|
|
356
|
-
try {
|
|
357
|
-
currentVersion = await new Promise((resolve, reject) => {
|
|
358
|
-
exec(`npm view ${packageName} version --registry=${githubRegistry} --tag=${tag}`, (error, stdout, stderr) => {
|
|
389
|
+
exec(
|
|
390
|
+
`npm view ${packageName} version --registry=${npmRegistry} --tag=${tag}`,
|
|
391
|
+
(error, stdout, stderr) => {
|
|
359
392
|
if (error) {
|
|
360
393
|
return reject(error);
|
|
361
394
|
}
|
|
@@ -363,31 +396,65 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
|
|
|
363
396
|
return reject(stderr);
|
|
364
397
|
}
|
|
365
398
|
return resolve(stdout.trim());
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
399
|
+
}
|
|
400
|
+
);
|
|
401
|
+
});
|
|
402
|
+
log(
|
|
403
|
+
`\u{1F4C4} Resolved the current version as ${currentVersion} for tag "${tag}" from registry ${npmRegistry}`
|
|
404
|
+
);
|
|
405
|
+
} catch (_) {
|
|
406
|
+
try {
|
|
407
|
+
currentVersion = await new Promise(
|
|
408
|
+
(resolve, reject) => {
|
|
409
|
+
exec(
|
|
410
|
+
`npm view ${packageName} version --registry=${githubRegistry} --tag=${tag}`,
|
|
411
|
+
(error, stdout, stderr) => {
|
|
412
|
+
if (error) {
|
|
413
|
+
return reject(error);
|
|
414
|
+
}
|
|
415
|
+
if (stderr) {
|
|
416
|
+
return reject(stderr);
|
|
417
|
+
}
|
|
418
|
+
return resolve(stdout.trim());
|
|
419
|
+
}
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
log(
|
|
424
|
+
`\u{1F4C4} Resolved the current version as ${currentVersion} for tag "${tag}" from registry ${githubRegistry}`
|
|
425
|
+
);
|
|
369
426
|
} catch (_2) {
|
|
370
427
|
if (options.fallbackCurrentVersionResolver === "disk") {
|
|
371
|
-
log(
|
|
428
|
+
log(
|
|
429
|
+
`\u{1F4C4} Unable to resolve the current version from the registry ${npmRegistry}${githubRegistry ? ` or ${githubRegistry}` : ""}. Falling back to the version on disk of ${currentVersionFromDisk}`
|
|
430
|
+
);
|
|
372
431
|
currentVersion = currentVersionFromDisk;
|
|
373
432
|
currentVersionResolvedFromFallback = true;
|
|
374
433
|
} else {
|
|
375
|
-
throw new Error(
|
|
434
|
+
throw new Error(
|
|
435
|
+
`Unable to resolve the current version from the registry ${npmRegistry}${githubRegistry ? ` or ${githubRegistry}` : ""}. Please ensure that the package exists in the registry in order to use the "registry" currentVersionResolver. Alternatively, you can use the --first-release option or set "release.version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when the registry lookup fails.`
|
|
436
|
+
);
|
|
376
437
|
}
|
|
377
438
|
}
|
|
378
439
|
}
|
|
379
440
|
} else {
|
|
380
441
|
if (currentVersionResolvedFromFallback) {
|
|
381
|
-
log(
|
|
442
|
+
log(
|
|
443
|
+
`\u{1F4C4} Using the current version ${currentVersion} already resolved from disk fallback.`
|
|
444
|
+
);
|
|
382
445
|
} else {
|
|
383
|
-
log(
|
|
446
|
+
log(
|
|
447
|
+
`\u{1F4C4} Using the current version ${currentVersion} already resolved from the registry ${npmRegistry ?? githubRegistry}`
|
|
448
|
+
);
|
|
384
449
|
}
|
|
385
450
|
}
|
|
386
451
|
break;
|
|
387
452
|
}
|
|
388
453
|
case "disk":
|
|
389
454
|
currentVersion = currentVersionFromDisk;
|
|
390
|
-
log(
|
|
455
|
+
log(
|
|
456
|
+
`\u{1F4C4} Resolved the current version as ${currentVersion} from ${packageJsonPath}`
|
|
457
|
+
);
|
|
391
458
|
break;
|
|
392
459
|
case "git-tag": {
|
|
393
460
|
if (
|
|
@@ -395,33 +462,48 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
|
|
|
395
462
|
options.releaseGroup.projectsRelationship === "independent"
|
|
396
463
|
) {
|
|
397
464
|
const releaseTagPattern = options.releaseGroup.releaseTagPattern;
|
|
398
|
-
latestMatchingGitTag = await getLatestGitTagForPattern(
|
|
399
|
-
|
|
400
|
-
|
|
465
|
+
latestMatchingGitTag = await getLatestGitTagForPattern(
|
|
466
|
+
releaseTagPattern,
|
|
467
|
+
{
|
|
468
|
+
projectName: project.name
|
|
469
|
+
}
|
|
470
|
+
);
|
|
401
471
|
if (!latestMatchingGitTag) {
|
|
402
472
|
if (currentVersionFromDisk) {
|
|
403
|
-
log(
|
|
473
|
+
log(
|
|
474
|
+
`\u{1F4C4} Unable to resolve the current version from git tag using pattern "${releaseTagPattern}". Falling back to the version on disk of ${currentVersionFromDisk}`
|
|
475
|
+
);
|
|
404
476
|
currentVersion = currentVersionFromDisk;
|
|
405
477
|
} else {
|
|
406
|
-
log(
|
|
478
|
+
log(
|
|
479
|
+
`No git tags matching pattern "${releaseTagPattern}" for project "${project.name}" were found. This process also could not determine the version by checking the package files on disk, so we will attempt to use the default version value: "0.0.1".`
|
|
480
|
+
);
|
|
407
481
|
currentVersion = "0.0.1";
|
|
408
482
|
}
|
|
409
483
|
currentVersionResolvedFromFallback = true;
|
|
410
484
|
} else {
|
|
411
485
|
currentVersion = latestMatchingGitTag.extractedVersion;
|
|
412
|
-
log(
|
|
486
|
+
log(
|
|
487
|
+
`\u{1F4C4} Resolved the current version as ${currentVersion} from git tag "${latestMatchingGitTag.tag}".`
|
|
488
|
+
);
|
|
413
489
|
}
|
|
414
490
|
} else {
|
|
415
491
|
if (currentVersionResolvedFromFallback) {
|
|
416
|
-
log(
|
|
492
|
+
log(
|
|
493
|
+
`\u{1F4C4} Using the current version ${currentVersion} already resolved from disk fallback.`
|
|
494
|
+
);
|
|
417
495
|
} else {
|
|
418
|
-
log(
|
|
496
|
+
log(
|
|
497
|
+
`\u{1F4C4} Using the current version ${currentVersion} already resolved from git tag "${latestMatchingGitTag.tag}".`
|
|
498
|
+
);
|
|
419
499
|
}
|
|
420
500
|
}
|
|
421
501
|
break;
|
|
422
502
|
}
|
|
423
503
|
default:
|
|
424
|
-
throw new Error(
|
|
504
|
+
throw new Error(
|
|
505
|
+
`Invalid value for options.currentVersionResolver: ${options.currentVersionResolver}`
|
|
506
|
+
);
|
|
425
507
|
}
|
|
426
508
|
if (options.specifier) {
|
|
427
509
|
log(`\u{1F4C4} Using the provided version specifier "${options.specifier}".`);
|
|
@@ -431,51 +513,82 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
|
|
|
431
513
|
switch (specifierSource) {
|
|
432
514
|
case "conventional-commits": {
|
|
433
515
|
if (options.currentVersionResolver !== "git-tag") {
|
|
434
|
-
throw new Error(
|
|
516
|
+
throw new Error(
|
|
517
|
+
`Invalid currentVersionResolver "${options.currentVersionResolver}" provided for release group "${options.releaseGroup.name}". Must be "git-tag" when "specifierSource" is "conventional-commits"`
|
|
518
|
+
);
|
|
435
519
|
}
|
|
436
|
-
const affectedProjects = options.releaseGroup.projectsRelationship === "independent" ? [
|
|
437
|
-
projectName
|
|
438
|
-
] : projects.map((p) => p.name);
|
|
520
|
+
const affectedProjects = options.releaseGroup.projectsRelationship === "independent" ? [projectName] : projects.map((p) => p.name);
|
|
439
521
|
let previousVersionRef = latestMatchingGitTag?.tag ? latestMatchingGitTag.tag : await getFirstGitCommit();
|
|
440
522
|
if (!previousVersionRef) {
|
|
441
|
-
log(
|
|
523
|
+
log(
|
|
524
|
+
`Unable to determine previous version ref for the projects ${affectedProjects.join(
|
|
525
|
+
", "
|
|
526
|
+
)}. This is likely a bug in Storm's Release Versioning. We will attempt to use the default version value "0.0.1" and continue with the process.`
|
|
527
|
+
);
|
|
442
528
|
previousVersionRef = "0.0.1";
|
|
443
529
|
}
|
|
444
|
-
specifier = await resolveSemverSpecifierFromConventionalCommits(
|
|
530
|
+
specifier = await resolveSemverSpecifierFromConventionalCommits(
|
|
531
|
+
previousVersionRef,
|
|
532
|
+
options.projectGraph,
|
|
533
|
+
affectedProjects,
|
|
534
|
+
DEFAULT_CONVENTIONAL_COMMITS_CONFIG
|
|
535
|
+
) ?? void 0;
|
|
445
536
|
if (!specifier) {
|
|
446
|
-
log(
|
|
537
|
+
log(
|
|
538
|
+
"\u{1F6AB} No changes were detected using git history and the conventional commits standard."
|
|
539
|
+
);
|
|
447
540
|
break;
|
|
448
541
|
}
|
|
449
542
|
if (currentVersion && prerelease(currentVersion)) {
|
|
450
543
|
specifier = "prerelease";
|
|
451
|
-
log(
|
|
544
|
+
log(
|
|
545
|
+
`\u{1F4C4} Resolved the specifier as "${specifier}" since the current version is a prerelease.`
|
|
546
|
+
);
|
|
452
547
|
} else {
|
|
453
|
-
log(
|
|
548
|
+
log(
|
|
549
|
+
`\u{1F4C4} Resolved the specifier as "${specifier}" using git history and the conventional commits standard.`
|
|
550
|
+
);
|
|
454
551
|
}
|
|
455
552
|
break;
|
|
456
553
|
}
|
|
457
554
|
case "prompt": {
|
|
458
|
-
const maybeLogReleaseGroup =
|
|
555
|
+
const maybeLogReleaseGroup = (log2) => {
|
|
459
556
|
if (options.releaseGroup.name === IMPLICIT_DEFAULT_RELEASE_GROUP) {
|
|
460
557
|
return log2;
|
|
461
558
|
}
|
|
462
559
|
return `${log2} within release group "${options.releaseGroup.name}"`;
|
|
463
|
-
}
|
|
560
|
+
};
|
|
464
561
|
if (options.releaseGroup.projectsRelationship === "independent") {
|
|
465
|
-
specifier = await resolveSemverSpecifierFromPrompt(
|
|
562
|
+
specifier = await resolveSemverSpecifierFromPrompt(
|
|
563
|
+
`${maybeLogReleaseGroup(
|
|
564
|
+
`What kind of change is this for project "${projectName}"`
|
|
565
|
+
)}?`,
|
|
566
|
+
`${maybeLogReleaseGroup(`What is the exact version for project "${projectName}"`)}?`
|
|
567
|
+
);
|
|
466
568
|
} else {
|
|
467
|
-
specifier = await resolveSemverSpecifierFromPrompt(
|
|
569
|
+
specifier = await resolveSemverSpecifierFromPrompt(
|
|
570
|
+
`${maybeLogReleaseGroup(
|
|
571
|
+
`What kind of change is this for the ${projects.length} matched projects(s)`
|
|
572
|
+
)}?`,
|
|
573
|
+
`${maybeLogReleaseGroup(
|
|
574
|
+
`What is the exact version for the ${projects.length} matched project(s)`
|
|
575
|
+
)}?`
|
|
576
|
+
);
|
|
468
577
|
}
|
|
469
578
|
break;
|
|
470
579
|
}
|
|
471
580
|
default:
|
|
472
|
-
throw new Error(
|
|
581
|
+
throw new Error(
|
|
582
|
+
`Invalid specifierSource "${specifierSource}" provided. Must be one of "prompt" or "conventional-commits"`
|
|
583
|
+
);
|
|
473
584
|
}
|
|
474
585
|
}
|
|
475
586
|
const localPackageDependencies = resolveLocalPackageDependencies(
|
|
476
587
|
tree,
|
|
477
588
|
options.projectGraph,
|
|
478
|
-
projects.filter(
|
|
589
|
+
projects.filter(
|
|
590
|
+
(project2) => project2?.data?.root && project2?.data?.root !== config?.workspaceRoot
|
|
591
|
+
),
|
|
479
592
|
projectNameToPackageRootMap,
|
|
480
593
|
resolvePackageRoot,
|
|
481
594
|
// includeAll when the release group is independent, as we may be filtering to a specific subset of projects, but we still want to update their dependents
|
|
@@ -486,7 +599,9 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
|
|
|
486
599
|
return localPackageDependency.target === project.name;
|
|
487
600
|
});
|
|
488
601
|
if (!currentVersion) {
|
|
489
|
-
throw new Error(
|
|
602
|
+
throw new Error(
|
|
603
|
+
`Unable to determine the current version for project "${projectName}"`
|
|
604
|
+
);
|
|
490
605
|
}
|
|
491
606
|
versionData[projectName] = {
|
|
492
607
|
currentVersion: currentVersion ? currentVersion : "0.0.1",
|
|
@@ -495,10 +610,16 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
|
|
|
495
610
|
// will stay as null in the final result in the case that no changes are detected
|
|
496
611
|
};
|
|
497
612
|
if (!specifier) {
|
|
498
|
-
log(
|
|
613
|
+
log(
|
|
614
|
+
`\u{1F6AB} Skipping versioning "${packageName}" as no changes were detected.`
|
|
615
|
+
);
|
|
499
616
|
continue;
|
|
500
617
|
}
|
|
501
|
-
const newVersion = deriveNewSemverVersion(
|
|
618
|
+
const newVersion = deriveNewSemverVersion(
|
|
619
|
+
currentVersion,
|
|
620
|
+
specifier,
|
|
621
|
+
options.preid
|
|
622
|
+
);
|
|
502
623
|
if (versionData[projectName]) {
|
|
503
624
|
versionData[projectName].newVersion = newVersion;
|
|
504
625
|
}
|
|
@@ -509,24 +630,40 @@ To fix this you will either need to add a package.json or Cargo.toml file at tha
|
|
|
509
630
|
version: newVersion
|
|
510
631
|
});
|
|
511
632
|
} else if (tree.exists(cargoTomlPath)) {
|
|
512
|
-
const cargoToml = parseCargoToml(
|
|
633
|
+
const cargoToml = parseCargoToml(
|
|
634
|
+
tree.read(cargoTomlPath)?.toString("utf-8")
|
|
635
|
+
);
|
|
513
636
|
cargoToml.package ??= {};
|
|
514
637
|
cargoToml.package.version = newVersion;
|
|
515
638
|
tree.write(cargoTomlPath, stringifyCargoToml(cargoToml));
|
|
516
639
|
}
|
|
517
|
-
log(
|
|
640
|
+
log(
|
|
641
|
+
`\u270D\uFE0F New version ${newVersion} written to ${workspaceRelativePackagePath}`
|
|
642
|
+
);
|
|
518
643
|
if (dependentProjects.length > 0) {
|
|
519
|
-
log(
|
|
644
|
+
log(
|
|
645
|
+
`\u270D\uFE0F Applying new version ${newVersion} to ${dependentProjects.length} ${dependentProjects.length > 1 ? "packages which depend" : "package which depends"} on ${project.name}`
|
|
646
|
+
);
|
|
520
647
|
}
|
|
521
648
|
for (const dependentProject of dependentProjects) {
|
|
522
|
-
const dependentPackageRoot = projectNameToPackageRootMap.get(
|
|
649
|
+
const dependentPackageRoot = projectNameToPackageRootMap.get(
|
|
650
|
+
dependentProject.source
|
|
651
|
+
);
|
|
523
652
|
if (!dependentPackageRoot) {
|
|
524
|
-
throw new Error(
|
|
653
|
+
throw new Error(
|
|
654
|
+
`The dependent project "${dependentProject.source}" does not have a packageRoot available.
|
|
525
655
|
|
|
526
|
-
Projects with packageRoot configured: ${Array.from(projectNameToPackageRootMap.keys()).join(", ")}`
|
|
656
|
+
Projects with packageRoot configured: ${Array.from(projectNameToPackageRootMap.keys()).join(", ")}`
|
|
657
|
+
);
|
|
527
658
|
}
|
|
528
|
-
const dependentPackageJsonPath = joinPathFragments(
|
|
529
|
-
|
|
659
|
+
const dependentPackageJsonPath = joinPathFragments(
|
|
660
|
+
dependentPackageRoot,
|
|
661
|
+
"package.json"
|
|
662
|
+
);
|
|
663
|
+
const dependentCargoTomlPath = joinPathFragments(
|
|
664
|
+
dependentPackageRoot,
|
|
665
|
+
"Cargo.toml"
|
|
666
|
+
);
|
|
530
667
|
if (tree.exists(dependentPackageJsonPath)) {
|
|
531
668
|
updateJson(tree, dependentPackageJsonPath, (json) => {
|
|
532
669
|
let versionPrefix = options.versionPrefix ?? "auto";
|
|
@@ -546,10 +683,16 @@ Projects with packageRoot configured: ${Array.from(projectNameToPackageRootMap.k
|
|
|
546
683
|
return json;
|
|
547
684
|
});
|
|
548
685
|
} else if (tree.exists(dependentCargoTomlPath)) {
|
|
549
|
-
const dependentPkg = parseCargoTomlWithTree(
|
|
686
|
+
const dependentPkg = parseCargoTomlWithTree(
|
|
687
|
+
tree,
|
|
688
|
+
dependentPackageRoot,
|
|
689
|
+
dependentProject.source
|
|
690
|
+
);
|
|
550
691
|
let versionPrefix = options.versionPrefix ?? "auto";
|
|
551
692
|
let updatedDependencyData = "";
|
|
552
|
-
for (const dependency of Object.entries(
|
|
693
|
+
for (const dependency of Object.entries(
|
|
694
|
+
dependentPkg[dependentProject.dependencyCollection] ?? {}
|
|
695
|
+
)) {
|
|
553
696
|
const [dependencyName, dependencyData] = dependency;
|
|
554
697
|
if (dependencyName !== dependentProject.target) {
|
|
555
698
|
continue;
|
|
@@ -578,23 +721,36 @@ Projects with packageRoot configured: ${Array.from(projectNameToPackageRootMap.k
|
|
|
578
721
|
};
|
|
579
722
|
break;
|
|
580
723
|
}
|
|
581
|
-
const cargoTomlToUpdate = joinPathFragments(
|
|
582
|
-
|
|
724
|
+
const cargoTomlToUpdate = joinPathFragments(
|
|
725
|
+
dependentPackageRoot,
|
|
726
|
+
"Cargo.toml"
|
|
727
|
+
);
|
|
728
|
+
modifyCargoTable(
|
|
729
|
+
dependentPkg,
|
|
730
|
+
dependentProject.dependencyCollection,
|
|
731
|
+
dependentProject.target,
|
|
732
|
+
updatedDependencyData
|
|
733
|
+
);
|
|
583
734
|
tree.write(cargoTomlToUpdate, stringifyCargoToml(dependentPkg));
|
|
584
735
|
}
|
|
585
736
|
}
|
|
586
737
|
}
|
|
587
738
|
await formatFiles(tree);
|
|
588
|
-
writeSuccess(
|
|
589
|
-
|
|
739
|
+
writeSuccess(
|
|
740
|
+
`Completed running the Storm Release Version generator!
|
|
741
|
+
`,
|
|
742
|
+
config
|
|
743
|
+
);
|
|
590
744
|
return {
|
|
591
745
|
data: versionData,
|
|
592
|
-
callback:
|
|
746
|
+
callback: async (tree2, opts) => {
|
|
593
747
|
output.logSingleLine("Updating Cargo.lock file");
|
|
594
748
|
const cwd = tree2.root;
|
|
595
749
|
const updatedFiles = await updateLockFile(cwd, opts) ?? [];
|
|
596
750
|
const updatedCargoPackages = [];
|
|
597
|
-
for (const [projectName, projectVersionData] of Object.entries(
|
|
751
|
+
for (const [projectName, projectVersionData] of Object.entries(
|
|
752
|
+
versionData
|
|
753
|
+
)) {
|
|
598
754
|
const project = projects.find((proj) => proj.name === projectName);
|
|
599
755
|
if (projectVersionData.newVersion && project?.name && projectNameToPackageRootMap.get(project.name)) {
|
|
600
756
|
const projectRoot = projectNameToPackageRootMap.get(project.name);
|
|
@@ -616,22 +772,28 @@ Projects with packageRoot configured: ${Array.from(projectNameToPackageRootMap.k
|
|
|
616
772
|
}
|
|
617
773
|
}
|
|
618
774
|
return updatedFiles;
|
|
619
|
-
}
|
|
775
|
+
}
|
|
620
776
|
};
|
|
621
777
|
} catch (error) {
|
|
622
|
-
writeFatal(
|
|
623
|
-
|
|
778
|
+
writeFatal(
|
|
779
|
+
"A fatal error occurred while running the Storm Release Version generator - the process was forced to terminate",
|
|
780
|
+
config
|
|
781
|
+
);
|
|
782
|
+
writeError(
|
|
783
|
+
`An exception was thrown in the Storm Release Version generator's process
|
|
624
784
|
- Details: ${error.message}
|
|
625
|
-
- Stacktrace: ${error.stack}`,
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
785
|
+
- Stacktrace: ${error.stack}`,
|
|
786
|
+
config
|
|
787
|
+
);
|
|
788
|
+
throw new Error(
|
|
789
|
+
`An exception was thrown in the Storm Release Version generator's process
|
|
790
|
+
- Details: ${error.message}`,
|
|
791
|
+
{ cause: error }
|
|
792
|
+
);
|
|
630
793
|
} finally {
|
|
631
794
|
stopwatch();
|
|
632
795
|
}
|
|
633
796
|
}
|
|
634
|
-
__name(releaseVersionGeneratorFn, "releaseVersionGeneratorFn");
|
|
635
797
|
var generator_default = releaseVersionGeneratorFn;
|
|
636
798
|
async function getNpmRegistry() {
|
|
637
799
|
if (process.env.STORM_REGISTRY_NPM) {
|
|
@@ -650,14 +812,12 @@ async function getNpmRegistry() {
|
|
|
650
812
|
});
|
|
651
813
|
return registry ? registry : "https://registry.npmjs.org";
|
|
652
814
|
}
|
|
653
|
-
__name(getNpmRegistry, "getNpmRegistry");
|
|
654
815
|
function getGitHubRegistry() {
|
|
655
816
|
if (process.env.STORM_REGISTRY_GITHUB) {
|
|
656
817
|
return process.env.STORM_REGISTRY_GITHUB;
|
|
657
818
|
}
|
|
658
819
|
return "https://npm.pkg.github.com";
|
|
659
820
|
}
|
|
660
|
-
__name(getGitHubRegistry, "getGitHubRegistry");
|
|
661
821
|
function hasGitDiff(filePath) {
|
|
662
822
|
try {
|
|
663
823
|
const result = execSync(`git diff --name-only "${filePath}"`).toString();
|
|
@@ -666,14 +826,26 @@ function hasGitDiff(filePath) {
|
|
|
666
826
|
return false;
|
|
667
827
|
}
|
|
668
828
|
}
|
|
669
|
-
__name(hasGitDiff, "hasGitDiff");
|
|
670
829
|
function resolveLocalPackageDependencies(tree, projectGraph, filteredProjects, projectNameToPackageRootMap, resolvePackageRoot, includeAll = false, isNodeProject = true) {
|
|
671
830
|
if (isNodeProject) {
|
|
672
|
-
return resolveLocalPackageJsonDependencies(
|
|
831
|
+
return resolveLocalPackageJsonDependencies(
|
|
832
|
+
tree,
|
|
833
|
+
projectGraph,
|
|
834
|
+
filteredProjects,
|
|
835
|
+
projectNameToPackageRootMap,
|
|
836
|
+
resolvePackageRoot,
|
|
837
|
+
includeAll
|
|
838
|
+
);
|
|
673
839
|
}
|
|
674
|
-
return resolveLocalPackageCargoDependencies(
|
|
840
|
+
return resolveLocalPackageCargoDependencies(
|
|
841
|
+
tree,
|
|
842
|
+
projectGraph,
|
|
843
|
+
filteredProjects,
|
|
844
|
+
projectNameToPackageRootMap,
|
|
845
|
+
resolvePackageRoot,
|
|
846
|
+
includeAll
|
|
847
|
+
);
|
|
675
848
|
}
|
|
676
|
-
__name(resolveLocalPackageDependencies, "resolveLocalPackageDependencies");
|
|
677
849
|
function resolveLocalPackageCargoDependencies(tree, projectGraph, filteredProjects, projectNameToPackageRootMap, resolvePackageRoot, includeAll = false) {
|
|
678
850
|
const localPackageDependencies = {};
|
|
679
851
|
const projects = includeAll ? Object.values(projectGraph.nodes) : filteredProjects;
|
|
@@ -702,14 +874,22 @@ function resolveLocalPackageCargoDependencies(tree, projectGraph, filteredProjec
|
|
|
702
874
|
}
|
|
703
875
|
const depProjectRoot = projectNameToPackageRootMap.get(dep.target);
|
|
704
876
|
if (!depProjectRoot) {
|
|
705
|
-
throw new Error(
|
|
877
|
+
throw new Error(
|
|
878
|
+
`The project "${dep.target}" does not have a packageRoot available.`
|
|
879
|
+
);
|
|
706
880
|
}
|
|
707
|
-
const cargoToml = parseCargoTomlWithTree(
|
|
881
|
+
const cargoToml = parseCargoTomlWithTree(
|
|
882
|
+
tree,
|
|
883
|
+
resolvePackageRoot(projectNode),
|
|
884
|
+
projectNode.name
|
|
885
|
+
);
|
|
708
886
|
const dependencies = cargoToml.dependencies ?? {};
|
|
709
887
|
const devDependencies = cargoToml["dev-dependencies"] ?? {};
|
|
710
888
|
const dependencyCollection = dependencies[depProject.name] ? "dependencies" : devDependencies[depProject.name] ? "dev-dependencies" : null;
|
|
711
889
|
if (!dependencyCollection) {
|
|
712
|
-
throw new Error(
|
|
890
|
+
throw new Error(
|
|
891
|
+
`The project "${projectNode.name}" does not have a local dependency on "${depProject.name}" in its Cargo.toml`
|
|
892
|
+
);
|
|
713
893
|
}
|
|
714
894
|
localPackageDepsForProject.push({
|
|
715
895
|
...dep,
|
|
@@ -720,7 +900,6 @@ function resolveLocalPackageCargoDependencies(tree, projectGraph, filteredProjec
|
|
|
720
900
|
}
|
|
721
901
|
return localPackageDependencies;
|
|
722
902
|
}
|
|
723
|
-
__name(resolveLocalPackageCargoDependencies, "resolveLocalPackageCargoDependencies");
|
|
724
903
|
|
|
725
904
|
export {
|
|
726
905
|
releaseVersionGeneratorFn,
|