@ucdjs/release-scripts 0.1.0-beta.47 → 0.1.0-beta.48

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.
Files changed (2) hide show
  1. package/dist/index.mjs +84 -77
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1068,77 +1068,91 @@ async function selectVersionPrompt(workspaceRoot, pkg, currentVersion, suggested
1068
1068
  const prePatchAlpha = getNextPrereleaseVersion(currentVersion, "prepatch", "alpha");
1069
1069
  const preMinorAlpha = getNextPrereleaseVersion(currentVersion, "preminor", "alpha");
1070
1070
  const preMajorAlpha = getNextPrereleaseVersion(currentVersion, "premajor", "alpha");
1071
- const initial = defaultChoice === "skip" ? 0 : defaultChoice === "suggested" ? 4 : defaultChoice === "as-is" ? 5 : suggestedVersion === currentVersion ? 0 : 4;
1071
+ const choices = [
1072
+ {
1073
+ value: "skip",
1074
+ title: `skip ${farver.dim("(no change)")}`
1075
+ },
1076
+ {
1077
+ value: "suggested",
1078
+ title: `suggested ${farver.bold(suggestedVersion)}${suggestedSuffix}`
1079
+ },
1080
+ {
1081
+ value: "as-is",
1082
+ title: `as-is ${farver.dim("(keep current version)")}`
1083
+ },
1084
+ {
1085
+ value: "major",
1086
+ title: `major ${farver.bold(getNextVersion(pkg.version, "major"))}`
1087
+ },
1088
+ {
1089
+ value: "minor",
1090
+ title: `minor ${farver.bold(getNextVersion(pkg.version, "minor"))}`
1091
+ },
1092
+ {
1093
+ value: "patch",
1094
+ title: `patch ${farver.bold(getNextVersion(pkg.version, "patch"))}`
1095
+ },
1096
+ {
1097
+ value: "next",
1098
+ title: `next ${farver.bold(nextDefaultPrerelease)}`
1099
+ },
1100
+ {
1101
+ value: "prepatch-beta",
1102
+ title: `pre-patch (beta) ${farver.bold(prePatchBeta)}`
1103
+ },
1104
+ {
1105
+ value: "preminor-beta",
1106
+ title: `pre-minor (beta) ${farver.bold(preMinorBeta)}`
1107
+ },
1108
+ {
1109
+ value: "premajor-beta",
1110
+ title: `pre-major (beta) ${farver.bold(preMajorBeta)}`
1111
+ },
1112
+ {
1113
+ value: "prepatch-alpha",
1114
+ title: `pre-patch (alpha) ${farver.bold(prePatchAlpha)}`
1115
+ },
1116
+ {
1117
+ value: "preminor-alpha",
1118
+ title: `pre-minor (alpha) ${farver.bold(preMinorAlpha)}`
1119
+ },
1120
+ {
1121
+ value: "premajor-alpha",
1122
+ title: `pre-major (alpha) ${farver.bold(preMajorAlpha)}`
1123
+ },
1124
+ {
1125
+ value: "next-beta",
1126
+ title: `next beta ${farver.bold(nextBeta)}`
1127
+ },
1128
+ {
1129
+ value: "next-alpha",
1130
+ title: `next alpha ${farver.bold(nextAlpha)}`
1131
+ },
1132
+ {
1133
+ value: "custom",
1134
+ title: "custom"
1135
+ }
1136
+ ];
1137
+ const initialValue = defaultChoice === "auto" ? suggestedVersion === currentVersion ? "skip" : "suggested" : defaultChoice;
1138
+ const initial = Math.max(0, choices.findIndex((choice) => choice.value === initialValue));
1139
+ const prereleaseVersionByChoice = {
1140
+ "next": nextDefaultPrerelease,
1141
+ "next-beta": nextBeta,
1142
+ "next-alpha": nextAlpha,
1143
+ "prepatch-beta": prePatchBeta,
1144
+ "preminor-beta": preMinorBeta,
1145
+ "premajor-beta": preMajorBeta,
1146
+ "prepatch-alpha": prePatchAlpha,
1147
+ "preminor-alpha": preMinorAlpha,
1148
+ "premajor-alpha": preMajorAlpha
1149
+ };
1072
1150
  const answers = await prompts([{
1073
1151
  type: "autocomplete",
1074
1152
  name: "version",
1075
1153
  message: `${pkg.name}: ${farver.green(pkg.version)}`,
1076
- choices: [
1077
- {
1078
- value: "skip",
1079
- title: `skip ${farver.dim("(no change)")}`
1080
- },
1081
- {
1082
- value: "major",
1083
- title: `major ${farver.bold(getNextVersion(pkg.version, "major"))}`
1084
- },
1085
- {
1086
- value: "minor",
1087
- title: `minor ${farver.bold(getNextVersion(pkg.version, "minor"))}`
1088
- },
1089
- {
1090
- value: "patch",
1091
- title: `patch ${farver.bold(getNextVersion(pkg.version, "patch"))}`
1092
- },
1093
- {
1094
- value: "next",
1095
- title: `next ${farver.bold(nextDefaultPrerelease)}`
1096
- },
1097
- {
1098
- value: "prepatch-beta",
1099
- title: `pre-patch (beta) ${farver.bold(prePatchBeta)}`
1100
- },
1101
- {
1102
- value: "preminor-beta",
1103
- title: `pre-minor (beta) ${farver.bold(preMinorBeta)}`
1104
- },
1105
- {
1106
- value: "premajor-beta",
1107
- title: `pre-major (beta) ${farver.bold(preMajorBeta)}`
1108
- },
1109
- {
1110
- value: "prepatch-alpha",
1111
- title: `pre-patch (alpha) ${farver.bold(prePatchAlpha)}`
1112
- },
1113
- {
1114
- value: "preminor-alpha",
1115
- title: `pre-minor (alpha) ${farver.bold(preMinorAlpha)}`
1116
- },
1117
- {
1118
- value: "premajor-alpha",
1119
- title: `pre-major (alpha) ${farver.bold(preMajorAlpha)}`
1120
- },
1121
- {
1122
- value: "next-beta",
1123
- title: `next beta ${farver.bold(nextBeta)}`
1124
- },
1125
- {
1126
- value: "next-alpha",
1127
- title: `next alpha ${farver.bold(nextAlpha)}`
1128
- },
1129
- {
1130
- value: "suggested",
1131
- title: `suggested ${farver.bold(suggestedVersion)}${suggestedSuffix}`
1132
- },
1133
- {
1134
- value: "as-is",
1135
- title: `as-is ${farver.dim("(keep current version)")}`
1136
- },
1137
- {
1138
- value: "custom",
1139
- title: "custom"
1140
- }
1141
- ],
1154
+ choices,
1155
+ limit: choices.length,
1142
1156
  initial
1143
1157
  }, {
1144
1158
  type: (prev) => prev === "custom" ? "text" : null,
@@ -1157,16 +1171,9 @@ async function selectVersionPrompt(workspaceRoot, pkg, currentVersion, suggested
1157
1171
  if (!answers.custom) return null;
1158
1172
  return answers.custom;
1159
1173
  } else if (answers.version === "as-is") return currentVersion;
1160
- else if (answers.version === "next") return nextDefaultPrerelease;
1161
- else if (answers.version === "next-beta") return nextBeta;
1162
- else if (answers.version === "next-alpha") return nextAlpha;
1163
- else if (answers.version === "prepatch-beta") return prePatchBeta;
1164
- else if (answers.version === "preminor-beta") return preMinorBeta;
1165
- else if (answers.version === "premajor-beta") return preMajorBeta;
1166
- else if (answers.version === "prepatch-alpha") return prePatchAlpha;
1167
- else if (answers.version === "preminor-alpha") return preMinorAlpha;
1168
- else if (answers.version === "premajor-alpha") return preMajorAlpha;
1169
- else return getNextVersion(pkg.version, answers.version);
1174
+ const prereleaseVersion = prereleaseVersionByChoice[answers.version];
1175
+ if (prereleaseVersion) return prereleaseVersion;
1176
+ return getNextVersion(pkg.version, answers.version);
1170
1177
  }
1171
1178
 
1172
1179
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucdjs/release-scripts",
3
- "version": "0.1.0-beta.47",
3
+ "version": "0.1.0-beta.48",
4
4
  "description": "@ucdjs release scripts",
5
5
  "type": "module",
6
6
  "license": "MIT",