@simon_he/pi 0.0.54 → 0.0.56
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/README.md +12 -0
- package/dist/index.cjs +93 -44
- package/dist/index.js +93 -44
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -40,6 +40,18 @@ A smart package manager with a custom loading style, which makes you install dep
|
|
|
40
40
|
- others
|
|
41
41
|

|
|
42
42
|
|
|
43
|
+
## :phone: Language
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
# Export environment variables in your bash or zsh
|
|
47
|
+
|
|
48
|
+
# Chinese
|
|
49
|
+
export PI_Lang=zh
|
|
50
|
+
|
|
51
|
+
# English
|
|
52
|
+
export PI_Lang=en
|
|
53
|
+
```
|
|
54
|
+
|
|
43
55
|
## :gear: Install
|
|
44
56
|
|
|
45
57
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -6362,6 +6362,7 @@ var Dw = /\s-Dw/;
|
|
|
6362
6362
|
var w = /\s-w/;
|
|
6363
6363
|
var D = /\s-D(?!w)/;
|
|
6364
6364
|
var d = /\s-d(?!w)/;
|
|
6365
|
+
var isZh = process.env.PI_Lang === "zh";
|
|
6365
6366
|
async function getParams(params) {
|
|
6366
6367
|
var _a, _b;
|
|
6367
6368
|
const root = process.cwd();
|
|
@@ -6422,7 +6423,9 @@ async function getParams(params) {
|
|
|
6422
6423
|
}
|
|
6423
6424
|
} catch (err) {
|
|
6424
6425
|
console.log(
|
|
6425
|
-
import_picocolors.default.red(
|
|
6426
|
+
import_picocolors.default.red(
|
|
6427
|
+
`${isZh ? "package.json\u5E76\u4E0D\u5B58\u5728,\u5728\u4EE5\u4E0B\u76EE\u5F55\u4E2D:" : "package.json has not been found in"} ${process.cwd()}`
|
|
6428
|
+
)
|
|
6426
6429
|
);
|
|
6427
6430
|
process.exit(1);
|
|
6428
6431
|
}
|
|
@@ -6448,13 +6451,16 @@ async function getStyle() {
|
|
|
6448
6451
|
var import_lazy_js_utils2 = require("lazy-js-utils");
|
|
6449
6452
|
|
|
6450
6453
|
// package.json
|
|
6451
|
-
var version = "0.0.
|
|
6454
|
+
var version = "0.0.56";
|
|
6452
6455
|
|
|
6453
6456
|
// src/help.ts
|
|
6457
|
+
var isZh2 = process.env.PI_Lang === "zh";
|
|
6454
6458
|
function help(argv) {
|
|
6455
6459
|
const arg = argv[0];
|
|
6456
6460
|
if (arg === "-v" || arg === "--version") {
|
|
6457
|
-
(0, import_lazy_js_utils2.jsShell)(
|
|
6461
|
+
(0, import_lazy_js_utils2.jsShell)(
|
|
6462
|
+
isZh2 ? `gum style --foreground 212 --border-foreground 212 --border double --align center --width 50 --margin "1 2" --padding "2 4" "pi \u7248\u672C: ${version}" "\u8BF7\u4E3A\u6211\u7684\u52AA\u529B\u70B9\u4E00\u4E2A\u884C \u{1F31F}" "\u8C22\u8C22 \u{1F91F}"` : `gum style --foreground 212 --border-foreground 212 --border double --align center --width 50 --margin "1 2" --padding "2 4" "pi version: ${version}" "Please give me a \u{1F31F} for my efforts" "Thank you \u{1F91F}"`
|
|
6463
|
+
);
|
|
6458
6464
|
process.exit(0);
|
|
6459
6465
|
} else if (arg === "-h" || arg === "--help") {
|
|
6460
6466
|
(0, import_lazy_js_utils2.jsShell)(
|
|
@@ -6483,10 +6489,11 @@ async function installDeps() {
|
|
|
6483
6489
|
var import_process = __toESM(require("process"), 1);
|
|
6484
6490
|
var import_lazy_js_utils4 = require("lazy-js-utils");
|
|
6485
6491
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
6492
|
+
var isZh3 = import_process.default.env.PI_Lang === "zh";
|
|
6486
6493
|
async function pi(params, pkg, executor = "ni") {
|
|
6487
6494
|
const text = pkg ? `Installing ${pkg} ...` : "Updating dependency ...";
|
|
6488
|
-
const successMsg = pkg ? `Installed ${pkg} successfully! \u{1F60A}` : "Updated dependency successfully! \u{1F60A}";
|
|
6489
|
-
const failMsg = pkg ? `Failed to install ${pkg} \u{1F62D}` : "Failed to update dependency
|
|
6495
|
+
const successMsg = pkg ? isZh3 ? `${pkg} \u5B89\u88C5\u6210\u529F! \u{1F60A}` : `Installed ${pkg} successfully! \u{1F60A}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u6210\u529F! \u{1F60A}" : "Updated dependency successfully! \u{1F60A}";
|
|
6496
|
+
const failMsg = pkg ? isZh3 ? `${pkg} \u5B89\u88C5\u5931\u8D25 \u{1F62D}` : `Failed to install ${pkg} \u{1F62D}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u5931\u8D25 \u{1F62D}" : "Failed to update dependency \u{1F62D}";
|
|
6490
6497
|
const newParams = executor === "pil" ? params : await getParams(params);
|
|
6491
6498
|
let stdio = "pipe";
|
|
6492
6499
|
let loading_status;
|
|
@@ -6515,11 +6522,18 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
6515
6522
|
if (status === 0) {
|
|
6516
6523
|
loading_status.succeed(import_picocolors2.default.green(successMsg));
|
|
6517
6524
|
} else {
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6525
|
+
if (result.indexOf("Not Found - 404")) {
|
|
6526
|
+
const _result = isZh3 ? `${pkg} \u5305\u540D\u53EF\u80FD\u6709\u8BEF\uFF0C\u5E76\u4E0D\u80FD\u5728npm\u4E2D\u641C\u7D22\u5230\uFF0C\u8BF7\u68C0\u67E5` : `${pkg} the package name may be wrong, and cannot be found in npm, please check`;
|
|
6527
|
+
loading_status.fail(
|
|
6528
|
+
import_picocolors2.default.red(result ? `${failMsg}
|
|
6529
|
+
${_result}` : failMsg)
|
|
6530
|
+
);
|
|
6531
|
+
} else {
|
|
6532
|
+
loading_status.fail(
|
|
6533
|
+
import_picocolors2.default.red(result ? `${failMsg}
|
|
6534
|
+
${result}` : failMsg)
|
|
6535
|
+
);
|
|
6536
|
+
}
|
|
6523
6537
|
}
|
|
6524
6538
|
if (result) {
|
|
6525
6539
|
const reg = / No matching version found for ([\w\-\_@\^.]+)/;
|
|
@@ -6591,7 +6605,7 @@ async function pinit() {
|
|
|
6591
6605
|
// src/pix.ts
|
|
6592
6606
|
var import_lazy_js_utils8 = require("lazy-js-utils");
|
|
6593
6607
|
async function pix(params) {
|
|
6594
|
-
switch ((0, import_lazy_js_utils8.getPkgTool)()) {
|
|
6608
|
+
switch (await (0, import_lazy_js_utils8.getPkgTool)()) {
|
|
6595
6609
|
case "bun":
|
|
6596
6610
|
return (0, import_lazy_js_utils8.jsShell)(`bunx ${params}`);
|
|
6597
6611
|
default:
|
|
@@ -6614,13 +6628,11 @@ function pu() {
|
|
|
6614
6628
|
// src/pui.ts
|
|
6615
6629
|
var import_lazy_js_utils11 = require("lazy-js-utils");
|
|
6616
6630
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
6631
|
+
var isZh4 = process.env.PI_Lang === "zh";
|
|
6617
6632
|
async function pui(params, pkg) {
|
|
6618
|
-
const text =
|
|
6619
|
-
`;
|
|
6620
|
-
const
|
|
6621
|
-
UnInstalled ${pkg} successfully! \u{1F60A}`;
|
|
6622
|
-
const failMsg = `
|
|
6623
|
-
Failed to uninstall ${pkg} \u{1F62D}`;
|
|
6633
|
+
const text = `${isZh4 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${pkg} ...`;
|
|
6634
|
+
const successMsg = isZh4 ? `${pkg}\u5378\u8F7D\u6210\u529F! \u{1F60A}` : `UnInstalled ${pkg} successfully! \u{1F60A}`;
|
|
6635
|
+
const failMsg = isZh4 ? `${pkg}\u5378\u8F7D\u5931\u8D25 \u{1F62D}` : `Failed to uninstall ${pkg} \u{1F62D}`;
|
|
6624
6636
|
if (!pkg) {
|
|
6625
6637
|
console.log("Need to specify an uninstall package name");
|
|
6626
6638
|
process.exit(1);
|
|
@@ -6672,6 +6684,7 @@ var runMap = {
|
|
|
6672
6684
|
pfind,
|
|
6673
6685
|
pio
|
|
6674
6686
|
};
|
|
6687
|
+
var isZh5 = import_process3.default.env.PI_Lang === "zh";
|
|
6675
6688
|
async function setup() {
|
|
6676
6689
|
const cmd = import_process3.default.argv[1];
|
|
6677
6690
|
let exec = "";
|
|
@@ -6688,21 +6701,35 @@ async function setup() {
|
|
|
6688
6701
|
if (!(0, import_lazy_js_utils13.hasPkg)(rootPath)) {
|
|
6689
6702
|
if ((0, import_lazy_js_utils13.isGo)()) {
|
|
6690
6703
|
if (exec === "pi") {
|
|
6691
|
-
const loading_status = await loading(
|
|
6692
|
-
|
|
6704
|
+
const loading_status = await loading(
|
|
6705
|
+
`${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5" : "Installing"} ${params} ...
|
|
6706
|
+
`
|
|
6707
|
+
);
|
|
6693
6708
|
const { status } = await (0, import_lazy_js_utils13.useNodeWorker)(`go get ${params}`);
|
|
6694
|
-
if (status === 0)
|
|
6695
|
-
loading_status.succeed(
|
|
6696
|
-
|
|
6697
|
-
|
|
6709
|
+
if (status === 0) {
|
|
6710
|
+
loading_status.succeed(
|
|
6711
|
+
import_picocolors5.default.green(isZh5 ? "\u5B89\u88C5\u6210\u529F! \u{1F60A}" : "Installed successfully! \u{1F60A}")
|
|
6712
|
+
);
|
|
6713
|
+
} else {
|
|
6714
|
+
loading_status.fail(
|
|
6715
|
+
import_picocolors5.default.red(isZh5 ? "\u5B89\u88C5\u5931\u8D25 \u{1F62D}" : "Failed to install \u{1F62D}")
|
|
6716
|
+
);
|
|
6717
|
+
}
|
|
6698
6718
|
} else if (exec === "pui") {
|
|
6699
|
-
const loading_status = await loading(
|
|
6700
|
-
|
|
6719
|
+
const loading_status = await loading(
|
|
6720
|
+
`${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${params} ...
|
|
6721
|
+
`
|
|
6722
|
+
);
|
|
6701
6723
|
const { status } = await (0, import_lazy_js_utils13.useNodeWorker)(`go clean ${params}`);
|
|
6702
|
-
if (status === 0)
|
|
6703
|
-
loading_status.succeed(
|
|
6704
|
-
|
|
6705
|
-
|
|
6724
|
+
if (status === 0) {
|
|
6725
|
+
loading_status.succeed(
|
|
6726
|
+
import_picocolors5.default.green(isZh5 ? "\u5378\u8F7D\u6210\u529F! \u{1F60A}" : "Uninstalled successfully! \u{1F60A}")
|
|
6727
|
+
);
|
|
6728
|
+
} else {
|
|
6729
|
+
loading_status.fail(
|
|
6730
|
+
import_picocolors5.default.red(isZh5 ? "\u5378\u8F7D\u5931\u8D25 \u{1F62D}" : "Failed to uninstall \u{1F62D}")
|
|
6731
|
+
);
|
|
6732
|
+
}
|
|
6706
6733
|
} else if (exec === "prun") {
|
|
6707
6734
|
const match = params ? params.endsWith(".go") ? [`**/${params}`] : [`**/${params}.go`, `**/${params}/main.go`] : "main.go";
|
|
6708
6735
|
const target = (await (0, import_fast_glob.default)(match))[0];
|
|
@@ -6716,27 +6743,45 @@ async function setup() {
|
|
|
6716
6743
|
} else if (exec === "pbuild") {
|
|
6717
6744
|
(0, import_lazy_js_utils13.jsShell)(`go build ${params}`);
|
|
6718
6745
|
} else {
|
|
6719
|
-
console.log(
|
|
6746
|
+
console.log(
|
|
6747
|
+
import_picocolors5.default.red(
|
|
6748
|
+
isZh5 ? "\u5F53\u524D\u6307\u4EE4\u8FD8\u4E0D\u652F\u6301" : "The commands is not supported"
|
|
6749
|
+
)
|
|
6750
|
+
);
|
|
6720
6751
|
}
|
|
6721
6752
|
import_process3.default.exit();
|
|
6722
6753
|
}
|
|
6723
6754
|
if ((0, import_lazy_js_utils13.isRust)()) {
|
|
6724
6755
|
if (exec === "pi") {
|
|
6725
|
-
const loading_status = await loading(
|
|
6726
|
-
|
|
6756
|
+
const loading_status = await loading(
|
|
6757
|
+
`${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5" : "Installing"} ${params} ...
|
|
6758
|
+
`
|
|
6759
|
+
);
|
|
6727
6760
|
const { status } = await (0, import_lazy_js_utils13.useNodeWorker)(`cargo install ${params}`);
|
|
6728
|
-
if (status === 0)
|
|
6729
|
-
loading_status.succeed(
|
|
6730
|
-
|
|
6731
|
-
|
|
6761
|
+
if (status === 0) {
|
|
6762
|
+
loading_status.succeed(
|
|
6763
|
+
import_picocolors5.default.green(isZh5 ? "\u5B89\u88C5\u6210\u529F! \u{1F60A}" : "Installed successfully! \u{1F60A}")
|
|
6764
|
+
);
|
|
6765
|
+
} else {
|
|
6766
|
+
loading_status.fail(
|
|
6767
|
+
import_picocolors5.default.red(isZh5 ? "\u5B89\u88C5\u5931\u8D25 \u{1F62D}" : "Failed to install \u{1F62D}")
|
|
6768
|
+
);
|
|
6769
|
+
}
|
|
6732
6770
|
} else if (exec === "pui") {
|
|
6733
|
-
const loading_status = await loading(
|
|
6734
|
-
|
|
6771
|
+
const loading_status = await loading(
|
|
6772
|
+
`${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${params} ...
|
|
6773
|
+
`
|
|
6774
|
+
);
|
|
6735
6775
|
const { status } = await (0, import_lazy_js_utils13.useNodeWorker)(`cargo uninstall ${params}`);
|
|
6736
|
-
if (status === 0)
|
|
6737
|
-
loading_status.succeed(
|
|
6738
|
-
|
|
6739
|
-
|
|
6776
|
+
if (status === 0) {
|
|
6777
|
+
loading_status.succeed(
|
|
6778
|
+
import_picocolors5.default.green(isZh5 ? "\u5378\u8F7D\u6210\u529F! \u{1F60A}" : "Uninstalled successfully! \u{1F60A}")
|
|
6779
|
+
);
|
|
6780
|
+
} else {
|
|
6781
|
+
loading_status.fail(
|
|
6782
|
+
import_picocolors5.default.red(isZh5 ? "\u5378\u8F7D\u5931\u8D25 \u{1F62D}" : "Failed to uninstall \u{1F62D}")
|
|
6783
|
+
);
|
|
6784
|
+
}
|
|
6740
6785
|
} else if (exec === "prun") {
|
|
6741
6786
|
(0, import_lazy_js_utils13.jsShell)(`cargo run ${params}`);
|
|
6742
6787
|
} else if (exec === "pinit") {
|
|
@@ -6744,14 +6789,18 @@ async function setup() {
|
|
|
6744
6789
|
} else if (exec === "pbuild") {
|
|
6745
6790
|
(0, import_lazy_js_utils13.jsShell)(`cargo build ${params}`);
|
|
6746
6791
|
} else {
|
|
6747
|
-
console.log(
|
|
6792
|
+
console.log(
|
|
6793
|
+
import_picocolors5.default.red(
|
|
6794
|
+
isZh5 ? "\u5F53\u524D\u6307\u4EE4\u8FD8\u4E0D\u652F\u6301" : "The commands is not supported"
|
|
6795
|
+
)
|
|
6796
|
+
);
|
|
6748
6797
|
}
|
|
6749
6798
|
import_process3.default.exit();
|
|
6750
6799
|
}
|
|
6751
6800
|
if (!runMap[exec]) {
|
|
6752
6801
|
console.log(
|
|
6753
6802
|
import_picocolors5.default.yellow(
|
|
6754
|
-
"The command does not exist, please execute pi -h to view the help"
|
|
6803
|
+
isZh5 ? "\u547D\u4EE4\u4E0D\u5B58\u5728\uFF0C\u8BF7\u6267\u884Cpi -h\u67E5\u770B\u5E2E\u52A9" : "The command does not exist, please execute pi -h to view the help"
|
|
6755
6804
|
)
|
|
6756
6805
|
);
|
|
6757
6806
|
return;
|
package/dist/index.js
CHANGED
|
@@ -6366,6 +6366,7 @@ var Dw = /\s-Dw/;
|
|
|
6366
6366
|
var w = /\s-w/;
|
|
6367
6367
|
var D = /\s-D(?!w)/;
|
|
6368
6368
|
var d = /\s-d(?!w)/;
|
|
6369
|
+
var isZh = process.env.PI_Lang === "zh";
|
|
6369
6370
|
async function getParams(params) {
|
|
6370
6371
|
var _a, _b;
|
|
6371
6372
|
const root = process.cwd();
|
|
@@ -6426,7 +6427,9 @@ async function getParams(params) {
|
|
|
6426
6427
|
}
|
|
6427
6428
|
} catch (err) {
|
|
6428
6429
|
console.log(
|
|
6429
|
-
import_picocolors.default.red(
|
|
6430
|
+
import_picocolors.default.red(
|
|
6431
|
+
`${isZh ? "package.json\u5E76\u4E0D\u5B58\u5728,\u5728\u4EE5\u4E0B\u76EE\u5F55\u4E2D:" : "package.json has not been found in"} ${process.cwd()}`
|
|
6432
|
+
)
|
|
6430
6433
|
);
|
|
6431
6434
|
process.exit(1);
|
|
6432
6435
|
}
|
|
@@ -6452,13 +6455,16 @@ async function getStyle() {
|
|
|
6452
6455
|
import { jsShell } from "lazy-js-utils";
|
|
6453
6456
|
|
|
6454
6457
|
// package.json
|
|
6455
|
-
var version = "0.0.
|
|
6458
|
+
var version = "0.0.56";
|
|
6456
6459
|
|
|
6457
6460
|
// src/help.ts
|
|
6461
|
+
var isZh2 = process.env.PI_Lang === "zh";
|
|
6458
6462
|
function help(argv) {
|
|
6459
6463
|
const arg = argv[0];
|
|
6460
6464
|
if (arg === "-v" || arg === "--version") {
|
|
6461
|
-
jsShell(
|
|
6465
|
+
jsShell(
|
|
6466
|
+
isZh2 ? `gum style --foreground 212 --border-foreground 212 --border double --align center --width 50 --margin "1 2" --padding "2 4" "pi \u7248\u672C: ${version}" "\u8BF7\u4E3A\u6211\u7684\u52AA\u529B\u70B9\u4E00\u4E2A\u884C \u{1F31F}" "\u8C22\u8C22 \u{1F91F}"` : `gum style --foreground 212 --border-foreground 212 --border double --align center --width 50 --margin "1 2" --padding "2 4" "pi version: ${version}" "Please give me a \u{1F31F} for my efforts" "Thank you \u{1F91F}"`
|
|
6467
|
+
);
|
|
6462
6468
|
process.exit(0);
|
|
6463
6469
|
} else if (arg === "-h" || arg === "--help") {
|
|
6464
6470
|
jsShell(
|
|
@@ -6487,10 +6493,11 @@ async function installDeps() {
|
|
|
6487
6493
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
6488
6494
|
import process8 from "process";
|
|
6489
6495
|
import { getPkgTool as getPkgTool2, jsShell as jsShell3, useNodeWorker } from "lazy-js-utils";
|
|
6496
|
+
var isZh3 = process8.env.PI_Lang === "zh";
|
|
6490
6497
|
async function pi(params, pkg, executor = "ni") {
|
|
6491
6498
|
const text = pkg ? `Installing ${pkg} ...` : "Updating dependency ...";
|
|
6492
|
-
const successMsg = pkg ? `Installed ${pkg} successfully! \u{1F60A}` : "Updated dependency successfully! \u{1F60A}";
|
|
6493
|
-
const failMsg = pkg ? `Failed to install ${pkg} \u{1F62D}` : "Failed to update dependency
|
|
6499
|
+
const successMsg = pkg ? isZh3 ? `${pkg} \u5B89\u88C5\u6210\u529F! \u{1F60A}` : `Installed ${pkg} successfully! \u{1F60A}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u6210\u529F! \u{1F60A}" : "Updated dependency successfully! \u{1F60A}";
|
|
6500
|
+
const failMsg = pkg ? isZh3 ? `${pkg} \u5B89\u88C5\u5931\u8D25 \u{1F62D}` : `Failed to install ${pkg} \u{1F62D}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u5931\u8D25 \u{1F62D}" : "Failed to update dependency \u{1F62D}";
|
|
6494
6501
|
const newParams = executor === "pil" ? params : await getParams(params);
|
|
6495
6502
|
let stdio = "pipe";
|
|
6496
6503
|
let loading_status;
|
|
@@ -6519,11 +6526,18 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
6519
6526
|
if (status === 0) {
|
|
6520
6527
|
loading_status.succeed(import_picocolors2.default.green(successMsg));
|
|
6521
6528
|
} else {
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6529
|
+
if (result.indexOf("Not Found - 404")) {
|
|
6530
|
+
const _result = isZh3 ? `${pkg} \u5305\u540D\u53EF\u80FD\u6709\u8BEF\uFF0C\u5E76\u4E0D\u80FD\u5728npm\u4E2D\u641C\u7D22\u5230\uFF0C\u8BF7\u68C0\u67E5` : `${pkg} the package name may be wrong, and cannot be found in npm, please check`;
|
|
6531
|
+
loading_status.fail(
|
|
6532
|
+
import_picocolors2.default.red(result ? `${failMsg}
|
|
6533
|
+
${_result}` : failMsg)
|
|
6534
|
+
);
|
|
6535
|
+
} else {
|
|
6536
|
+
loading_status.fail(
|
|
6537
|
+
import_picocolors2.default.red(result ? `${failMsg}
|
|
6538
|
+
${result}` : failMsg)
|
|
6539
|
+
);
|
|
6540
|
+
}
|
|
6527
6541
|
}
|
|
6528
6542
|
if (result) {
|
|
6529
6543
|
const reg = / No matching version found for ([\w\-\_@\^.]+)/;
|
|
@@ -6595,7 +6609,7 @@ async function pinit() {
|
|
|
6595
6609
|
// src/pix.ts
|
|
6596
6610
|
import { getPkgTool as getPkgTool4, jsShell as jsShell7 } from "lazy-js-utils";
|
|
6597
6611
|
async function pix(params) {
|
|
6598
|
-
switch (getPkgTool4()) {
|
|
6612
|
+
switch (await getPkgTool4()) {
|
|
6599
6613
|
case "bun":
|
|
6600
6614
|
return jsShell7(`bunx ${params}`);
|
|
6601
6615
|
default:
|
|
@@ -6618,13 +6632,11 @@ function pu() {
|
|
|
6618
6632
|
// src/pui.ts
|
|
6619
6633
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
6620
6634
|
import { useNodeWorker as useNodeWorker2 } from "lazy-js-utils";
|
|
6635
|
+
var isZh4 = process.env.PI_Lang === "zh";
|
|
6621
6636
|
async function pui(params, pkg) {
|
|
6622
|
-
const text =
|
|
6623
|
-
`;
|
|
6624
|
-
const
|
|
6625
|
-
UnInstalled ${pkg} successfully! \u{1F60A}`;
|
|
6626
|
-
const failMsg = `
|
|
6627
|
-
Failed to uninstall ${pkg} \u{1F62D}`;
|
|
6637
|
+
const text = `${isZh4 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${pkg} ...`;
|
|
6638
|
+
const successMsg = isZh4 ? `${pkg}\u5378\u8F7D\u6210\u529F! \u{1F60A}` : `UnInstalled ${pkg} successfully! \u{1F60A}`;
|
|
6639
|
+
const failMsg = isZh4 ? `${pkg}\u5378\u8F7D\u5931\u8D25 \u{1F62D}` : `Failed to uninstall ${pkg} \u{1F62D}`;
|
|
6628
6640
|
if (!pkg) {
|
|
6629
6641
|
console.log("Need to specify an uninstall package name");
|
|
6630
6642
|
process.exit(1);
|
|
@@ -6676,6 +6688,7 @@ var runMap = {
|
|
|
6676
6688
|
pfind,
|
|
6677
6689
|
pio
|
|
6678
6690
|
};
|
|
6691
|
+
var isZh5 = process10.env.PI_Lang === "zh";
|
|
6679
6692
|
async function setup() {
|
|
6680
6693
|
const cmd = process10.argv[1];
|
|
6681
6694
|
let exec = "";
|
|
@@ -6692,21 +6705,35 @@ async function setup() {
|
|
|
6692
6705
|
if (!hasPkg(rootPath)) {
|
|
6693
6706
|
if (isGo()) {
|
|
6694
6707
|
if (exec === "pi") {
|
|
6695
|
-
const loading_status = await loading(
|
|
6696
|
-
|
|
6708
|
+
const loading_status = await loading(
|
|
6709
|
+
`${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5" : "Installing"} ${params} ...
|
|
6710
|
+
`
|
|
6711
|
+
);
|
|
6697
6712
|
const { status } = await useNodeWorker4(`go get ${params}`);
|
|
6698
|
-
if (status === 0)
|
|
6699
|
-
loading_status.succeed(
|
|
6700
|
-
|
|
6701
|
-
|
|
6713
|
+
if (status === 0) {
|
|
6714
|
+
loading_status.succeed(
|
|
6715
|
+
import_picocolors5.default.green(isZh5 ? "\u5B89\u88C5\u6210\u529F! \u{1F60A}" : "Installed successfully! \u{1F60A}")
|
|
6716
|
+
);
|
|
6717
|
+
} else {
|
|
6718
|
+
loading_status.fail(
|
|
6719
|
+
import_picocolors5.default.red(isZh5 ? "\u5B89\u88C5\u5931\u8D25 \u{1F62D}" : "Failed to install \u{1F62D}")
|
|
6720
|
+
);
|
|
6721
|
+
}
|
|
6702
6722
|
} else if (exec === "pui") {
|
|
6703
|
-
const loading_status = await loading(
|
|
6704
|
-
|
|
6723
|
+
const loading_status = await loading(
|
|
6724
|
+
`${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${params} ...
|
|
6725
|
+
`
|
|
6726
|
+
);
|
|
6705
6727
|
const { status } = await useNodeWorker4(`go clean ${params}`);
|
|
6706
|
-
if (status === 0)
|
|
6707
|
-
loading_status.succeed(
|
|
6708
|
-
|
|
6709
|
-
|
|
6728
|
+
if (status === 0) {
|
|
6729
|
+
loading_status.succeed(
|
|
6730
|
+
import_picocolors5.default.green(isZh5 ? "\u5378\u8F7D\u6210\u529F! \u{1F60A}" : "Uninstalled successfully! \u{1F60A}")
|
|
6731
|
+
);
|
|
6732
|
+
} else {
|
|
6733
|
+
loading_status.fail(
|
|
6734
|
+
import_picocolors5.default.red(isZh5 ? "\u5378\u8F7D\u5931\u8D25 \u{1F62D}" : "Failed to uninstall \u{1F62D}")
|
|
6735
|
+
);
|
|
6736
|
+
}
|
|
6710
6737
|
} else if (exec === "prun") {
|
|
6711
6738
|
const match = params ? params.endsWith(".go") ? [`**/${params}`] : [`**/${params}.go`, `**/${params}/main.go`] : "main.go";
|
|
6712
6739
|
const target = (await fg(match))[0];
|
|
@@ -6720,27 +6747,45 @@ async function setup() {
|
|
|
6720
6747
|
} else if (exec === "pbuild") {
|
|
6721
6748
|
jsShell10(`go build ${params}`);
|
|
6722
6749
|
} else {
|
|
6723
|
-
console.log(
|
|
6750
|
+
console.log(
|
|
6751
|
+
import_picocolors5.default.red(
|
|
6752
|
+
isZh5 ? "\u5F53\u524D\u6307\u4EE4\u8FD8\u4E0D\u652F\u6301" : "The commands is not supported"
|
|
6753
|
+
)
|
|
6754
|
+
);
|
|
6724
6755
|
}
|
|
6725
6756
|
process10.exit();
|
|
6726
6757
|
}
|
|
6727
6758
|
if (isRust()) {
|
|
6728
6759
|
if (exec === "pi") {
|
|
6729
|
-
const loading_status = await loading(
|
|
6730
|
-
|
|
6760
|
+
const loading_status = await loading(
|
|
6761
|
+
`${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5" : "Installing"} ${params} ...
|
|
6762
|
+
`
|
|
6763
|
+
);
|
|
6731
6764
|
const { status } = await useNodeWorker4(`cargo install ${params}`);
|
|
6732
|
-
if (status === 0)
|
|
6733
|
-
loading_status.succeed(
|
|
6734
|
-
|
|
6735
|
-
|
|
6765
|
+
if (status === 0) {
|
|
6766
|
+
loading_status.succeed(
|
|
6767
|
+
import_picocolors5.default.green(isZh5 ? "\u5B89\u88C5\u6210\u529F! \u{1F60A}" : "Installed successfully! \u{1F60A}")
|
|
6768
|
+
);
|
|
6769
|
+
} else {
|
|
6770
|
+
loading_status.fail(
|
|
6771
|
+
import_picocolors5.default.red(isZh5 ? "\u5B89\u88C5\u5931\u8D25 \u{1F62D}" : "Failed to install \u{1F62D}")
|
|
6772
|
+
);
|
|
6773
|
+
}
|
|
6736
6774
|
} else if (exec === "pui") {
|
|
6737
|
-
const loading_status = await loading(
|
|
6738
|
-
|
|
6775
|
+
const loading_status = await loading(
|
|
6776
|
+
`${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${params} ...
|
|
6777
|
+
`
|
|
6778
|
+
);
|
|
6739
6779
|
const { status } = await useNodeWorker4(`cargo uninstall ${params}`);
|
|
6740
|
-
if (status === 0)
|
|
6741
|
-
loading_status.succeed(
|
|
6742
|
-
|
|
6743
|
-
|
|
6780
|
+
if (status === 0) {
|
|
6781
|
+
loading_status.succeed(
|
|
6782
|
+
import_picocolors5.default.green(isZh5 ? "\u5378\u8F7D\u6210\u529F! \u{1F60A}" : "Uninstalled successfully! \u{1F60A}")
|
|
6783
|
+
);
|
|
6784
|
+
} else {
|
|
6785
|
+
loading_status.fail(
|
|
6786
|
+
import_picocolors5.default.red(isZh5 ? "\u5378\u8F7D\u5931\u8D25 \u{1F62D}" : "Failed to uninstall \u{1F62D}")
|
|
6787
|
+
);
|
|
6788
|
+
}
|
|
6744
6789
|
} else if (exec === "prun") {
|
|
6745
6790
|
jsShell10(`cargo run ${params}`);
|
|
6746
6791
|
} else if (exec === "pinit") {
|
|
@@ -6748,14 +6793,18 @@ async function setup() {
|
|
|
6748
6793
|
} else if (exec === "pbuild") {
|
|
6749
6794
|
jsShell10(`cargo build ${params}`);
|
|
6750
6795
|
} else {
|
|
6751
|
-
console.log(
|
|
6796
|
+
console.log(
|
|
6797
|
+
import_picocolors5.default.red(
|
|
6798
|
+
isZh5 ? "\u5F53\u524D\u6307\u4EE4\u8FD8\u4E0D\u652F\u6301" : "The commands is not supported"
|
|
6799
|
+
)
|
|
6800
|
+
);
|
|
6752
6801
|
}
|
|
6753
6802
|
process10.exit();
|
|
6754
6803
|
}
|
|
6755
6804
|
if (!runMap[exec]) {
|
|
6756
6805
|
console.log(
|
|
6757
6806
|
import_picocolors5.default.yellow(
|
|
6758
|
-
"The command does not exist, please execute pi -h to view the help"
|
|
6807
|
+
isZh5 ? "\u547D\u4EE4\u4E0D\u5B58\u5728\uFF0C\u8BF7\u6267\u884Cpi -h\u67E5\u770B\u5E2E\u52A9" : "The command does not exist, please execute pi -h to view the help"
|
|
6759
6808
|
)
|
|
6760
6809
|
);
|
|
6761
6810
|
return;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simon_he/pi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.56",
|
|
5
5
|
"packageManager": "pnpm@7.26.1",
|
|
6
6
|
"description": "",
|
|
7
7
|
"author": "Simon He",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"build": "^0.1.4",
|
|
67
67
|
"fast-glob": "^3.2.12",
|
|
68
|
-
"lazy-js-utils": "^0.0.
|
|
68
|
+
"lazy-js-utils": "^0.0.47"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@antfu/eslint-config": "^0.34.0",
|