@quiteer/scripts 0.0.2 → 0.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 +9 -6
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { execa } from "execa";
|
|
|
8
8
|
import { rimraf } from "rimraf";
|
|
9
9
|
import { loadConfig } from "c12";
|
|
10
10
|
import { readFileSync } from "node:fs";
|
|
11
|
-
import
|
|
11
|
+
import enquirer from "enquirer";
|
|
12
12
|
import { versionBump } from "bumpp";
|
|
13
13
|
|
|
14
14
|
//#region package.json
|
|
@@ -526,15 +526,16 @@ async function generateConfig() {
|
|
|
526
526
|
* @returns {Promise<void>} 异步任务
|
|
527
527
|
*/
|
|
528
528
|
async function gitCommitAdd() {
|
|
529
|
+
const { prompt: ask } = enquirer;
|
|
529
530
|
try {
|
|
530
|
-
if (!!!(await
|
|
531
|
+
if (!!!(await ask([{
|
|
531
532
|
name: "confirm",
|
|
532
533
|
type: "confirm",
|
|
533
534
|
message: "是否添加所有变更文件到暂存区?"
|
|
534
535
|
}]))?.confirm) {
|
|
535
536
|
const files = (await execCommand("git", ["diff", "--name-only"])).split("\n").filter(Boolean);
|
|
536
537
|
if (files.length === 0) return;
|
|
537
|
-
const selected = (await
|
|
538
|
+
const selected = (await ask([{
|
|
538
539
|
name: "selected",
|
|
539
540
|
type: "multiselect",
|
|
540
541
|
message: "选择需要添加到暂存区的文件(空格选择,回车确认)",
|
|
@@ -558,6 +559,7 @@ async function gitCommitAdd() {
|
|
|
558
559
|
*/
|
|
559
560
|
async function gitCommit(lang = "en-us") {
|
|
560
561
|
try {
|
|
562
|
+
const { prompt: ask } = enquirer;
|
|
561
563
|
const { gitCommitMessages, gitCommitTypes, gitCommitScopes } = locales[lang];
|
|
562
564
|
const typesChoices = gitCommitTypes.map(([value, msg]) => {
|
|
563
565
|
return {
|
|
@@ -569,7 +571,7 @@ async function gitCommit(lang = "en-us") {
|
|
|
569
571
|
name: value,
|
|
570
572
|
message: `${value.padEnd(30)} (${msg})`
|
|
571
573
|
}));
|
|
572
|
-
const result = await
|
|
574
|
+
const result = await ask([
|
|
573
575
|
{
|
|
574
576
|
name: "types",
|
|
575
577
|
type: "select",
|
|
@@ -621,6 +623,7 @@ async function gitCommitVerify(lang = "zh-cn", ignores = []) {
|
|
|
621
623
|
* @returns {Promise<void>} 异步任务
|
|
622
624
|
*/
|
|
623
625
|
async function release(tagPrefix) {
|
|
626
|
+
const { prompt: ask } = enquirer;
|
|
624
627
|
const repoRoot = await execCommand("git", ["rev-parse", "--show-toplevel"]);
|
|
625
628
|
const files = (await execCommand("git", [
|
|
626
629
|
"-C",
|
|
@@ -637,7 +640,7 @@ async function release(tagPrefix) {
|
|
|
637
640
|
value: rel
|
|
638
641
|
});
|
|
639
642
|
} catch {}
|
|
640
|
-
const selected = ((await
|
|
643
|
+
const selected = ((await ask([{
|
|
641
644
|
name: "selected",
|
|
642
645
|
type: "multiselect",
|
|
643
646
|
message: "选择需要提升版本的包(空格选择,回车确认)",
|
|
@@ -656,7 +659,7 @@ async function release(tagPrefix) {
|
|
|
656
659
|
const version$1 = JSON.parse(await readFile(firstPkgPath, "utf8")).version;
|
|
657
660
|
let prefix = tagPrefix;
|
|
658
661
|
if (prefix === void 0) try {
|
|
659
|
-
prefix = (await
|
|
662
|
+
prefix = (await ask([{
|
|
660
663
|
name: "prefix",
|
|
661
664
|
type: "text",
|
|
662
665
|
message: "请输入标签前缀(可留空)"
|