bumpp 9.3.1 → 9.4.1
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/dist/{chunk-2LHJGPFO.mjs → chunk-ZH3O6GQ3.mjs} +105 -41
- package/dist/cli/index.js +129 -75
- package/dist/cli/index.mjs +31 -35
- package/dist/index.d.mts +18 -11
- package/dist/index.d.ts +18 -11
- package/dist/index.js +103 -42
- package/dist/index.mjs +1 -1
- package/package.json +13 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import _semver, { ReleaseType } from 'semver';
|
|
2
|
-
|
|
1
|
+
import _semver, { ReleaseType as ReleaseType$1 } from 'semver';
|
|
2
|
+
|
|
3
|
+
type ReleaseType = ReleaseType$1 | 'next';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Information about the work that was performed by the `versionBump()` function.
|
|
@@ -12,7 +13,7 @@ interface VersionBumpResults {
|
|
|
12
13
|
/**
|
|
13
14
|
* The previous version number in package.json.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
currentVersion: string;
|
|
16
17
|
/**
|
|
17
18
|
* The new version number.
|
|
18
19
|
*/
|
|
@@ -82,6 +83,11 @@ interface VersionBumpOptions {
|
|
|
82
83
|
* Defaults to "prompt".
|
|
83
84
|
*/
|
|
84
85
|
release?: string;
|
|
86
|
+
/**
|
|
87
|
+
* The current version number to be bumpped.
|
|
88
|
+
* If not provide, it will be read from the first file in the `files` array.
|
|
89
|
+
*/
|
|
90
|
+
currentVersion?: string;
|
|
85
91
|
/**
|
|
86
92
|
* The prerelease type (e.g. "alpha", "beta", "next").
|
|
87
93
|
*
|
|
@@ -94,7 +100,7 @@ interface VersionBumpOptions {
|
|
|
94
100
|
* with the new version number. If the message string does _not_ contain any `%s` placeholders,
|
|
95
101
|
* then the new version number will be appended to the message.
|
|
96
102
|
*
|
|
97
|
-
* Defaults to `
|
|
103
|
+
* Defaults to `true`.
|
|
98
104
|
*/
|
|
99
105
|
commit?: boolean | string;
|
|
100
106
|
/**
|
|
@@ -103,13 +109,13 @@ interface VersionBumpOptions {
|
|
|
103
109
|
* with the new version number. If the tag string does _not_ contain any `%s` placeholders,
|
|
104
110
|
* then the new version number will be appended to the tag.
|
|
105
111
|
*
|
|
106
|
-
* Defaults to `
|
|
112
|
+
* Defaults to `true`.
|
|
107
113
|
*/
|
|
108
114
|
tag?: boolean | string;
|
|
109
115
|
/**
|
|
110
116
|
* Indicates whether to push the git commit and tag.
|
|
111
117
|
*
|
|
112
|
-
* Defaults to `
|
|
118
|
+
* Defaults to `true`.
|
|
113
119
|
*/
|
|
114
120
|
push?: boolean;
|
|
115
121
|
/**
|
|
@@ -122,7 +128,7 @@ interface VersionBumpOptions {
|
|
|
122
128
|
/**
|
|
123
129
|
* Prompt for confirmation
|
|
124
130
|
*
|
|
125
|
-
* @default
|
|
131
|
+
* @default true
|
|
126
132
|
*/
|
|
127
133
|
confirm?: boolean;
|
|
128
134
|
/**
|
|
@@ -165,7 +171,7 @@ interface VersionBumpOptions {
|
|
|
165
171
|
/**
|
|
166
172
|
* A callback that is provides information about the progress of the `versionBump()` function.
|
|
167
173
|
*/
|
|
168
|
-
progress
|
|
174
|
+
progress?: (progress: VersionBumpProgress) => void;
|
|
169
175
|
/**
|
|
170
176
|
* Excute additional command after bumping and before commiting
|
|
171
177
|
*/
|
|
@@ -263,12 +269,13 @@ interface NormalizedOptions {
|
|
|
263
269
|
ignoreScripts: boolean;
|
|
264
270
|
execute?: string;
|
|
265
271
|
customVersion?: VersionBumpOptions['customVersion'];
|
|
272
|
+
currentVersion?: string;
|
|
266
273
|
}
|
|
267
274
|
|
|
268
275
|
interface OperationState {
|
|
269
276
|
release: ReleaseType | undefined;
|
|
270
|
-
|
|
271
|
-
|
|
277
|
+
currentVersionSource: string;
|
|
278
|
+
currentVersion: string;
|
|
272
279
|
newVersion: string;
|
|
273
280
|
commitMessage: string;
|
|
274
281
|
tagName: string;
|
|
@@ -344,4 +351,4 @@ declare const bumpConfigDefaults: VersionBumpOptions;
|
|
|
344
351
|
declare function loadBumpConfig(overrides?: Partial<VersionBumpOptions>, cwd?: string): Promise<VersionBumpOptions>;
|
|
345
352
|
declare function defineConfig(config: Partial<VersionBumpOptions>): Partial<VersionBumpOptions>;
|
|
346
353
|
|
|
347
|
-
export { type InterfaceOptions, NpmScript, ProgressEvent, type VersionBumpOptions, type VersionBumpProgress, type VersionBumpResults, bumpConfigDefaults, versionBump as default, defineConfig, loadBumpConfig, versionBump, versionBumpInfo };
|
|
354
|
+
export { type InterfaceOptions, NpmScript, ProgressEvent, type ReleaseType, type VersionBumpOptions, type VersionBumpProgress, type VersionBumpResults, bumpConfigDefaults, versionBump as default, defineConfig, loadBumpConfig, versionBump, versionBumpInfo };
|
package/dist/index.js
CHANGED
|
@@ -60,7 +60,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
60
60
|
|
|
61
61
|
// node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js
|
|
62
62
|
var require_picocolors = __commonJS({
|
|
63
|
-
"node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js"(
|
|
63
|
+
"node_modules/.pnpm/picocolors@1.0.0/node_modules/picocolors/picocolors.js"(exports2, module2) {
|
|
64
64
|
var tty2 = require("tty");
|
|
65
65
|
var isColorSupported = !("NO_COLOR" in process.env || process.argv.includes("--no-color")) && ("FORCE_COLOR" in process.env || process.argv.includes("--color") || process.platform === "win32" || tty2.isatty(1) && process.env.TERM !== "dumb" || "CI" in process.env);
|
|
66
66
|
var formatter = (open, close, replace = open) => (input) => {
|
|
@@ -649,7 +649,7 @@ var import_semver = __toESM(require("semver"));
|
|
|
649
649
|
|
|
650
650
|
// src/release-type.ts
|
|
651
651
|
var prereleaseTypes = ["premajor", "preminor", "prepatch", "prerelease"];
|
|
652
|
-
var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch"]);
|
|
652
|
+
var releaseTypes = prereleaseTypes.concat(["major", "minor", "patch", "next"]);
|
|
653
653
|
function isPrerelease(value) {
|
|
654
654
|
return prereleaseTypes.includes(value);
|
|
655
655
|
}
|
|
@@ -660,7 +660,7 @@ function isReleaseType(value) {
|
|
|
660
660
|
// src/get-new-version.ts
|
|
661
661
|
async function getNewVersion(operation) {
|
|
662
662
|
const { release } = operation.options;
|
|
663
|
-
const {
|
|
663
|
+
const { currentVersion } = operation.state;
|
|
664
664
|
switch (release.type) {
|
|
665
665
|
case "prompt":
|
|
666
666
|
return promptForNewVersion(operation);
|
|
@@ -671,42 +671,41 @@ async function getNewVersion(operation) {
|
|
|
671
671
|
default:
|
|
672
672
|
return operation.update({
|
|
673
673
|
release: release.type,
|
|
674
|
-
newVersion: getNextVersion(
|
|
674
|
+
newVersion: getNextVersion(currentVersion, release)
|
|
675
675
|
});
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
|
-
function getNextVersion(
|
|
679
|
-
const oldSemVer = new import_semver.SemVer(
|
|
680
|
-
const
|
|
678
|
+
function getNextVersion(currentVersion, bump) {
|
|
679
|
+
const oldSemVer = new import_semver.SemVer(currentVersion);
|
|
680
|
+
const type = bump.type === "next" ? oldSemVer.prerelease.length ? "prerelease" : "patch" : bump.type;
|
|
681
|
+
const newSemVer = oldSemVer.inc(type, bump.preid);
|
|
681
682
|
if (isPrerelease(bump.type) && newSemVer.prerelease.length === 2 && newSemVer.prerelease[0] === bump.preid && String(newSemVer.prerelease[1]) === "0") {
|
|
682
683
|
newSemVer.prerelease[1] = "1";
|
|
683
684
|
newSemVer.format();
|
|
684
685
|
}
|
|
685
686
|
return newSemVer.version;
|
|
686
687
|
}
|
|
687
|
-
function getNextVersions(
|
|
688
|
-
var _a;
|
|
688
|
+
function getNextVersions(currentVersion, preid) {
|
|
689
689
|
const next = {};
|
|
690
|
-
const parse = import_semver.default.parse(
|
|
690
|
+
const parse = import_semver.default.parse(currentVersion);
|
|
691
691
|
if (typeof (parse == null ? void 0 : parse.prerelease[0]) === "string")
|
|
692
692
|
preid = (parse == null ? void 0 : parse.prerelease[0]) || "preid";
|
|
693
693
|
for (const type of releaseTypes)
|
|
694
|
-
next[type] =
|
|
695
|
-
next.next = ((_a = parse == null ? void 0 : parse.prerelease) == null ? void 0 : _a.length) ? import_semver.default.inc(oldVersion, "prerelease", preid) : import_semver.default.inc(oldVersion, "patch");
|
|
694
|
+
next[type] = getNextVersion(currentVersion, { type, preid });
|
|
696
695
|
return next;
|
|
697
696
|
}
|
|
698
697
|
async function promptForNewVersion(operation) {
|
|
699
698
|
var _a, _b;
|
|
700
|
-
const {
|
|
699
|
+
const { currentVersion } = operation.state;
|
|
701
700
|
const release = operation.options.release;
|
|
702
|
-
const next = getNextVersions(
|
|
703
|
-
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a,
|
|
701
|
+
const next = getNextVersions(currentVersion, release.preid);
|
|
702
|
+
const configCustomVersion = await ((_b = (_a = operation.options).customVersion) == null ? void 0 : _b.call(_a, currentVersion, import_semver.default));
|
|
704
703
|
const PADDING = 13;
|
|
705
704
|
const answers = await (0, import_prompts.default)([
|
|
706
705
|
{
|
|
707
706
|
type: "autocomplete",
|
|
708
707
|
name: "release",
|
|
709
|
-
message: `Current version ${import_picocolors.default.green(
|
|
708
|
+
message: `Current version ${import_picocolors.default.green(currentVersion)}`,
|
|
710
709
|
initial: configCustomVersion ? "config" : "next",
|
|
711
710
|
choices: [
|
|
712
711
|
{ value: "major", title: `${"major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.major)}` },
|
|
@@ -719,7 +718,7 @@ async function promptForNewVersion(operation) {
|
|
|
719
718
|
{ value: "prepatch", title: `${"pre-patch".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.prepatch)}` },
|
|
720
719
|
{ value: "preminor", title: `${"pre-minor".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.preminor)}` },
|
|
721
720
|
{ value: "premajor", title: `${"pre-major".padStart(PADDING, " ")} ${import_picocolors.default.bold(next.premajor)}` },
|
|
722
|
-
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${import_picocolors.default.bold(
|
|
721
|
+
{ value: "none", title: `${"as-is".padStart(PADDING, " ")} ${import_picocolors.default.bold(currentVersion)}` },
|
|
723
722
|
{ value: "custom", title: "custom ...".padStart(PADDING + 4, " ") }
|
|
724
723
|
]
|
|
725
724
|
},
|
|
@@ -727,13 +726,13 @@ async function promptForNewVersion(operation) {
|
|
|
727
726
|
type: (prev) => prev === "custom" ? "text" : null,
|
|
728
727
|
name: "custom",
|
|
729
728
|
message: "Enter the new version number:",
|
|
730
|
-
initial:
|
|
729
|
+
initial: currentVersion,
|
|
731
730
|
validate: (custom) => {
|
|
732
731
|
return (0, import_semver.valid)(custom) ? true : "That's not a valid version number";
|
|
733
732
|
}
|
|
734
733
|
}
|
|
735
734
|
]);
|
|
736
|
-
const newVersion = answers.release === "none" ?
|
|
735
|
+
const newVersion = answers.release === "none" ? currentVersion : answers.release === "custom" ? (0, import_semver.clean)(answers.custom) : answers.release === "config" ? (0, import_semver.clean)(configCustomVersion) : next[answers.release];
|
|
737
736
|
if (!newVersion)
|
|
738
737
|
import_node_process3.default.exit(1);
|
|
739
738
|
switch (answers.release) {
|
|
@@ -747,7 +746,7 @@ async function promptForNewVersion(operation) {
|
|
|
747
746
|
}
|
|
748
747
|
}
|
|
749
748
|
|
|
750
|
-
// src/get-
|
|
749
|
+
// src/get-current-version.ts
|
|
751
750
|
var import_semver2 = require("semver");
|
|
752
751
|
|
|
753
752
|
// src/fs.ts
|
|
@@ -921,8 +920,10 @@ function isOptionalString(value) {
|
|
|
921
920
|
return value === null || type === "undefined" || type === "string";
|
|
922
921
|
}
|
|
923
922
|
|
|
924
|
-
// src/get-
|
|
925
|
-
async function
|
|
923
|
+
// src/get-current-version.ts
|
|
924
|
+
async function getCurrentVersion(operation) {
|
|
925
|
+
if (operation.state.currentVersion)
|
|
926
|
+
return operation;
|
|
926
927
|
const { cwd, files } = operation.options;
|
|
927
928
|
const filesToCheck = files.filter((file) => file.endsWith(".json"));
|
|
928
929
|
if (!filesToCheck.includes("package.json"))
|
|
@@ -931,8 +932,8 @@ async function getOldVersion(operation) {
|
|
|
931
932
|
const version = await readVersion(file, cwd);
|
|
932
933
|
if (version) {
|
|
933
934
|
return operation.update({
|
|
934
|
-
|
|
935
|
-
|
|
935
|
+
currentVersionSource: file,
|
|
936
|
+
currentVersion: version
|
|
936
937
|
});
|
|
937
938
|
}
|
|
938
939
|
}
|
|
@@ -1028,9 +1029,12 @@ function formatVersionString(template, newVersion) {
|
|
|
1028
1029
|
|
|
1029
1030
|
// src/normalize-options.ts
|
|
1030
1031
|
var import_node_process4 = __toESM(require("process"));
|
|
1032
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
1033
|
+
var import_node_fs2 = __toESM(require("fs"));
|
|
1031
1034
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
1035
|
+
var import_js_yaml = __toESM(require("js-yaml"));
|
|
1032
1036
|
async function normalizeOptions(raw) {
|
|
1033
|
-
var _a;
|
|
1037
|
+
var _a, _b;
|
|
1034
1038
|
const preid = typeof raw.preid === "string" ? raw.preid : "beta";
|
|
1035
1039
|
const push = Boolean(raw.push);
|
|
1036
1040
|
const all = Boolean(raw.all);
|
|
@@ -1038,10 +1042,11 @@ async function normalizeOptions(raw) {
|
|
|
1038
1042
|
const cwd = raw.cwd || import_node_process4.default.cwd();
|
|
1039
1043
|
const ignoreScripts = Boolean(raw.ignoreScripts);
|
|
1040
1044
|
const execute = raw.execute;
|
|
1045
|
+
const recursive = Boolean(raw.recursive);
|
|
1041
1046
|
let release;
|
|
1042
1047
|
if (!raw.release || raw.release === "prompt")
|
|
1043
1048
|
release = { type: "prompt", preid };
|
|
1044
|
-
else if (isReleaseType(raw.release))
|
|
1049
|
+
else if (isReleaseType(raw.release) || raw.release === "next")
|
|
1045
1050
|
release = { type: raw.release, preid };
|
|
1046
1051
|
else
|
|
1047
1052
|
release = { type: "version", version: raw.release };
|
|
@@ -1055,8 +1060,29 @@ async function normalizeOptions(raw) {
|
|
|
1055
1060
|
commit = { all, noVerify, message: raw.commit };
|
|
1056
1061
|
else if (raw.commit || tag || push)
|
|
1057
1062
|
commit = { all, noVerify, message: "chore: release v" };
|
|
1063
|
+
if (recursive && !((_a = raw.files) == null ? void 0 : _a.length)) {
|
|
1064
|
+
raw.files = [
|
|
1065
|
+
"package.json",
|
|
1066
|
+
"package-lock.json",
|
|
1067
|
+
"packages/**/package.json",
|
|
1068
|
+
"jsr.json",
|
|
1069
|
+
"jsr.jsonc"
|
|
1070
|
+
];
|
|
1071
|
+
if (import_node_fs2.default.existsSync("pnpm-workspace.yaml")) {
|
|
1072
|
+
const pnpmWorkspace = await import_promises.default.readFile("pnpm-workspace.yaml", "utf8");
|
|
1073
|
+
const workspaces = import_js_yaml.default.load(pnpmWorkspace);
|
|
1074
|
+
const workspacesWithPackageJson = workspaces.packages.map((workspace) => `${workspace}/package.json`);
|
|
1075
|
+
const withoutExcludedWorkspaces = workspacesWithPackageJson.filter((workspace) => {
|
|
1076
|
+
var _a2;
|
|
1077
|
+
return !workspace.startsWith("!") && !((_a2 = raw.files) == null ? void 0 : _a2.includes(workspace));
|
|
1078
|
+
});
|
|
1079
|
+
raw.files = raw.files.concat(withoutExcludedWorkspaces);
|
|
1080
|
+
}
|
|
1081
|
+
} else {
|
|
1082
|
+
raw.files = ((_b = raw.files) == null ? void 0 : _b.length) ? raw.files : ["package.json", "package-lock.json", "jsr.json", "jsr.jsonc"];
|
|
1083
|
+
}
|
|
1058
1084
|
const files = await (0, import_fast_glob.default)(
|
|
1059
|
-
|
|
1085
|
+
raw.files,
|
|
1060
1086
|
{
|
|
1061
1087
|
cwd,
|
|
1062
1088
|
onlyFiles: true,
|
|
@@ -1071,7 +1097,7 @@ async function normalizeOptions(raw) {
|
|
|
1071
1097
|
} else if (raw.interface === true || !raw.interface) {
|
|
1072
1098
|
ui = { input: import_node_process4.default.stdin, output: import_node_process4.default.stdout };
|
|
1073
1099
|
} else {
|
|
1074
|
-
let
|
|
1100
|
+
let _c = raw.interface, { input, output } = _c, other = __objRest(_c, ["input", "output"]);
|
|
1075
1101
|
if (input === true || input !== false && !input)
|
|
1076
1102
|
input = import_node_process4.default.stdin;
|
|
1077
1103
|
if (output === true || output !== false && !output)
|
|
@@ -1090,7 +1116,8 @@ async function normalizeOptions(raw) {
|
|
|
1090
1116
|
interface: ui,
|
|
1091
1117
|
ignoreScripts,
|
|
1092
1118
|
execute,
|
|
1093
|
-
customVersion: raw.customVersion
|
|
1119
|
+
customVersion: raw.customVersion,
|
|
1120
|
+
currentVersion: raw.currentVersion
|
|
1094
1121
|
};
|
|
1095
1122
|
}
|
|
1096
1123
|
|
|
@@ -1105,8 +1132,8 @@ var Operation = class _Operation {
|
|
|
1105
1132
|
*/
|
|
1106
1133
|
this.state = {
|
|
1107
1134
|
release: void 0,
|
|
1108
|
-
|
|
1109
|
-
|
|
1135
|
+
currentVersion: "",
|
|
1136
|
+
currentVersionSource: "",
|
|
1110
1137
|
newVersion: "",
|
|
1111
1138
|
commitMessage: "",
|
|
1112
1139
|
tagName: "",
|
|
@@ -1115,6 +1142,12 @@ var Operation = class _Operation {
|
|
|
1115
1142
|
};
|
|
1116
1143
|
this.options = options;
|
|
1117
1144
|
this._progress = progress;
|
|
1145
|
+
if (options.currentVersion) {
|
|
1146
|
+
this.update({
|
|
1147
|
+
currentVersion: options.currentVersion,
|
|
1148
|
+
currentVersionSource: "user"
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1118
1151
|
}
|
|
1119
1152
|
/**
|
|
1120
1153
|
* The results of the operation.
|
|
@@ -1124,7 +1157,7 @@ var Operation = class _Operation {
|
|
|
1124
1157
|
const state = this.state;
|
|
1125
1158
|
return {
|
|
1126
1159
|
release: state.release,
|
|
1127
|
-
|
|
1160
|
+
currentVersion: state.currentVersion,
|
|
1128
1161
|
newVersion: state.newVersion,
|
|
1129
1162
|
commit: options.commit ? state.commitMessage : false,
|
|
1130
1163
|
tag: options.tag ? state.tagName : false,
|
|
@@ -1212,9 +1245,8 @@ async function updateManifestFile(relPath, operation) {
|
|
|
1212
1245
|
const file = await readJsonFile(relPath, cwd);
|
|
1213
1246
|
if (isManifest(file.data) && file.data.version !== newVersion) {
|
|
1214
1247
|
file.data.version = newVersion;
|
|
1215
|
-
if (isPackageLockManifest(file.data))
|
|
1248
|
+
if (isPackageLockManifest(file.data))
|
|
1216
1249
|
file.data.packages[""].version = newVersion;
|
|
1217
|
-
}
|
|
1218
1250
|
await writeJsonFile(file);
|
|
1219
1251
|
modified = true;
|
|
1220
1252
|
}
|
|
@@ -1222,11 +1254,11 @@ async function updateManifestFile(relPath, operation) {
|
|
|
1222
1254
|
}
|
|
1223
1255
|
async function updateTextFile(relPath, operation) {
|
|
1224
1256
|
const { cwd } = operation.options;
|
|
1225
|
-
const {
|
|
1257
|
+
const { currentVersion, newVersion } = operation.state;
|
|
1226
1258
|
const modified = false;
|
|
1227
1259
|
const file = await readTextFile(relPath, cwd);
|
|
1228
|
-
if (file.data.includes(
|
|
1229
|
-
const sanitizedVersion =
|
|
1260
|
+
if (file.data.includes(currentVersion)) {
|
|
1261
|
+
const sanitizedVersion = currentVersion.replace(/(\W)/g, "\\$1");
|
|
1230
1262
|
const replacePattern = new RegExp(`(\\b|v)${sanitizedVersion}\\b`, "g");
|
|
1231
1263
|
file.data = file.data.replace(replacePattern, `$1${newVersion}`);
|
|
1232
1264
|
await writeTextFile(file);
|
|
@@ -1240,7 +1272,7 @@ async function versionBump(arg = {}) {
|
|
|
1240
1272
|
if (typeof arg === "string")
|
|
1241
1273
|
arg = { release: arg };
|
|
1242
1274
|
const operation = await Operation.start(arg);
|
|
1243
|
-
await
|
|
1275
|
+
await getCurrentVersion(operation);
|
|
1244
1276
|
await getNewVersion(operation);
|
|
1245
1277
|
if (arg.confirm) {
|
|
1246
1278
|
printSummary(operation);
|
|
@@ -1278,7 +1310,7 @@ function printSummary(operation) {
|
|
|
1278
1310
|
if (operation.options.push)
|
|
1279
1311
|
console.log(` push ${import_picocolors2.default.cyan(import_picocolors2.default.bold("yes"))}`);
|
|
1280
1312
|
console.log();
|
|
1281
|
-
console.log(` from ${import_picocolors2.default.bold(operation.state.
|
|
1313
|
+
console.log(` from ${import_picocolors2.default.bold(operation.state.currentVersion)}`);
|
|
1282
1314
|
console.log(` to ${import_picocolors2.default.green(import_picocolors2.default.bold(operation.state.newVersion))}`);
|
|
1283
1315
|
console.log();
|
|
1284
1316
|
}
|
|
@@ -1286,14 +1318,16 @@ async function versionBumpInfo(arg = {}) {
|
|
|
1286
1318
|
if (typeof arg === "string")
|
|
1287
1319
|
arg = { release: arg };
|
|
1288
1320
|
const operation = await Operation.start(arg);
|
|
1289
|
-
await
|
|
1321
|
+
await getCurrentVersion(operation);
|
|
1290
1322
|
await getNewVersion(operation);
|
|
1291
1323
|
return operation;
|
|
1292
1324
|
}
|
|
1293
1325
|
|
|
1294
1326
|
// src/config.ts
|
|
1295
1327
|
var import_node_process6 = __toESM(require("process"));
|
|
1328
|
+
var import_node_path2 = require("path");
|
|
1296
1329
|
var import_c12 = require("c12");
|
|
1330
|
+
var import_sync = __toESM(require("escalade/sync"));
|
|
1297
1331
|
var bumpConfigDefaults = {
|
|
1298
1332
|
commit: true,
|
|
1299
1333
|
push: true,
|
|
@@ -1306,14 +1340,41 @@ var bumpConfigDefaults = {
|
|
|
1306
1340
|
files: []
|
|
1307
1341
|
};
|
|
1308
1342
|
async function loadBumpConfig(overrides, cwd = import_node_process6.default.cwd()) {
|
|
1343
|
+
const name = "bump";
|
|
1344
|
+
const configFile = findConfigFile(name, cwd);
|
|
1309
1345
|
const { config } = await (0, import_c12.loadConfig)({
|
|
1310
|
-
name
|
|
1346
|
+
name,
|
|
1311
1347
|
defaults: bumpConfigDefaults,
|
|
1312
1348
|
overrides: __spreadValues({}, overrides),
|
|
1313
|
-
cwd
|
|
1349
|
+
cwd: configFile ? (0, import_node_path2.dirname)(configFile) : cwd
|
|
1314
1350
|
});
|
|
1315
1351
|
return config;
|
|
1316
1352
|
}
|
|
1353
|
+
function findConfigFile(name, cwd) {
|
|
1354
|
+
let foundRepositoryRoot = false;
|
|
1355
|
+
try {
|
|
1356
|
+
const candidates = ["js", "mjs", "ts", "mts", "json"].map((ext) => `${name}.config.${ext}`);
|
|
1357
|
+
return (0, import_sync.default)(cwd, (_dir, files) => {
|
|
1358
|
+
const match = files.find((file) => {
|
|
1359
|
+
if (candidates.includes(file))
|
|
1360
|
+
return true;
|
|
1361
|
+
if (file === ".git")
|
|
1362
|
+
foundRepositoryRoot = true;
|
|
1363
|
+
return false;
|
|
1364
|
+
});
|
|
1365
|
+
if (match)
|
|
1366
|
+
return match;
|
|
1367
|
+
if (foundRepositoryRoot) {
|
|
1368
|
+
throw null;
|
|
1369
|
+
}
|
|
1370
|
+
return false;
|
|
1371
|
+
});
|
|
1372
|
+
} catch (error) {
|
|
1373
|
+
if (foundRepositoryRoot)
|
|
1374
|
+
return null;
|
|
1375
|
+
throw error;
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1317
1378
|
function defineConfig(config) {
|
|
1318
1379
|
return config;
|
|
1319
1380
|
}
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bumpp",
|
|
3
|
-
"version": "9.
|
|
4
|
-
"packageManager": "pnpm@
|
|
3
|
+
"version": "9.4.1",
|
|
4
|
+
"packageManager": "pnpm@9.0.6",
|
|
5
5
|
"description": "Bump version, commit changes, tag, and push to Git",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "James Messinger",
|
|
@@ -51,35 +51,39 @@
|
|
|
51
51
|
"build": "tsup src/index.ts src/cli/index.ts --format esm,cjs --dts --clean",
|
|
52
52
|
"watch": "npm run build -- --watch src",
|
|
53
53
|
"start": "esno src/cli/run.ts",
|
|
54
|
+
"test": "vitest",
|
|
54
55
|
"upgrade": "npm-check -u && npm audit fix",
|
|
55
56
|
"bumpp": "esno src/cli/run.ts",
|
|
56
57
|
"prepublishOnly": "npm run clean && npm run build",
|
|
57
|
-
"release": "npm run bumpp && npm publish"
|
|
58
|
+
"release": "npm run bumpp && npm publish",
|
|
59
|
+
"typecheck": "tsc --noEmit"
|
|
58
60
|
},
|
|
59
61
|
"dependencies": {
|
|
60
62
|
"@jsdevtools/ez-spawn": "^3.0.4",
|
|
61
|
-
"c12": "^1.
|
|
63
|
+
"c12": "^1.10.0",
|
|
62
64
|
"cac": "^6.7.14",
|
|
65
|
+
"escalade": "^3.1.2",
|
|
63
66
|
"fast-glob": "^3.3.2",
|
|
64
67
|
"js-yaml": "^4.1.0",
|
|
65
68
|
"prompts": "^2.4.2",
|
|
66
69
|
"semver": "^7.6.0"
|
|
67
70
|
},
|
|
68
71
|
"devDependencies": {
|
|
69
|
-
"@antfu/eslint-config": "^2.
|
|
72
|
+
"@antfu/eslint-config": "^2.16.0",
|
|
70
73
|
"@types/js-yaml": "^4.0.9",
|
|
71
|
-
"@types/node": "^20.
|
|
74
|
+
"@types/node": "^20.12.7",
|
|
72
75
|
"@types/prompts": "^2.4.9",
|
|
73
76
|
"@types/semver": "^7.5.8",
|
|
74
77
|
"detect-indent": "^7.0.1",
|
|
75
78
|
"detect-newline": "^4.0.1",
|
|
76
|
-
"eslint": "^
|
|
77
|
-
"esno": "^4.
|
|
79
|
+
"eslint": "^9.1.1",
|
|
80
|
+
"esno": "^4.7.0",
|
|
78
81
|
"log-symbols": "^6.0.0",
|
|
79
82
|
"npm-check": "^6.0.1",
|
|
80
83
|
"picocolors": "^1.0.0",
|
|
81
84
|
"rimraf": "^5.0.5",
|
|
82
85
|
"tsup": "^8.0.2",
|
|
83
|
-
"typescript": "^5.
|
|
86
|
+
"typescript": "^5.4.5",
|
|
87
|
+
"vitest": "^1.5.2"
|
|
84
88
|
}
|
|
85
89
|
}
|