qkpr 1.0.2 → 1.0.3
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/index.mjs +16 -61
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1252,37 +1252,9 @@ async function promptBranchSelection(branches, options) {
|
|
|
1252
1252
|
pinnedBranches.sort((a, b) => {
|
|
1253
1253
|
return pinnedBranchNames.indexOf(a.name) - pinnedBranchNames.indexOf(b.name);
|
|
1254
1254
|
});
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
categorizedBranches.get(branch.category).push(branch);
|
|
1259
|
-
});
|
|
1260
|
-
categorizedBranches.forEach((branches$1) => {
|
|
1261
|
-
branches$1.sort((a, b) => b.lastCommitTime - a.lastCommitTime);
|
|
1262
|
-
});
|
|
1263
|
-
const categoryOrder = [
|
|
1264
|
-
"main",
|
|
1265
|
-
"release",
|
|
1266
|
-
"feat",
|
|
1267
|
-
"fix",
|
|
1268
|
-
"merge",
|
|
1269
|
-
"refactor",
|
|
1270
|
-
"hotfix",
|
|
1271
|
-
"chore",
|
|
1272
|
-
"docs",
|
|
1273
|
-
"test",
|
|
1274
|
-
"style"
|
|
1275
|
-
];
|
|
1276
|
-
const sortedCategories = Array.from(categorizedBranches.keys()).sort((a, b) => {
|
|
1277
|
-
const aIndex = categoryOrder.indexOf(a);
|
|
1278
|
-
const bIndex = categoryOrder.indexOf(b);
|
|
1279
|
-
if (aIndex !== -1 && bIndex !== -1) return aIndex - bIndex;
|
|
1280
|
-
if (aIndex !== -1) return -1;
|
|
1281
|
-
if (bIndex !== -1) return 1;
|
|
1282
|
-
if (a === "other") return 1;
|
|
1283
|
-
if (b === "other") return -1;
|
|
1284
|
-
return a.localeCompare(b);
|
|
1285
|
-
});
|
|
1255
|
+
regularBranches.sort((a, b) => a.name.localeCompare(b.name));
|
|
1256
|
+
const MAX_BRANCHES = 100;
|
|
1257
|
+
if (regularBranches.length > MAX_BRANCHES) regularBranches.splice(MAX_BRANCHES);
|
|
1286
1258
|
const choices = [];
|
|
1287
1259
|
if (pinnedBranches.length > 0) {
|
|
1288
1260
|
choices.push(new inquirer.Separator(magenta("━━━━━━━━ 📌 Pinned Branches ━━━━━━━━")));
|
|
@@ -1295,25 +1267,17 @@ async function promptBranchSelection(branches, options) {
|
|
|
1295
1267
|
});
|
|
1296
1268
|
choices.push(new inquirer.Separator(" "));
|
|
1297
1269
|
}
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
else categoryLabel = `${category}/*`;
|
|
1306
|
-
choices.push(new inquirer.Separator(cyan(`━━━━━━━━ ${categoryLabel} ━━━━━━━━`)));
|
|
1307
|
-
branches$1.forEach((branch) => {
|
|
1308
|
-
choices.push({
|
|
1309
|
-
name: ` ${branch.name.padEnd(45)} ${dim(`(${branch.lastCommitTimeFormatted})`)}`,
|
|
1310
|
-
value: branch.name,
|
|
1311
|
-
short: branch.name
|
|
1312
|
-
});
|
|
1270
|
+
if (regularBranches.length > 0) {
|
|
1271
|
+
choices.push(new inquirer.Separator(cyan("━━━━━━━━ 🌿 All Branches (Alphabetical) ━━━━━━━━")));
|
|
1272
|
+
regularBranches.forEach((branch) => {
|
|
1273
|
+
choices.push({
|
|
1274
|
+
name: ` ${branch.name.padEnd(45)} ${dim(`(${branch.lastCommitTimeFormatted})`)}`,
|
|
1275
|
+
value: branch.name,
|
|
1276
|
+
short: branch.name
|
|
1313
1277
|
});
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
}
|
|
1278
|
+
});
|
|
1279
|
+
choices.push(new inquirer.Separator(" "));
|
|
1280
|
+
}
|
|
1317
1281
|
const searchBranches = async (_answers, input = "") => {
|
|
1318
1282
|
const lowerInput = input.toLowerCase();
|
|
1319
1283
|
return choices.filter((choice) => {
|
|
@@ -1332,20 +1296,11 @@ async function promptBranchSelection(branches, options) {
|
|
|
1332
1296
|
}]);
|
|
1333
1297
|
return selectedBranch;
|
|
1334
1298
|
} else {
|
|
1335
|
-
const allBranches = [...pinnedBranches, ...regularBranches];
|
|
1336
|
-
allBranches.sort((a, b) => a.name.localeCompare(b.name));
|
|
1337
|
-
const simpleChoices = allBranches.map((branch) => {
|
|
1338
|
-
return {
|
|
1339
|
-
name: `${pinnedBranchNames.includes(branch.name) ? "📌 " : " "}${branch.name.padEnd(45)} ${dim(`(${branch.lastCommitTimeFormatted})`)}`,
|
|
1340
|
-
value: branch.name,
|
|
1341
|
-
short: branch.name
|
|
1342
|
-
};
|
|
1343
|
-
});
|
|
1344
1299
|
const { selectedBranches } = await inquirer.prompt([{
|
|
1345
1300
|
type: "search-checkbox",
|
|
1346
1301
|
name: "selectedBranches",
|
|
1347
1302
|
message,
|
|
1348
|
-
choices
|
|
1303
|
+
choices
|
|
1349
1304
|
}]);
|
|
1350
1305
|
return selectedBranches || [];
|
|
1351
1306
|
}
|
|
@@ -1784,9 +1739,9 @@ async function showMainMenu() {
|
|
|
1784
1739
|
}
|
|
1785
1740
|
function printPRBanner() {
|
|
1786
1741
|
console.log(bold(cyan("\n╔══════════════════════════════════════════════════════════════╗")));
|
|
1787
|
-
console.log(bold(cyan("║ 🔧 Quick PR Creator
|
|
1742
|
+
console.log(bold(cyan("║ 🔧 Quick PR Creator ║")));
|
|
1788
1743
|
console.log(bold(cyan("║ ║")));
|
|
1789
|
-
console.log(bold(cyan("║ Interactive PR Creation Tool
|
|
1744
|
+
console.log(bold(cyan("║ Interactive PR Creation Tool ║")));
|
|
1790
1745
|
console.log(bold(cyan("╚══════════════════════════════════════════════════════════════╝")));
|
|
1791
1746
|
console.log(` Version: ${version}\n`);
|
|
1792
1747
|
}
|