@simon_he/pi 0.0.80 → 0.0.82
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.cjs +118 -83
- package/dist/index.js +102 -67
- package/package.json +7 -3
package/dist/index.cjs
CHANGED
|
@@ -203,11 +203,11 @@ var require_signals = __commonJS({
|
|
|
203
203
|
// node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
|
|
204
204
|
var require_signal_exit = __commonJS({
|
|
205
205
|
"node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports, module2) {
|
|
206
|
-
var
|
|
207
|
-
var processOk = function(
|
|
208
|
-
return
|
|
206
|
+
var process12 = global.process;
|
|
207
|
+
var processOk = function(process13) {
|
|
208
|
+
return process13 && typeof process13 === "object" && typeof process13.removeListener === "function" && typeof process13.emit === "function" && typeof process13.reallyExit === "function" && typeof process13.listeners === "function" && typeof process13.kill === "function" && typeof process13.pid === "number" && typeof process13.on === "function";
|
|
209
209
|
};
|
|
210
|
-
if (!processOk(
|
|
210
|
+
if (!processOk(process12)) {
|
|
211
211
|
module2.exports = function() {
|
|
212
212
|
return function() {
|
|
213
213
|
};
|
|
@@ -215,15 +215,15 @@ var require_signal_exit = __commonJS({
|
|
|
215
215
|
} else {
|
|
216
216
|
assert = require("assert");
|
|
217
217
|
signals = require_signals();
|
|
218
|
-
isWin2 = /^win/i.test(
|
|
218
|
+
isWin2 = /^win/i.test(process12.platform);
|
|
219
219
|
EE = require("events");
|
|
220
220
|
if (typeof EE !== "function") {
|
|
221
221
|
EE = EE.EventEmitter;
|
|
222
222
|
}
|
|
223
|
-
if (
|
|
224
|
-
emitter =
|
|
223
|
+
if (process12.__signal_exit_emitter__) {
|
|
224
|
+
emitter = process12.__signal_exit_emitter__;
|
|
225
225
|
} else {
|
|
226
|
-
emitter =
|
|
226
|
+
emitter = process12.__signal_exit_emitter__ = new EE();
|
|
227
227
|
emitter.count = 0;
|
|
228
228
|
emitter.emitted = {};
|
|
229
229
|
}
|
|
@@ -260,12 +260,12 @@ var require_signal_exit = __commonJS({
|
|
|
260
260
|
loaded = false;
|
|
261
261
|
signals.forEach(function(sig) {
|
|
262
262
|
try {
|
|
263
|
-
|
|
263
|
+
process12.removeListener(sig, sigListeners[sig]);
|
|
264
264
|
} catch (er) {
|
|
265
265
|
}
|
|
266
266
|
});
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
process12.emit = originalProcessEmit;
|
|
268
|
+
process12.reallyExit = originalProcessReallyExit;
|
|
269
269
|
emitter.count -= 1;
|
|
270
270
|
};
|
|
271
271
|
module2.exports.unload = unload;
|
|
@@ -282,7 +282,7 @@ var require_signal_exit = __commonJS({
|
|
|
282
282
|
if (!processOk(global.process)) {
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
|
-
var listeners =
|
|
285
|
+
var listeners = process12.listeners(sig);
|
|
286
286
|
if (listeners.length === emitter.count) {
|
|
287
287
|
unload();
|
|
288
288
|
emit("exit", null, sig);
|
|
@@ -290,7 +290,7 @@ var require_signal_exit = __commonJS({
|
|
|
290
290
|
if (isWin2 && sig === "SIGHUP") {
|
|
291
291
|
sig = "SIGINT";
|
|
292
292
|
}
|
|
293
|
-
|
|
293
|
+
process12.kill(process12.pid, sig);
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
296
|
});
|
|
@@ -306,36 +306,36 @@ var require_signal_exit = __commonJS({
|
|
|
306
306
|
emitter.count += 1;
|
|
307
307
|
signals = signals.filter(function(sig) {
|
|
308
308
|
try {
|
|
309
|
-
|
|
309
|
+
process12.on(sig, sigListeners[sig]);
|
|
310
310
|
return true;
|
|
311
311
|
} catch (er) {
|
|
312
312
|
return false;
|
|
313
313
|
}
|
|
314
314
|
});
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
process12.emit = processEmit;
|
|
316
|
+
process12.reallyExit = processReallyExit;
|
|
317
317
|
};
|
|
318
318
|
module2.exports.load = load;
|
|
319
|
-
originalProcessReallyExit =
|
|
319
|
+
originalProcessReallyExit = process12.reallyExit;
|
|
320
320
|
processReallyExit = function processReallyExit2(code) {
|
|
321
321
|
if (!processOk(global.process)) {
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
|
-
|
|
324
|
+
process12.exitCode = code || /* istanbul ignore next */
|
|
325
325
|
0;
|
|
326
|
-
emit("exit",
|
|
327
|
-
emit("afterexit",
|
|
328
|
-
originalProcessReallyExit.call(
|
|
326
|
+
emit("exit", process12.exitCode, null);
|
|
327
|
+
emit("afterexit", process12.exitCode, null);
|
|
328
|
+
originalProcessReallyExit.call(process12, process12.exitCode);
|
|
329
329
|
};
|
|
330
|
-
originalProcessEmit =
|
|
330
|
+
originalProcessEmit = process12.emit;
|
|
331
331
|
processEmit = function processEmit2(ev, arg) {
|
|
332
332
|
if (ev === "exit" && processOk(global.process)) {
|
|
333
333
|
if (arg !== void 0) {
|
|
334
|
-
|
|
334
|
+
process12.exitCode = arg;
|
|
335
335
|
}
|
|
336
336
|
var ret = originalProcessEmit.apply(this, arguments);
|
|
337
|
-
emit("exit",
|
|
338
|
-
emit("afterexit",
|
|
337
|
+
emit("exit", process12.exitCode, null);
|
|
338
|
+
emit("afterexit", process12.exitCode, null);
|
|
339
339
|
return ret;
|
|
340
340
|
} else {
|
|
341
341
|
return originalProcessEmit.apply(this, arguments);
|
|
@@ -5656,8 +5656,8 @@ __export(src_exports, {
|
|
|
5656
5656
|
setup: () => setup
|
|
5657
5657
|
});
|
|
5658
5658
|
module.exports = __toCommonJS(src_exports);
|
|
5659
|
-
var
|
|
5660
|
-
var
|
|
5659
|
+
var import_process4 = __toESM(require("process"), 1);
|
|
5660
|
+
var import_lazy_js_utils14 = require("lazy-js-utils");
|
|
5661
5661
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
5662
5662
|
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
5663
5663
|
var import_ccommand2 = require("ccommand");
|
|
@@ -6751,7 +6751,7 @@ function getLatestVersion(pkg, isZh6 = true) {
|
|
|
6751
6751
|
var import_lazy_js_utils2 = require("lazy-js-utils");
|
|
6752
6752
|
|
|
6753
6753
|
// package.json
|
|
6754
|
-
var version = "0.0.
|
|
6754
|
+
var version = "0.0.82";
|
|
6755
6755
|
|
|
6756
6756
|
// src/help.ts
|
|
6757
6757
|
var isZh2 = process.env.PI_Lang === "zh";
|
|
@@ -6806,11 +6806,46 @@ async function installDeps() {
|
|
|
6806
6806
|
}
|
|
6807
6807
|
|
|
6808
6808
|
// src/pi.ts
|
|
6809
|
+
var import_process2 = __toESM(require("process"), 1);
|
|
6810
|
+
var import_lazy_js_utils5 = require("lazy-js-utils");
|
|
6811
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
6812
|
+
|
|
6813
|
+
// src/detectNode.ts
|
|
6809
6814
|
var import_process = __toESM(require("process"), 1);
|
|
6810
6815
|
var import_lazy_js_utils4 = require("lazy-js-utils");
|
|
6811
|
-
var
|
|
6812
|
-
|
|
6816
|
+
var semver = require("semver");
|
|
6817
|
+
async function detectNode() {
|
|
6818
|
+
var _a;
|
|
6819
|
+
const pkg = await (0, import_lazy_js_utils4.getPkg)();
|
|
6820
|
+
if ((_a = pkg.engines) == null ? void 0 : _a.node) {
|
|
6821
|
+
const isSafe = semver.satisfies(import_process.default.version, pkg.engines.node);
|
|
6822
|
+
if (!isSafe) {
|
|
6823
|
+
const { result, status } = await (0, import_lazy_js_utils4.jsShell)(
|
|
6824
|
+
`echo "yes
|
|
6825
|
+
no" | gum filter --placeholder=" \u5F53\u524Dnode\u7248\u672C\u4E0D\u6EE1\u8DB3 ${pkg.engines.node}\uFF0C\u662F\u5426\u5207\u6362node\u7248\u672C"`,
|
|
6826
|
+
"pipe"
|
|
6827
|
+
);
|
|
6828
|
+
if (status === 0 && result === "yes") {
|
|
6829
|
+
await (0, import_lazy_js_utils4.jsShell)(
|
|
6830
|
+
`
|
|
6831
|
+
current=$(echo $(fnm current))
|
|
6832
|
+
registery=$(echo "$(fnm ls)" | sed 's/system//g' | sed 's/default//g' | sed 's/* //g' | sed "s/$current/* $current/g" | gum filter --placeholder=" \u8BF7\u9009\u62E9\u4E00\u4E2Anode\u7248\u672C")
|
|
6833
|
+
registery=$(echo \${registery// /} | sed 's/*//g')
|
|
6834
|
+
if [ $registery ]; then
|
|
6835
|
+
fnm use \${registery% -*}
|
|
6836
|
+
fi
|
|
6837
|
+
`,
|
|
6838
|
+
"pipe"
|
|
6839
|
+
);
|
|
6840
|
+
}
|
|
6841
|
+
}
|
|
6842
|
+
}
|
|
6843
|
+
}
|
|
6844
|
+
|
|
6845
|
+
// src/pi.ts
|
|
6846
|
+
var isZh3 = import_process2.default.env.PI_Lang === "zh";
|
|
6813
6847
|
async function pi(params, pkg, executor = "ni") {
|
|
6848
|
+
await detectNode();
|
|
6814
6849
|
const text = pkg ? `Installing ${params} ...` : "Updating dependency ...";
|
|
6815
6850
|
const isLatest = executor === "pil";
|
|
6816
6851
|
const start = Date.now();
|
|
@@ -6824,8 +6859,8 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
6824
6859
|
const newParams = isLatest ? params : await getParams(params);
|
|
6825
6860
|
let stdio = "pipe";
|
|
6826
6861
|
let loading_status;
|
|
6827
|
-
const { PI_DEFAULT, PI_MaxSockets: sockets } =
|
|
6828
|
-
const pkgTool = await (0,
|
|
6862
|
+
const { PI_DEFAULT, PI_MaxSockets: sockets } = import_process2.default.env;
|
|
6863
|
+
const pkgTool = await (0, import_lazy_js_utils5.getPkgTool)();
|
|
6829
6864
|
const maxSockets = sockets || 4;
|
|
6830
6865
|
const install = PI_DEFAULT === "yarn" || pkgTool === "yarn" ? newParams ? "add" : "" : "install";
|
|
6831
6866
|
if (pkgTool === "npm") {
|
|
@@ -6841,7 +6876,7 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
6841
6876
|
loading_status = await loading(text);
|
|
6842
6877
|
}
|
|
6843
6878
|
const runSockets = executor.split(" ")[0] === "npm" ? ` --max-sockets=${maxSockets}` : "";
|
|
6844
|
-
const { status, result } = await (0,
|
|
6879
|
+
const { status, result } = await (0, import_lazy_js_utils5.useNodeWorker)({
|
|
6845
6880
|
params: `${executor}${newParams ? ` ${newParams}` : runSockets}`,
|
|
6846
6881
|
stdio
|
|
6847
6882
|
});
|
|
@@ -6865,16 +6900,16 @@ ${result}` : failMsg));
|
|
|
6865
6900
|
const match = result.match(reg);
|
|
6866
6901
|
if (match) {
|
|
6867
6902
|
const dep = match[1];
|
|
6868
|
-
(0,
|
|
6903
|
+
(0, import_lazy_js_utils5.jsShell)(`pi ${dep}@latest`);
|
|
6869
6904
|
}
|
|
6870
6905
|
}
|
|
6871
|
-
|
|
6906
|
+
import_process2.default.exit();
|
|
6872
6907
|
}
|
|
6873
6908
|
|
|
6874
6909
|
// src/pa.ts
|
|
6875
|
-
var
|
|
6910
|
+
var import_lazy_js_utils6 = require("lazy-js-utils");
|
|
6876
6911
|
function pa() {
|
|
6877
|
-
return (0,
|
|
6912
|
+
return (0, import_lazy_js_utils6.jsShell)("na");
|
|
6878
6913
|
}
|
|
6879
6914
|
|
|
6880
6915
|
// src/pci.ts
|
|
@@ -6883,16 +6918,16 @@ function pci(params, pkg) {
|
|
|
6883
6918
|
}
|
|
6884
6919
|
|
|
6885
6920
|
// src/pfind.ts
|
|
6886
|
-
var
|
|
6921
|
+
var import_lazy_js_utils7 = require("lazy-js-utils");
|
|
6887
6922
|
function pfind(params) {
|
|
6888
|
-
return (0,
|
|
6923
|
+
return (0, import_lazy_js_utils7.jsShell)(`ccommand find ${params}`);
|
|
6889
6924
|
}
|
|
6890
6925
|
|
|
6891
6926
|
// src/pil.ts
|
|
6892
|
-
var
|
|
6927
|
+
var import_lazy_js_utils8 = require("lazy-js-utils");
|
|
6893
6928
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
6894
6929
|
async function pil(params) {
|
|
6895
|
-
const { dependencies = {}, devDependencies = {} } = await (0,
|
|
6930
|
+
const { dependencies = {}, devDependencies = {} } = await (0, import_lazy_js_utils8.getPkg)();
|
|
6896
6931
|
if (!params) {
|
|
6897
6932
|
const deps = [
|
|
6898
6933
|
...Object.keys(dependencies).map((key) => `${key}: ${dependencies[key]}`),
|
|
@@ -6900,7 +6935,7 @@ async function pil(params) {
|
|
|
6900
6935
|
(key) => `${key}: ${devDependencies[key]}`
|
|
6901
6936
|
)
|
|
6902
6937
|
];
|
|
6903
|
-
const { result: choose, status } = (0,
|
|
6938
|
+
const { result: choose, status } = (0, import_lazy_js_utils8.jsShell)(
|
|
6904
6939
|
`echo ${deps.join(
|
|
6905
6940
|
","
|
|
6906
6941
|
)} | sed "s/,/\\n/g" | gum filter --no-limit --placeholder=" \u{1F914}${process.env.PI_Lang === "zh" ? "\u8BF7\u9009\u62E9\u4E00\u4E2A\u9700\u8981\u83B7\u53D6\u6700\u65B0\u7248\u672C\u7684\u4F9D\u8D56" : "Please select a dependency that needs to obtain the latest version."}"`,
|
|
@@ -6939,32 +6974,32 @@ async function pil(params) {
|
|
|
6939
6974
|
}
|
|
6940
6975
|
|
|
6941
6976
|
// src/pinit.ts
|
|
6942
|
-
var
|
|
6977
|
+
var import_lazy_js_utils9 = require("lazy-js-utils");
|
|
6943
6978
|
async function pinit() {
|
|
6944
6979
|
console.log("Initializing project...");
|
|
6945
|
-
switch (await (0,
|
|
6980
|
+
switch (await (0, import_lazy_js_utils9.getPkgTool)()) {
|
|
6946
6981
|
case "npm":
|
|
6947
|
-
(0,
|
|
6982
|
+
(0, import_lazy_js_utils9.jsShell)("npm init -y");
|
|
6948
6983
|
return;
|
|
6949
6984
|
case "yarn":
|
|
6950
|
-
(0,
|
|
6985
|
+
(0, import_lazy_js_utils9.jsShell)("yarn init -y");
|
|
6951
6986
|
return;
|
|
6952
6987
|
case "pnpm":
|
|
6953
|
-
(0,
|
|
6988
|
+
(0, import_lazy_js_utils9.jsShell)("pnpm init -y");
|
|
6954
6989
|
return;
|
|
6955
6990
|
default:
|
|
6956
|
-
(0,
|
|
6991
|
+
(0, import_lazy_js_utils9.jsShell)("npm init -y");
|
|
6957
6992
|
}
|
|
6958
6993
|
}
|
|
6959
6994
|
|
|
6960
6995
|
// src/pix.ts
|
|
6961
|
-
var
|
|
6996
|
+
var import_lazy_js_utils10 = require("lazy-js-utils");
|
|
6962
6997
|
async function pix(params) {
|
|
6963
|
-
switch (await (0,
|
|
6998
|
+
switch (await (0, import_lazy_js_utils10.getPkgTool)()) {
|
|
6964
6999
|
case "bun":
|
|
6965
|
-
return (0,
|
|
7000
|
+
return (0, import_lazy_js_utils10.jsShell)(`bunx ${params}`);
|
|
6966
7001
|
default:
|
|
6967
|
-
return (0,
|
|
7002
|
+
return (0, import_lazy_js_utils10.jsShell)(`npx ${params}`);
|
|
6968
7003
|
}
|
|
6969
7004
|
}
|
|
6970
7005
|
|
|
@@ -6975,26 +7010,26 @@ function prun(params) {
|
|
|
6975
7010
|
}
|
|
6976
7011
|
|
|
6977
7012
|
// src/pu.ts
|
|
6978
|
-
var
|
|
7013
|
+
var import_lazy_js_utils11 = require("lazy-js-utils");
|
|
6979
7014
|
function pu() {
|
|
6980
|
-
return (0,
|
|
7015
|
+
return (0, import_lazy_js_utils11.jsShell)("nu");
|
|
6981
7016
|
}
|
|
6982
7017
|
|
|
6983
7018
|
// src/pui.ts
|
|
6984
|
-
var
|
|
7019
|
+
var import_lazy_js_utils12 = require("lazy-js-utils");
|
|
6985
7020
|
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
6986
7021
|
var isZh4 = process.env.PI_Lang === "zh";
|
|
6987
7022
|
async function pui(params, pkg) {
|
|
6988
7023
|
const text = `${isZh4 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${pkg} ...`;
|
|
6989
7024
|
if (!params) {
|
|
6990
|
-
const { dependencies = {}, devDependencies = {} } = await (0,
|
|
7025
|
+
const { dependencies = {}, devDependencies = {} } = await (0, import_lazy_js_utils12.getPkg)();
|
|
6991
7026
|
const deps = [
|
|
6992
7027
|
...Object.keys(dependencies).map((key) => `${key}: ${dependencies[key]}`),
|
|
6993
7028
|
...Object.keys(devDependencies).map(
|
|
6994
7029
|
(key) => `${key}: ${devDependencies[key]}`
|
|
6995
7030
|
)
|
|
6996
7031
|
];
|
|
6997
|
-
const { result: choose, status: status2 } = (0,
|
|
7032
|
+
const { result: choose, status: status2 } = (0, import_lazy_js_utils12.jsShell)(
|
|
6998
7033
|
`echo ${deps.join(
|
|
6999
7034
|
","
|
|
7000
7035
|
)} | sed "s/,/\\n/g" | gum filter --placeholder=" \u{1F914}${process.env.PI_Lang === "zh" ? "\u8BF7\u9009\u62E9\u4E00\u4E2A\u9700\u8981\u5220\u9664\u4F9D\u8D56" : "Please select a dependency to get the latest version."}"`,
|
|
@@ -7020,7 +7055,7 @@ async function pui(params, pkg) {
|
|
|
7020
7055
|
process.exit(1);
|
|
7021
7056
|
}
|
|
7022
7057
|
const loading_status = await loading(text);
|
|
7023
|
-
const { status, result } = await (0,
|
|
7058
|
+
const { status, result } = await (0, import_lazy_js_utils12.useNodeWorker)(`nun ${params}`);
|
|
7024
7059
|
const end = Date.now();
|
|
7025
7060
|
const costTime = (end - start) / 1e3;
|
|
7026
7061
|
successMsg += import_picocolors5.default.blue(` ---- \u23F0\uFF1A${costTime}s`);
|
|
@@ -7033,15 +7068,15 @@ ${result}` : failMsg));
|
|
|
7033
7068
|
}
|
|
7034
7069
|
|
|
7035
7070
|
// src/pio.ts
|
|
7036
|
-
var
|
|
7037
|
-
var
|
|
7071
|
+
var import_process3 = __toESM(require("process"), 1);
|
|
7072
|
+
var import_lazy_js_utils13 = require("lazy-js-utils");
|
|
7038
7073
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
7039
7074
|
async function pio(params, pkg, executor = "ni") {
|
|
7040
7075
|
const successMsg = pkg ? `Installed ${pkg} successfully! \u{1F60A}` : "Updated dependency successfully! \u{1F60A}";
|
|
7041
7076
|
const failMsg = pkg ? `Failed to install ${pkg} \u{1F62D}` : "Failed to update dependency! \u{1F62D}";
|
|
7042
7077
|
const offline = "--prefer-offline";
|
|
7043
7078
|
const newParams = await getParams(params);
|
|
7044
|
-
const { status, result } = await (0,
|
|
7079
|
+
const { status, result } = await (0, import_lazy_js_utils13.useNodeWorker)({
|
|
7045
7080
|
params: `${executor} ${newParams} ${offline}`,
|
|
7046
7081
|
stdio: "inherit"
|
|
7047
7082
|
});
|
|
@@ -7052,11 +7087,11 @@ async function pio(params, pkg, executor = "ni") {
|
|
|
7052
7087
|
loading_status.fail(import_picocolors6.default.red(result ? `${result}
|
|
7053
7088
|
|
|
7054
7089
|
${failMsg}` : failMsg));
|
|
7055
|
-
|
|
7090
|
+
import_process3.default.exit();
|
|
7056
7091
|
}
|
|
7057
7092
|
|
|
7058
7093
|
// src/index.ts
|
|
7059
|
-
var rootPath =
|
|
7094
|
+
var rootPath = import_process4.default.cwd();
|
|
7060
7095
|
var runMap = {
|
|
7061
7096
|
pi,
|
|
7062
7097
|
pix,
|
|
@@ -7070,28 +7105,28 @@ var runMap = {
|
|
|
7070
7105
|
pfind,
|
|
7071
7106
|
pio
|
|
7072
7107
|
};
|
|
7073
|
-
var isZh5 =
|
|
7108
|
+
var isZh5 = import_process4.default.env.PI_Lang === "zh";
|
|
7074
7109
|
async function setup() {
|
|
7075
|
-
const cmd =
|
|
7110
|
+
const cmd = import_process4.default.argv[1];
|
|
7076
7111
|
let exec = "";
|
|
7077
|
-
if ((0,
|
|
7112
|
+
if ((0, import_lazy_js_utils14.isWin)()) {
|
|
7078
7113
|
const last = cmd.lastIndexOf("\\") + 1;
|
|
7079
7114
|
exec = cmd.slice(last, cmd.length).split(".").slice(0, -1).join(".");
|
|
7080
7115
|
} else {
|
|
7081
7116
|
const last = cmd.lastIndexOf("/") + 1;
|
|
7082
7117
|
exec = cmd.slice(last, cmd.length);
|
|
7083
7118
|
}
|
|
7084
|
-
const argv =
|
|
7119
|
+
const argv = import_process4.default.argv.slice(2);
|
|
7085
7120
|
help(argv);
|
|
7086
|
-
const params = (0,
|
|
7087
|
-
if (!(0,
|
|
7088
|
-
if ((0,
|
|
7121
|
+
const params = (0, import_lazy_js_utils14.spaceFormat)(argv.join(" ")).trim();
|
|
7122
|
+
if (!(0, import_lazy_js_utils14.hasPkg)(rootPath)) {
|
|
7123
|
+
if ((0, import_lazy_js_utils14.isGo)()) {
|
|
7089
7124
|
if (exec === "pi") {
|
|
7090
7125
|
const loading_status = await loading(
|
|
7091
7126
|
`${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5" : "Installing"} ${params} ...
|
|
7092
7127
|
`
|
|
7093
7128
|
);
|
|
7094
|
-
const { status } = params ? await (0,
|
|
7129
|
+
const { status } = params ? await (0, import_lazy_js_utils14.useNodeWorker)(`go get ${params}`) : await (0, import_lazy_js_utils14.useNodeWorker)("go mod tidy");
|
|
7095
7130
|
if (status === 0) {
|
|
7096
7131
|
loading_status.succeed(
|
|
7097
7132
|
import_picocolors7.default.green(isZh5 ? "\u5B89\u88C5\u6210\u529F! \u{1F60A}" : "Installed successfully! \u{1F60A}")
|
|
@@ -7106,7 +7141,7 @@ async function setup() {
|
|
|
7106
7141
|
`${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${params} ...
|
|
7107
7142
|
`
|
|
7108
7143
|
);
|
|
7109
|
-
const { status } = await (0,
|
|
7144
|
+
const { status } = await (0, import_lazy_js_utils14.useNodeWorker)(`go clean ${params}`);
|
|
7110
7145
|
if (status === 0) {
|
|
7111
7146
|
loading_status.succeed(
|
|
7112
7147
|
import_picocolors7.default.green(isZh5 ? "\u5378\u8F7D\u6210\u529F! \u{1F60A}" : "Uninstalled successfully! \u{1F60A}")
|
|
@@ -7119,11 +7154,11 @@ async function setup() {
|
|
|
7119
7154
|
} else if (exec === "prun") {
|
|
7120
7155
|
const match = params ? params.endsWith(".go") ? [`**/${params}`] : [`**/${params}.go`, `**/${params}/main.go`] : "main.go";
|
|
7121
7156
|
const target = (await (0, import_fast_glob.default)(match))[0];
|
|
7122
|
-
return target ? (0,
|
|
7157
|
+
return target ? (0, import_lazy_js_utils14.jsShell)(`go run ${target}`) : (0, import_ccommand2.ccommand)(params);
|
|
7123
7158
|
} else if (exec === "pinit") {
|
|
7124
|
-
(0,
|
|
7159
|
+
(0, import_lazy_js_utils14.jsShell)(`go mod init ${params}`);
|
|
7125
7160
|
} else if (exec === "pbuild") {
|
|
7126
|
-
(0,
|
|
7161
|
+
(0, import_lazy_js_utils14.jsShell)(`go build ${params}`);
|
|
7127
7162
|
} else {
|
|
7128
7163
|
console.log(
|
|
7129
7164
|
import_picocolors7.default.red(
|
|
@@ -7131,15 +7166,15 @@ async function setup() {
|
|
|
7131
7166
|
)
|
|
7132
7167
|
);
|
|
7133
7168
|
}
|
|
7134
|
-
|
|
7169
|
+
import_process4.default.exit();
|
|
7135
7170
|
}
|
|
7136
|
-
if ((0,
|
|
7171
|
+
if ((0, import_lazy_js_utils14.isRust)()) {
|
|
7137
7172
|
if (exec === "pi") {
|
|
7138
7173
|
const loading_status = await loading(
|
|
7139
7174
|
`${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5" : "Installing"} ${params} ...
|
|
7140
7175
|
`
|
|
7141
7176
|
);
|
|
7142
|
-
const { status } = await (0,
|
|
7177
|
+
const { status } = await (0, import_lazy_js_utils14.useNodeWorker)(`cargo install ${params}`);
|
|
7143
7178
|
if (status === 0) {
|
|
7144
7179
|
loading_status.succeed(
|
|
7145
7180
|
import_picocolors7.default.green(isZh5 ? "\u5B89\u88C5\u6210\u529F! \u{1F60A}" : "Installed successfully! \u{1F60A}")
|
|
@@ -7154,7 +7189,7 @@ async function setup() {
|
|
|
7154
7189
|
`${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${params} ...
|
|
7155
7190
|
`
|
|
7156
7191
|
);
|
|
7157
|
-
const { status } = await (0,
|
|
7192
|
+
const { status } = await (0, import_lazy_js_utils14.useNodeWorker)(`cargo uninstall ${params}`);
|
|
7158
7193
|
if (status === 0) {
|
|
7159
7194
|
loading_status.succeed(
|
|
7160
7195
|
import_picocolors7.default.green(isZh5 ? "\u5378\u8F7D\u6210\u529F! \u{1F60A}" : "Uninstalled successfully! \u{1F60A}")
|
|
@@ -7165,11 +7200,11 @@ async function setup() {
|
|
|
7165
7200
|
);
|
|
7166
7201
|
}
|
|
7167
7202
|
} else if (exec === "prun") {
|
|
7168
|
-
(0,
|
|
7203
|
+
(0, import_lazy_js_utils14.jsShell)(`cargo run ${params}`);
|
|
7169
7204
|
} else if (exec === "pinit") {
|
|
7170
|
-
(0,
|
|
7205
|
+
(0, import_lazy_js_utils14.jsShell)(`cargo init ${params}`);
|
|
7171
7206
|
} else if (exec === "pbuild") {
|
|
7172
|
-
(0,
|
|
7207
|
+
(0, import_lazy_js_utils14.jsShell)(`cargo build ${params}`);
|
|
7173
7208
|
} else {
|
|
7174
7209
|
console.log(
|
|
7175
7210
|
import_picocolors7.default.red(
|
|
@@ -7177,7 +7212,7 @@ async function setup() {
|
|
|
7177
7212
|
)
|
|
7178
7213
|
);
|
|
7179
7214
|
}
|
|
7180
|
-
|
|
7215
|
+
import_process4.default.exit();
|
|
7181
7216
|
}
|
|
7182
7217
|
if (!runMap[exec]) {
|
|
7183
7218
|
console.log(
|
package/dist/index.js
CHANGED
|
@@ -204,11 +204,11 @@ var require_signals = __commonJS({
|
|
|
204
204
|
// node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
|
|
205
205
|
var require_signal_exit = __commonJS({
|
|
206
206
|
"node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports, module) {
|
|
207
|
-
var
|
|
208
|
-
var processOk = function(
|
|
209
|
-
return
|
|
207
|
+
var process12 = global.process;
|
|
208
|
+
var processOk = function(process13) {
|
|
209
|
+
return process13 && typeof process13 === "object" && typeof process13.removeListener === "function" && typeof process13.emit === "function" && typeof process13.reallyExit === "function" && typeof process13.listeners === "function" && typeof process13.kill === "function" && typeof process13.pid === "number" && typeof process13.on === "function";
|
|
210
210
|
};
|
|
211
|
-
if (!processOk(
|
|
211
|
+
if (!processOk(process12)) {
|
|
212
212
|
module.exports = function() {
|
|
213
213
|
return function() {
|
|
214
214
|
};
|
|
@@ -216,15 +216,15 @@ var require_signal_exit = __commonJS({
|
|
|
216
216
|
} else {
|
|
217
217
|
assert = __require("assert");
|
|
218
218
|
signals = require_signals();
|
|
219
|
-
isWin2 = /^win/i.test(
|
|
219
|
+
isWin2 = /^win/i.test(process12.platform);
|
|
220
220
|
EE = __require("events");
|
|
221
221
|
if (typeof EE !== "function") {
|
|
222
222
|
EE = EE.EventEmitter;
|
|
223
223
|
}
|
|
224
|
-
if (
|
|
225
|
-
emitter =
|
|
224
|
+
if (process12.__signal_exit_emitter__) {
|
|
225
|
+
emitter = process12.__signal_exit_emitter__;
|
|
226
226
|
} else {
|
|
227
|
-
emitter =
|
|
227
|
+
emitter = process12.__signal_exit_emitter__ = new EE();
|
|
228
228
|
emitter.count = 0;
|
|
229
229
|
emitter.emitted = {};
|
|
230
230
|
}
|
|
@@ -261,12 +261,12 @@ var require_signal_exit = __commonJS({
|
|
|
261
261
|
loaded = false;
|
|
262
262
|
signals.forEach(function(sig) {
|
|
263
263
|
try {
|
|
264
|
-
|
|
264
|
+
process12.removeListener(sig, sigListeners[sig]);
|
|
265
265
|
} catch (er) {
|
|
266
266
|
}
|
|
267
267
|
});
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
process12.emit = originalProcessEmit;
|
|
269
|
+
process12.reallyExit = originalProcessReallyExit;
|
|
270
270
|
emitter.count -= 1;
|
|
271
271
|
};
|
|
272
272
|
module.exports.unload = unload;
|
|
@@ -283,7 +283,7 @@ var require_signal_exit = __commonJS({
|
|
|
283
283
|
if (!processOk(global.process)) {
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
|
-
var listeners =
|
|
286
|
+
var listeners = process12.listeners(sig);
|
|
287
287
|
if (listeners.length === emitter.count) {
|
|
288
288
|
unload();
|
|
289
289
|
emit("exit", null, sig);
|
|
@@ -291,7 +291,7 @@ var require_signal_exit = __commonJS({
|
|
|
291
291
|
if (isWin2 && sig === "SIGHUP") {
|
|
292
292
|
sig = "SIGINT";
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
process12.kill(process12.pid, sig);
|
|
295
295
|
}
|
|
296
296
|
};
|
|
297
297
|
});
|
|
@@ -307,36 +307,36 @@ var require_signal_exit = __commonJS({
|
|
|
307
307
|
emitter.count += 1;
|
|
308
308
|
signals = signals.filter(function(sig) {
|
|
309
309
|
try {
|
|
310
|
-
|
|
310
|
+
process12.on(sig, sigListeners[sig]);
|
|
311
311
|
return true;
|
|
312
312
|
} catch (er) {
|
|
313
313
|
return false;
|
|
314
314
|
}
|
|
315
315
|
});
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
process12.emit = processEmit;
|
|
317
|
+
process12.reallyExit = processReallyExit;
|
|
318
318
|
};
|
|
319
319
|
module.exports.load = load;
|
|
320
|
-
originalProcessReallyExit =
|
|
320
|
+
originalProcessReallyExit = process12.reallyExit;
|
|
321
321
|
processReallyExit = function processReallyExit2(code) {
|
|
322
322
|
if (!processOk(global.process)) {
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
|
-
|
|
325
|
+
process12.exitCode = code || /* istanbul ignore next */
|
|
326
326
|
0;
|
|
327
|
-
emit("exit",
|
|
328
|
-
emit("afterexit",
|
|
329
|
-
originalProcessReallyExit.call(
|
|
327
|
+
emit("exit", process12.exitCode, null);
|
|
328
|
+
emit("afterexit", process12.exitCode, null);
|
|
329
|
+
originalProcessReallyExit.call(process12, process12.exitCode);
|
|
330
330
|
};
|
|
331
|
-
originalProcessEmit =
|
|
331
|
+
originalProcessEmit = process12.emit;
|
|
332
332
|
processEmit = function processEmit2(ev, arg) {
|
|
333
333
|
if (ev === "exit" && processOk(global.process)) {
|
|
334
334
|
if (arg !== void 0) {
|
|
335
|
-
|
|
335
|
+
process12.exitCode = arg;
|
|
336
336
|
}
|
|
337
337
|
var ret = originalProcessEmit.apply(this, arguments);
|
|
338
|
-
emit("exit",
|
|
339
|
-
emit("afterexit",
|
|
338
|
+
emit("exit", process12.exitCode, null);
|
|
339
|
+
emit("afterexit", process12.exitCode, null);
|
|
340
340
|
return ret;
|
|
341
341
|
} else {
|
|
342
342
|
return originalProcessEmit.apply(this, arguments);
|
|
@@ -5653,13 +5653,13 @@ var require_bl = __commonJS({
|
|
|
5653
5653
|
|
|
5654
5654
|
// src/index.ts
|
|
5655
5655
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
5656
|
-
import
|
|
5656
|
+
import process11 from "process";
|
|
5657
5657
|
import {
|
|
5658
5658
|
hasPkg,
|
|
5659
5659
|
isGo,
|
|
5660
5660
|
isRust,
|
|
5661
5661
|
isWin,
|
|
5662
|
-
jsShell as
|
|
5662
|
+
jsShell as jsShell13,
|
|
5663
5663
|
spaceFormat,
|
|
5664
5664
|
useNodeWorker as useNodeWorker4
|
|
5665
5665
|
} from "lazy-js-utils";
|
|
@@ -6755,7 +6755,7 @@ function getLatestVersion(pkg, isZh6 = true) {
|
|
|
6755
6755
|
import { jsShell as jsShell2 } from "lazy-js-utils";
|
|
6756
6756
|
|
|
6757
6757
|
// package.json
|
|
6758
|
-
var version = "0.0.
|
|
6758
|
+
var version = "0.0.82";
|
|
6759
6759
|
|
|
6760
6760
|
// src/help.ts
|
|
6761
6761
|
var isZh2 = process.env.PI_Lang === "zh";
|
|
@@ -6811,10 +6811,45 @@ async function installDeps() {
|
|
|
6811
6811
|
|
|
6812
6812
|
// src/pi.ts
|
|
6813
6813
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
6814
|
+
import process9 from "process";
|
|
6815
|
+
import { getPkgTool as getPkgTool2, jsShell as jsShell5, useNodeWorker } from "lazy-js-utils";
|
|
6816
|
+
|
|
6817
|
+
// src/detectNode.ts
|
|
6814
6818
|
import process8 from "process";
|
|
6815
|
-
import {
|
|
6816
|
-
var
|
|
6819
|
+
import { getPkg as getPkg2, jsShell as jsShell4 } from "lazy-js-utils";
|
|
6820
|
+
var semver = __require("semver");
|
|
6821
|
+
async function detectNode() {
|
|
6822
|
+
var _a;
|
|
6823
|
+
const pkg = await getPkg2();
|
|
6824
|
+
if ((_a = pkg.engines) == null ? void 0 : _a.node) {
|
|
6825
|
+
const isSafe = semver.satisfies(process8.version, pkg.engines.node);
|
|
6826
|
+
if (!isSafe) {
|
|
6827
|
+
const { result, status } = await jsShell4(
|
|
6828
|
+
`echo "yes
|
|
6829
|
+
no" | gum filter --placeholder=" \u5F53\u524Dnode\u7248\u672C\u4E0D\u6EE1\u8DB3 ${pkg.engines.node}\uFF0C\u662F\u5426\u5207\u6362node\u7248\u672C"`,
|
|
6830
|
+
"pipe"
|
|
6831
|
+
);
|
|
6832
|
+
if (status === 0 && result === "yes") {
|
|
6833
|
+
await jsShell4(
|
|
6834
|
+
`
|
|
6835
|
+
current=$(echo $(fnm current))
|
|
6836
|
+
registery=$(echo "$(fnm ls)" | sed 's/system//g' | sed 's/default//g' | sed 's/* //g' | sed "s/$current/* $current/g" | gum filter --placeholder=" \u8BF7\u9009\u62E9\u4E00\u4E2Anode\u7248\u672C")
|
|
6837
|
+
registery=$(echo \${registery// /} | sed 's/*//g')
|
|
6838
|
+
if [ $registery ]; then
|
|
6839
|
+
fnm use \${registery% -*}
|
|
6840
|
+
fi
|
|
6841
|
+
`,
|
|
6842
|
+
"pipe"
|
|
6843
|
+
);
|
|
6844
|
+
}
|
|
6845
|
+
}
|
|
6846
|
+
}
|
|
6847
|
+
}
|
|
6848
|
+
|
|
6849
|
+
// src/pi.ts
|
|
6850
|
+
var isZh3 = process9.env.PI_Lang === "zh";
|
|
6817
6851
|
async function pi(params, pkg, executor = "ni") {
|
|
6852
|
+
await detectNode();
|
|
6818
6853
|
const text = pkg ? `Installing ${params} ...` : "Updating dependency ...";
|
|
6819
6854
|
const isLatest = executor === "pil";
|
|
6820
6855
|
const start = Date.now();
|
|
@@ -6828,7 +6863,7 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
6828
6863
|
const newParams = isLatest ? params : await getParams(params);
|
|
6829
6864
|
let stdio = "pipe";
|
|
6830
6865
|
let loading_status;
|
|
6831
|
-
const { PI_DEFAULT, PI_MaxSockets: sockets } =
|
|
6866
|
+
const { PI_DEFAULT, PI_MaxSockets: sockets } = process9.env;
|
|
6832
6867
|
const pkgTool = await getPkgTool2();
|
|
6833
6868
|
const maxSockets = sockets || 4;
|
|
6834
6869
|
const install = PI_DEFAULT === "yarn" || pkgTool === "yarn" ? newParams ? "add" : "" : "install";
|
|
@@ -6869,16 +6904,16 @@ ${result}` : failMsg));
|
|
|
6869
6904
|
const match = result.match(reg);
|
|
6870
6905
|
if (match) {
|
|
6871
6906
|
const dep = match[1];
|
|
6872
|
-
|
|
6907
|
+
jsShell5(`pi ${dep}@latest`);
|
|
6873
6908
|
}
|
|
6874
6909
|
}
|
|
6875
|
-
|
|
6910
|
+
process9.exit();
|
|
6876
6911
|
}
|
|
6877
6912
|
|
|
6878
6913
|
// src/pa.ts
|
|
6879
|
-
import { jsShell as
|
|
6914
|
+
import { jsShell as jsShell6 } from "lazy-js-utils";
|
|
6880
6915
|
function pa() {
|
|
6881
|
-
return
|
|
6916
|
+
return jsShell6("na");
|
|
6882
6917
|
}
|
|
6883
6918
|
|
|
6884
6919
|
// src/pci.ts
|
|
@@ -6887,16 +6922,16 @@ function pci(params, pkg) {
|
|
|
6887
6922
|
}
|
|
6888
6923
|
|
|
6889
6924
|
// src/pfind.ts
|
|
6890
|
-
import { jsShell as
|
|
6925
|
+
import { jsShell as jsShell7 } from "lazy-js-utils";
|
|
6891
6926
|
function pfind(params) {
|
|
6892
|
-
return
|
|
6927
|
+
return jsShell7(`ccommand find ${params}`);
|
|
6893
6928
|
}
|
|
6894
6929
|
|
|
6895
6930
|
// src/pil.ts
|
|
6896
6931
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
6897
|
-
import { getPkg as
|
|
6932
|
+
import { getPkg as getPkg3, jsShell as jsShell8 } from "lazy-js-utils";
|
|
6898
6933
|
async function pil(params) {
|
|
6899
|
-
const { dependencies = {}, devDependencies = {} } = await
|
|
6934
|
+
const { dependencies = {}, devDependencies = {} } = await getPkg3();
|
|
6900
6935
|
if (!params) {
|
|
6901
6936
|
const deps = [
|
|
6902
6937
|
...Object.keys(dependencies).map((key) => `${key}: ${dependencies[key]}`),
|
|
@@ -6904,7 +6939,7 @@ async function pil(params) {
|
|
|
6904
6939
|
(key) => `${key}: ${devDependencies[key]}`
|
|
6905
6940
|
)
|
|
6906
6941
|
];
|
|
6907
|
-
const { result: choose, status } =
|
|
6942
|
+
const { result: choose, status } = jsShell8(
|
|
6908
6943
|
`echo ${deps.join(
|
|
6909
6944
|
","
|
|
6910
6945
|
)} | sed "s/,/\\n/g" | gum filter --no-limit --placeholder=" \u{1F914}${process.env.PI_Lang === "zh" ? "\u8BF7\u9009\u62E9\u4E00\u4E2A\u9700\u8981\u83B7\u53D6\u6700\u65B0\u7248\u672C\u7684\u4F9D\u8D56" : "Please select a dependency that needs to obtain the latest version."}"`,
|
|
@@ -6943,32 +6978,32 @@ async function pil(params) {
|
|
|
6943
6978
|
}
|
|
6944
6979
|
|
|
6945
6980
|
// src/pinit.ts
|
|
6946
|
-
import { getPkgTool as getPkgTool3, jsShell as
|
|
6981
|
+
import { getPkgTool as getPkgTool3, jsShell as jsShell9 } from "lazy-js-utils";
|
|
6947
6982
|
async function pinit() {
|
|
6948
6983
|
console.log("Initializing project...");
|
|
6949
6984
|
switch (await getPkgTool3()) {
|
|
6950
6985
|
case "npm":
|
|
6951
|
-
|
|
6986
|
+
jsShell9("npm init -y");
|
|
6952
6987
|
return;
|
|
6953
6988
|
case "yarn":
|
|
6954
|
-
|
|
6989
|
+
jsShell9("yarn init -y");
|
|
6955
6990
|
return;
|
|
6956
6991
|
case "pnpm":
|
|
6957
|
-
|
|
6992
|
+
jsShell9("pnpm init -y");
|
|
6958
6993
|
return;
|
|
6959
6994
|
default:
|
|
6960
|
-
|
|
6995
|
+
jsShell9("npm init -y");
|
|
6961
6996
|
}
|
|
6962
6997
|
}
|
|
6963
6998
|
|
|
6964
6999
|
// src/pix.ts
|
|
6965
|
-
import { getPkgTool as getPkgTool4, jsShell as
|
|
7000
|
+
import { getPkgTool as getPkgTool4, jsShell as jsShell10 } from "lazy-js-utils";
|
|
6966
7001
|
async function pix(params) {
|
|
6967
7002
|
switch (await getPkgTool4()) {
|
|
6968
7003
|
case "bun":
|
|
6969
|
-
return
|
|
7004
|
+
return jsShell10(`bunx ${params}`);
|
|
6970
7005
|
default:
|
|
6971
|
-
return
|
|
7006
|
+
return jsShell10(`npx ${params}`);
|
|
6972
7007
|
}
|
|
6973
7008
|
}
|
|
6974
7009
|
|
|
@@ -6979,26 +7014,26 @@ function prun(params) {
|
|
|
6979
7014
|
}
|
|
6980
7015
|
|
|
6981
7016
|
// src/pu.ts
|
|
6982
|
-
import { jsShell as
|
|
7017
|
+
import { jsShell as jsShell11 } from "lazy-js-utils";
|
|
6983
7018
|
function pu() {
|
|
6984
|
-
return
|
|
7019
|
+
return jsShell11("nu");
|
|
6985
7020
|
}
|
|
6986
7021
|
|
|
6987
7022
|
// src/pui.ts
|
|
6988
7023
|
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
6989
|
-
import { getPkg as
|
|
7024
|
+
import { getPkg as getPkg4, jsShell as jsShell12, useNodeWorker as useNodeWorker2 } from "lazy-js-utils";
|
|
6990
7025
|
var isZh4 = process.env.PI_Lang === "zh";
|
|
6991
7026
|
async function pui(params, pkg) {
|
|
6992
7027
|
const text = `${isZh4 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${pkg} ...`;
|
|
6993
7028
|
if (!params) {
|
|
6994
|
-
const { dependencies = {}, devDependencies = {} } = await
|
|
7029
|
+
const { dependencies = {}, devDependencies = {} } = await getPkg4();
|
|
6995
7030
|
const deps = [
|
|
6996
7031
|
...Object.keys(dependencies).map((key) => `${key}: ${dependencies[key]}`),
|
|
6997
7032
|
...Object.keys(devDependencies).map(
|
|
6998
7033
|
(key) => `${key}: ${devDependencies[key]}`
|
|
6999
7034
|
)
|
|
7000
7035
|
];
|
|
7001
|
-
const { result: choose, status: status2 } =
|
|
7036
|
+
const { result: choose, status: status2 } = jsShell12(
|
|
7002
7037
|
`echo ${deps.join(
|
|
7003
7038
|
","
|
|
7004
7039
|
)} | sed "s/,/\\n/g" | gum filter --placeholder=" \u{1F914}${process.env.PI_Lang === "zh" ? "\u8BF7\u9009\u62E9\u4E00\u4E2A\u9700\u8981\u5220\u9664\u4F9D\u8D56" : "Please select a dependency to get the latest version."}"`,
|
|
@@ -7038,7 +7073,7 @@ ${result}` : failMsg));
|
|
|
7038
7073
|
|
|
7039
7074
|
// src/pio.ts
|
|
7040
7075
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
7041
|
-
import
|
|
7076
|
+
import process10 from "process";
|
|
7042
7077
|
import { useNodeWorker as useNodeWorker3 } from "lazy-js-utils";
|
|
7043
7078
|
async function pio(params, pkg, executor = "ni") {
|
|
7044
7079
|
const successMsg = pkg ? `Installed ${pkg} successfully! \u{1F60A}` : "Updated dependency successfully! \u{1F60A}";
|
|
@@ -7056,11 +7091,11 @@ async function pio(params, pkg, executor = "ni") {
|
|
|
7056
7091
|
loading_status.fail(import_picocolors6.default.red(result ? `${result}
|
|
7057
7092
|
|
|
7058
7093
|
${failMsg}` : failMsg));
|
|
7059
|
-
|
|
7094
|
+
process10.exit();
|
|
7060
7095
|
}
|
|
7061
7096
|
|
|
7062
7097
|
// src/index.ts
|
|
7063
|
-
var rootPath =
|
|
7098
|
+
var rootPath = process11.cwd();
|
|
7064
7099
|
var runMap = {
|
|
7065
7100
|
pi,
|
|
7066
7101
|
pix,
|
|
@@ -7074,9 +7109,9 @@ var runMap = {
|
|
|
7074
7109
|
pfind,
|
|
7075
7110
|
pio
|
|
7076
7111
|
};
|
|
7077
|
-
var isZh5 =
|
|
7112
|
+
var isZh5 = process11.env.PI_Lang === "zh";
|
|
7078
7113
|
async function setup() {
|
|
7079
|
-
const cmd =
|
|
7114
|
+
const cmd = process11.argv[1];
|
|
7080
7115
|
let exec = "";
|
|
7081
7116
|
if (isWin()) {
|
|
7082
7117
|
const last = cmd.lastIndexOf("\\") + 1;
|
|
@@ -7085,7 +7120,7 @@ async function setup() {
|
|
|
7085
7120
|
const last = cmd.lastIndexOf("/") + 1;
|
|
7086
7121
|
exec = cmd.slice(last, cmd.length);
|
|
7087
7122
|
}
|
|
7088
|
-
const argv =
|
|
7123
|
+
const argv = process11.argv.slice(2);
|
|
7089
7124
|
help(argv);
|
|
7090
7125
|
const params = spaceFormat(argv.join(" ")).trim();
|
|
7091
7126
|
if (!hasPkg(rootPath)) {
|
|
@@ -7123,11 +7158,11 @@ async function setup() {
|
|
|
7123
7158
|
} else if (exec === "prun") {
|
|
7124
7159
|
const match = params ? params.endsWith(".go") ? [`**/${params}`] : [`**/${params}.go`, `**/${params}/main.go`] : "main.go";
|
|
7125
7160
|
const target = (await fg(match))[0];
|
|
7126
|
-
return target ?
|
|
7161
|
+
return target ? jsShell13(`go run ${target}`) : ccommand2(params);
|
|
7127
7162
|
} else if (exec === "pinit") {
|
|
7128
|
-
|
|
7163
|
+
jsShell13(`go mod init ${params}`);
|
|
7129
7164
|
} else if (exec === "pbuild") {
|
|
7130
|
-
|
|
7165
|
+
jsShell13(`go build ${params}`);
|
|
7131
7166
|
} else {
|
|
7132
7167
|
console.log(
|
|
7133
7168
|
import_picocolors7.default.red(
|
|
@@ -7135,7 +7170,7 @@ async function setup() {
|
|
|
7135
7170
|
)
|
|
7136
7171
|
);
|
|
7137
7172
|
}
|
|
7138
|
-
|
|
7173
|
+
process11.exit();
|
|
7139
7174
|
}
|
|
7140
7175
|
if (isRust()) {
|
|
7141
7176
|
if (exec === "pi") {
|
|
@@ -7169,11 +7204,11 @@ async function setup() {
|
|
|
7169
7204
|
);
|
|
7170
7205
|
}
|
|
7171
7206
|
} else if (exec === "prun") {
|
|
7172
|
-
|
|
7207
|
+
jsShell13(`cargo run ${params}`);
|
|
7173
7208
|
} else if (exec === "pinit") {
|
|
7174
|
-
|
|
7209
|
+
jsShell13(`cargo init ${params}`);
|
|
7175
7210
|
} else if (exec === "pbuild") {
|
|
7176
|
-
|
|
7211
|
+
jsShell13(`cargo build ${params}`);
|
|
7177
7212
|
} else {
|
|
7178
7213
|
console.log(
|
|
7179
7214
|
import_picocolors7.default.red(
|
|
@@ -7181,7 +7216,7 @@ async function setup() {
|
|
|
7181
7216
|
)
|
|
7182
7217
|
);
|
|
7183
7218
|
}
|
|
7184
|
-
|
|
7219
|
+
process11.exit();
|
|
7185
7220
|
}
|
|
7186
7221
|
if (!runMap[exec]) {
|
|
7187
7222
|
console.log(
|
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.82",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "Simon He",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,6 +49,9 @@
|
|
|
49
49
|
"files": [
|
|
50
50
|
"dist"
|
|
51
51
|
],
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=16.0.0"
|
|
54
|
+
},
|
|
52
55
|
"scripts": {
|
|
53
56
|
"build": "tsup ./src/index.ts --format cjs,esm --dts --clean ",
|
|
54
57
|
"dev": "bun build -- --watch src",
|
|
@@ -62,9 +65,10 @@
|
|
|
62
65
|
"typecheck": "tsc --noEmit"
|
|
63
66
|
},
|
|
64
67
|
"dependencies": {
|
|
65
|
-
"ccommand": "^1.0.
|
|
68
|
+
"ccommand": "^1.0.55",
|
|
66
69
|
"fast-glob": "latest",
|
|
67
|
-
"lazy-js-utils": "latest"
|
|
70
|
+
"lazy-js-utils": "latest",
|
|
71
|
+
"semver": "^7.5.4"
|
|
68
72
|
},
|
|
69
73
|
"devDependencies": {
|
|
70
74
|
"@antfu/eslint-config": "^0.34.0",
|