@simon_he/pi 0.1.12 → 0.1.14
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 +17 -9
- package/dist/index.js +17 -9
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -46,7 +46,7 @@ var import_node_process = __toESM(require("process"), 1);
|
|
|
46
46
|
var import_node = require("lazy-js-utils/node");
|
|
47
47
|
|
|
48
48
|
// package.json
|
|
49
|
-
var version = "0.1.
|
|
49
|
+
var version = "0.1.14";
|
|
50
50
|
|
|
51
51
|
// src/help.ts
|
|
52
52
|
var isZh = import_node_process.default.env.PI_Lang === "zh";
|
|
@@ -298,14 +298,13 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
298
298
|
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}";
|
|
299
299
|
}
|
|
300
300
|
const failMsg = pkg ? isZh3 ? `${params} \u5B89\u88C5\u5931\u8D25 \u{1F62D}` : `Failed to install ${params} \u{1F62D}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u5931\u8D25 \u{1F62D}" : "Failed to update dependency \u{1F62D}";
|
|
301
|
-
const newParams = isLatest ? params : await getParams(params);
|
|
302
301
|
const isSilent = import_node_process5.default.env.PI_SILENT === "true";
|
|
303
302
|
let stdio = isSilent ? "inherit" : ["inherit", "pipe", "inherit"];
|
|
304
303
|
let loading_status;
|
|
305
304
|
const { PI_DEFAULT, PI_MaxSockets: sockets } = import_node_process5.default.env;
|
|
306
305
|
const pkgTool = await (0, import_node6.getPkgTool)();
|
|
307
306
|
const maxSockets = sockets || 4;
|
|
308
|
-
const install =
|
|
307
|
+
const install = !params ? "install" : "add";
|
|
309
308
|
if (pkgTool === "npm") {
|
|
310
309
|
if (PI_DEFAULT) {
|
|
311
310
|
executor = `${PI_DEFAULT} ${install}`;
|
|
@@ -318,9 +317,11 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
318
317
|
executor = `${pkgTool} ${install}`;
|
|
319
318
|
loading_status = await loading(text, isSilent);
|
|
320
319
|
}
|
|
320
|
+
const newParams = isLatest ? "" : await getParams(params);
|
|
321
321
|
const runSockets = executor.split(" ")[0] === "npm" ? ` --max-sockets=${maxSockets}` : "";
|
|
322
|
+
console.log(import_picocolors4.default.green(isLatest ? params.map((p) => `${executor} ${p}`).join(" & ") : `${executor}${newParams ? ` ${newParams}` : runSockets}`));
|
|
322
323
|
let { status, result } = await (0, import_node6.useNodeWorker)({
|
|
323
|
-
params: `${executor}${newParams ? ` ${newParams}` : runSockets}`,
|
|
324
|
+
params: isLatest ? params.map((p) => `${executor} ${p}`).join(" & ") : `${executor}${newParams ? ` ${newParams}` : runSockets}`,
|
|
324
325
|
stdio,
|
|
325
326
|
errorExit: false
|
|
326
327
|
});
|
|
@@ -409,14 +410,14 @@ async function pil(params) {
|
|
|
409
410
|
const name = i.split(": ")[0];
|
|
410
411
|
if (name in devDependencies)
|
|
411
412
|
return `${name}@latest -D`;
|
|
412
|
-
return `${name}@latest`;
|
|
413
|
+
return `${name}@latest -S`;
|
|
413
414
|
});
|
|
414
415
|
params = names.join(" ");
|
|
415
416
|
}
|
|
416
417
|
let latestPkgname = params;
|
|
417
|
-
const reg = /\s(-[
|
|
418
|
+
const reg = /\s(-[dws]+)/gi;
|
|
418
419
|
const suffix = [];
|
|
419
|
-
|
|
420
|
+
const command = latestPkgname = (await getParams(params)).replace(
|
|
420
421
|
reg,
|
|
421
422
|
(_, k) => {
|
|
422
423
|
suffix.push(k);
|
|
@@ -427,8 +428,15 @@ async function pil(params) {
|
|
|
427
428
|
const v = dependencies[i] || devDependencies[i];
|
|
428
429
|
return `${i}$${v}`;
|
|
429
430
|
}).join(" ");
|
|
430
|
-
|
|
431
|
-
|
|
431
|
+
const group = {};
|
|
432
|
+
const items = command.replace(/\s+/, " ").trim().split(" ").map((i, idx) => [i, suffix[idx] || "-s"]);
|
|
433
|
+
for (const [pkg, flag] of items) {
|
|
434
|
+
if (!group[flag])
|
|
435
|
+
group[flag] = [];
|
|
436
|
+
group[flag].push(pkg);
|
|
437
|
+
}
|
|
438
|
+
const cmds = Object.entries(group).map(([flag, pkgs]) => `${pkgs.join(" ")} ${flag}`);
|
|
439
|
+
return await pi(cmds, latestPkgname.replace(/@latest/g, ""), "pil");
|
|
432
440
|
}
|
|
433
441
|
|
|
434
442
|
// src/pinit.ts
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import process from "node:process";
|
|
|
25
25
|
import { jsShell } from "lazy-js-utils/node";
|
|
26
26
|
|
|
27
27
|
// package.json
|
|
28
|
-
var version = "0.1.
|
|
28
|
+
var version = "0.1.14";
|
|
29
29
|
|
|
30
30
|
// src/help.ts
|
|
31
31
|
var isZh = process.env.PI_Lang === "zh";
|
|
@@ -277,14 +277,13 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
277
277
|
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}";
|
|
278
278
|
}
|
|
279
279
|
const failMsg = pkg ? isZh3 ? `${params} \u5B89\u88C5\u5931\u8D25 \u{1F62D}` : `Failed to install ${params} \u{1F62D}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u5931\u8D25 \u{1F62D}" : "Failed to update dependency \u{1F62D}";
|
|
280
|
-
const newParams = isLatest ? params : await getParams(params);
|
|
281
280
|
const isSilent = process5.env.PI_SILENT === "true";
|
|
282
281
|
let stdio = isSilent ? "inherit" : ["inherit", "pipe", "inherit"];
|
|
283
282
|
let loading_status;
|
|
284
283
|
const { PI_DEFAULT, PI_MaxSockets: sockets } = process5.env;
|
|
285
284
|
const pkgTool = await getPkgTool2();
|
|
286
285
|
const maxSockets = sockets || 4;
|
|
287
|
-
const install =
|
|
286
|
+
const install = !params ? "install" : "add";
|
|
288
287
|
if (pkgTool === "npm") {
|
|
289
288
|
if (PI_DEFAULT) {
|
|
290
289
|
executor = `${PI_DEFAULT} ${install}`;
|
|
@@ -297,9 +296,11 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
297
296
|
executor = `${pkgTool} ${install}`;
|
|
298
297
|
loading_status = await loading(text, isSilent);
|
|
299
298
|
}
|
|
299
|
+
const newParams = isLatest ? "" : await getParams(params);
|
|
300
300
|
const runSockets = executor.split(" ")[0] === "npm" ? ` --max-sockets=${maxSockets}` : "";
|
|
301
|
+
console.log(colors3.green(isLatest ? params.map((p) => `${executor} ${p}`).join(" & ") : `${executor}${newParams ? ` ${newParams}` : runSockets}`));
|
|
301
302
|
let { status, result } = await useNodeWorker({
|
|
302
|
-
params: `${executor}${newParams ? ` ${newParams}` : runSockets}`,
|
|
303
|
+
params: isLatest ? params.map((p) => `${executor} ${p}`).join(" & ") : `${executor}${newParams ? ` ${newParams}` : runSockets}`,
|
|
303
304
|
stdio,
|
|
304
305
|
errorExit: false
|
|
305
306
|
});
|
|
@@ -388,14 +389,14 @@ async function pil(params) {
|
|
|
388
389
|
const name = i.split(": ")[0];
|
|
389
390
|
if (name in devDependencies)
|
|
390
391
|
return `${name}@latest -D`;
|
|
391
|
-
return `${name}@latest`;
|
|
392
|
+
return `${name}@latest -S`;
|
|
392
393
|
});
|
|
393
394
|
params = names.join(" ");
|
|
394
395
|
}
|
|
395
396
|
let latestPkgname = params;
|
|
396
|
-
const reg = /\s(-[
|
|
397
|
+
const reg = /\s(-[dws]+)/gi;
|
|
397
398
|
const suffix = [];
|
|
398
|
-
|
|
399
|
+
const command = latestPkgname = (await getParams(params)).replace(
|
|
399
400
|
reg,
|
|
400
401
|
(_, k) => {
|
|
401
402
|
suffix.push(k);
|
|
@@ -406,8 +407,15 @@ async function pil(params) {
|
|
|
406
407
|
const v = dependencies[i] || devDependencies[i];
|
|
407
408
|
return `${i}$${v}`;
|
|
408
409
|
}).join(" ");
|
|
409
|
-
|
|
410
|
-
|
|
410
|
+
const group = {};
|
|
411
|
+
const items = command.replace(/\s+/, " ").trim().split(" ").map((i, idx) => [i, suffix[idx] || "-s"]);
|
|
412
|
+
for (const [pkg, flag] of items) {
|
|
413
|
+
if (!group[flag])
|
|
414
|
+
group[flag] = [];
|
|
415
|
+
group[flag].push(pkg);
|
|
416
|
+
}
|
|
417
|
+
const cmds = Object.entries(group).map(([flag, pkgs]) => `${pkgs.join(" ")} ${flag}`);
|
|
418
|
+
return await pi(cmds, latestPkgname.replace(/@latest/g, ""), "pil");
|
|
411
419
|
}
|
|
412
420
|
|
|
413
421
|
// src/pinit.ts
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simon_he/pi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"packageManager": "pnpm@10.
|
|
4
|
+
"version": "0.1.14",
|
|
5
|
+
"packageManager": "pnpm@10.10.0",
|
|
6
6
|
"description": "An intelligent cross-platform package manager and CLI tool that autodetects project environments (Node.mjs, Go, Rust, Python) with beautiful loading animations and smart command execution.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Simon He",
|
|
@@ -92,22 +92,22 @@
|
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"ccommand": "^1.0.84",
|
|
94
94
|
"fast-glob": "^3.3.3",
|
|
95
|
-
"lazy-js-utils": "^0.1.
|
|
95
|
+
"lazy-js-utils": "^0.1.43",
|
|
96
96
|
"ora": "^8.2.0",
|
|
97
97
|
"picocolors": "^1.1.1",
|
|
98
98
|
"semver": "^7.7.1"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@antfu/eslint-config": "^4.
|
|
102
|
-
"@types/node": "^22.
|
|
101
|
+
"@antfu/eslint-config": "^4.12.0",
|
|
102
|
+
"@types/node": "^22.15.3",
|
|
103
103
|
"bumpp": "^10.1.0",
|
|
104
|
-
"eslint": "^9.
|
|
104
|
+
"eslint": "^9.25.1",
|
|
105
105
|
"lint-staged": "^13.3.0",
|
|
106
106
|
"prettier": "^2.8.8",
|
|
107
107
|
"tsup": "^8.4.0",
|
|
108
|
-
"tsx": "^4.19.
|
|
108
|
+
"tsx": "^4.19.4",
|
|
109
109
|
"typescript": "^5.8.3",
|
|
110
|
-
"vitest": "^3.1.
|
|
110
|
+
"vitest": "^3.1.2"
|
|
111
111
|
},
|
|
112
112
|
"lint-staged": {
|
|
113
113
|
"*.{vue,js,ts,jsx,tsx,md,json}": "eslint . --fix"
|