@simon_he/pi 0.1.11 → 0.1.13

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 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.11";
49
+ var version = "0.1.13";
50
50
 
51
51
  // src/help.ts
52
52
  var isZh = import_node_process.default.env.PI_Lang === "zh";
@@ -236,7 +236,7 @@ async function getParams(params) {
236
236
  default:
237
237
  return params;
238
238
  }
239
- } catch (err) {
239
+ } catch (_) {
240
240
  console.log(
241
241
  import_picocolors3.default.red(
242
242
  `${isZh2 ? "package.json\u5E76\u4E0D\u5B58\u5728,\u5728\u4EE5\u4E0B\u76EE\u5F55\u4E2D:" : "package.json has not been found in"} ${import_node_process4.default.cwd()}`
@@ -245,13 +245,14 @@ async function getParams(params) {
245
245
  import_node_process4.default.exit(1);
246
246
  }
247
247
  }
248
- async function loading(text) {
248
+ async function loading(text, isSilent = false) {
249
249
  const { color: color4, spinner } = await getStyle();
250
250
  const ora = (await import("ora")).default;
251
251
  return ora({
252
252
  text,
253
253
  spinner,
254
254
  color: color4,
255
+ isSilent,
255
256
  discardStdin: true
256
257
  }).start();
257
258
  }
@@ -298,7 +299,8 @@ async function pi(params, pkg, executor = "ni") {
298
299
  }
299
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}";
300
301
  const newParams = isLatest ? params : await getParams(params);
301
- let stdio = ["inherit", "pipe", "inherit"];
302
+ const isSilent = import_node_process5.default.env.PI_SILENT === "true";
303
+ let stdio = isSilent ? "inherit" : ["inherit", "pipe", "inherit"];
302
304
  let loading_status;
303
305
  const { PI_DEFAULT, PI_MaxSockets: sockets } = import_node_process5.default.env;
304
306
  const pkgTool = await (0, import_node6.getPkgTool)();
@@ -307,16 +309,17 @@ async function pi(params, pkg, executor = "ni") {
307
309
  if (pkgTool === "npm") {
308
310
  if (PI_DEFAULT) {
309
311
  executor = `${PI_DEFAULT} ${install}`;
310
- loading_status = await loading(text);
312
+ loading_status = await loading(text, isSilent);
311
313
  } else {
312
314
  stdio = "inherit";
313
315
  executor = "ni";
314
316
  }
315
317
  } else {
316
318
  executor = `${pkgTool} ${install}`;
317
- loading_status = await loading(text);
319
+ loading_status = await loading(text, isSilent);
318
320
  }
319
321
  const runSockets = executor.split(" ")[0] === "npm" ? ` --max-sockets=${maxSockets}` : "";
322
+ console.log(import_picocolors4.default.green(`${executor}${newParams ? ` ${newParams}` : runSockets}`));
320
323
  let { status, result } = await (0, import_node6.useNodeWorker)({
321
324
  params: `${executor}${newParams ? ` ${newParams}` : runSockets}`,
322
325
  stdio,
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.11";
28
+ var version = "0.1.13";
29
29
 
30
30
  // src/help.ts
31
31
  var isZh = process.env.PI_Lang === "zh";
@@ -215,7 +215,7 @@ async function getParams(params) {
215
215
  default:
216
216
  return params;
217
217
  }
218
- } catch (err) {
218
+ } catch (_) {
219
219
  console.log(
220
220
  colors2.red(
221
221
  `${isZh2 ? "package.json\u5E76\u4E0D\u5B58\u5728,\u5728\u4EE5\u4E0B\u76EE\u5F55\u4E2D:" : "package.json has not been found in"} ${process4.cwd()}`
@@ -224,13 +224,14 @@ async function getParams(params) {
224
224
  process4.exit(1);
225
225
  }
226
226
  }
227
- async function loading(text) {
227
+ async function loading(text, isSilent = false) {
228
228
  const { color: color4, spinner } = await getStyle();
229
229
  const ora = (await import("ora")).default;
230
230
  return ora({
231
231
  text,
232
232
  spinner,
233
233
  color: color4,
234
+ isSilent,
234
235
  discardStdin: true
235
236
  }).start();
236
237
  }
@@ -277,7 +278,8 @@ async function pi(params, pkg, executor = "ni") {
277
278
  }
278
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}";
279
280
  const newParams = isLatest ? params : await getParams(params);
280
- let stdio = ["inherit", "pipe", "inherit"];
281
+ const isSilent = process5.env.PI_SILENT === "true";
282
+ let stdio = isSilent ? "inherit" : ["inherit", "pipe", "inherit"];
281
283
  let loading_status;
282
284
  const { PI_DEFAULT, PI_MaxSockets: sockets } = process5.env;
283
285
  const pkgTool = await getPkgTool2();
@@ -286,16 +288,17 @@ async function pi(params, pkg, executor = "ni") {
286
288
  if (pkgTool === "npm") {
287
289
  if (PI_DEFAULT) {
288
290
  executor = `${PI_DEFAULT} ${install}`;
289
- loading_status = await loading(text);
291
+ loading_status = await loading(text, isSilent);
290
292
  } else {
291
293
  stdio = "inherit";
292
294
  executor = "ni";
293
295
  }
294
296
  } else {
295
297
  executor = `${pkgTool} ${install}`;
296
- loading_status = await loading(text);
298
+ loading_status = await loading(text, isSilent);
297
299
  }
298
300
  const runSockets = executor.split(" ")[0] === "npm" ? ` --max-sockets=${maxSockets}` : "";
301
+ console.log(colors3.green(`${executor}${newParams ? ` ${newParams}` : runSockets}`));
299
302
  let { status, result } = await useNodeWorker({
300
303
  params: `${executor}${newParams ? ` ${newParams}` : runSockets}`,
301
304
  stdio,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@simon_he/pi",
3
3
  "type": "module",
4
- "version": "0.1.11",
5
- "packageManager": "pnpm@10.7.0",
4
+ "version": "0.1.13",
5
+ "packageManager": "pnpm@10.8.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",
@@ -80,7 +80,7 @@
80
80
  ],
81
81
  "scripts": {
82
82
  "build": "tsup ./src/index.ts --format cjs,esm --clean ",
83
- "dev": "bun build -- --watch src",
83
+ "dev": "pnpm build --watch src",
84
84
  "format": "prettier --write --cache .",
85
85
  "lint": "eslint .",
86
86
  "lint:fix": "eslint . --fix",
@@ -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.37",
95
+ "lazy-js-utils": "^0.1.39",
96
96
  "ora": "^8.2.0",
97
97
  "picocolors": "^1.1.1",
98
98
  "semver": "^7.7.1"
99
99
  },
100
100
  "devDependencies": {
101
101
  "@antfu/eslint-config": "^4.11.0",
102
- "@types/node": "^22.13.14",
102
+ "@types/node": "^22.14.0",
103
103
  "bumpp": "^10.1.0",
104
- "eslint": "^9.23.0",
104
+ "eslint": "^9.24.0",
105
105
  "lint-staged": "^13.3.0",
106
106
  "prettier": "^2.8.8",
107
107
  "tsup": "^8.4.0",
108
108
  "tsx": "^4.19.3",
109
- "typescript": "^5.8.2",
110
- "vitest": "^3.0.9"
109
+ "typescript": "^5.8.3",
110
+ "vitest": "^3.1.1"
111
111
  },
112
112
  "lint-staged": {
113
113
  "*.{vue,js,ts,jsx,tsx,md,json}": "eslint . --fix"