@simon_he/pi 0.1.21 → 0.1.23

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
@@ -41,9 +41,10 @@ node_fs = __toESM(node_fs);
41
41
  let node_os = require("node:os");
42
42
  node_os = __toESM(node_os);
43
43
  let node_module = require("node:module");
44
+ let node_url = require("node:url");
44
45
 
45
46
  //#region package.json
46
- var version = "0.1.21";
47
+ var version = "0.1.23";
47
48
 
48
49
  //#endregion
49
50
  //#region src/installDeps.ts
@@ -488,14 +489,17 @@ function pci(params, pkg) {
488
489
 
489
490
  //#endregion
490
491
  //#region src/require.ts
491
- const entry = node_process.default.argv[1];
492
- const base = entry ? node_path.default.resolve(entry) : node_path.default.join(node_process.default.cwd(), "index.js");
492
+ const base = (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
493
493
  const localRequire = (0, node_module.createRequire)(base);
494
+ function getCcommand() {
495
+ if (node_process.default.env.CCOMMAND_NO_HISTORY == null) node_process.default.env.CCOMMAND_NO_HISTORY = "1";
496
+ return localRequire("ccommand");
497
+ }
494
498
 
495
499
  //#endregion
496
500
  //#region src/pfind.ts
497
501
  function pfind(params) {
498
- const { ccommand } = localRequire("ccommand");
502
+ const { ccommand } = getCcommand();
499
503
  return ccommand(`find ${params}`);
500
504
  }
501
505
 
@@ -612,7 +616,7 @@ async function pix(params) {
612
616
  //#endregion
613
617
  //#region src/prun.ts
614
618
  function prun(params) {
615
- const { ccommand } = localRequire("ccommand");
619
+ const { ccommand } = getCcommand();
616
620
  return ccommand(params);
617
621
  }
618
622
 
@@ -712,7 +716,7 @@ async function setup() {
712
716
  } else if (exec === "prun") {
713
717
  const target = (await (0, fast_glob.default)(params ? params.endsWith(".go") ? [`**/${params}`] : [`**/${params}.go`, `**/${params}/main.go`] : "main.go"))[0];
714
718
  if (target) return await (0, lazy_js_utils_node.jsShell)(`go run ${target}`, "inherit");
715
- const { ccommand } = localRequire("ccommand");
719
+ const { ccommand } = getCcommand();
716
720
  return ccommand(params);
717
721
  } else if (exec === "pinit") await (0, lazy_js_utils_node.jsShell)(`go mod init ${params}`, "inherit");
718
722
  else if (exec === "pbuild") await (0, lazy_js_utils_node.jsShell)(`go build ${params}`, "inherit");
package/dist/index.mjs CHANGED
@@ -8,9 +8,10 @@ import color from "picocolors";
8
8
  import { log } from "node:console";
9
9
  import fs from "node:fs";
10
10
  import os from "node:os";
11
+ import { fileURLToPath } from "node:url";
11
12
 
12
13
  //#region package.json
13
- var version = "0.1.21";
14
+ var version = "0.1.23";
14
15
 
15
16
  //#endregion
16
17
  //#region src/installDeps.ts
@@ -455,14 +456,17 @@ function pci(params, pkg) {
455
456
 
456
457
  //#endregion
457
458
  //#region src/require.ts
458
- const entry = process.argv[1];
459
- const base = entry ? path.resolve(entry) : path.join(process.cwd(), "index.js");
459
+ const base = fileURLToPath(import.meta.url);
460
460
  const localRequire = createRequire(base);
461
+ function getCcommand() {
462
+ if (process.env.CCOMMAND_NO_HISTORY == null) process.env.CCOMMAND_NO_HISTORY = "1";
463
+ return localRequire("ccommand");
464
+ }
461
465
 
462
466
  //#endregion
463
467
  //#region src/pfind.ts
464
468
  function pfind(params) {
465
- const { ccommand } = localRequire("ccommand");
469
+ const { ccommand } = getCcommand();
466
470
  return ccommand(`find ${params}`);
467
471
  }
468
472
 
@@ -579,7 +583,7 @@ async function pix(params) {
579
583
  //#endregion
580
584
  //#region src/prun.ts
581
585
  function prun(params) {
582
- const { ccommand } = localRequire("ccommand");
586
+ const { ccommand } = getCcommand();
583
587
  return ccommand(params);
584
588
  }
585
589
 
@@ -679,7 +683,7 @@ async function setup() {
679
683
  } else if (exec === "prun") {
680
684
  const target = (await fg(params ? params.endsWith(".go") ? [`**/${params}`] : [`**/${params}.go`, `**/${params}/main.go`] : "main.go"))[0];
681
685
  if (target) return await jsShell(`go run ${target}`, "inherit");
682
- const { ccommand } = localRequire("ccommand");
686
+ const { ccommand } = getCcommand();
683
687
  return ccommand(params);
684
688
  } else if (exec === "pinit") await jsShell(`go mod init ${params}`, "inherit");
685
689
  else if (exec === "pbuild") await jsShell(`go build ${params}`, "inherit");
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@simon_he/pi",
3
3
  "type": "module",
4
- "version": "0.1.21",
5
- "packageManager": "pnpm@10.28.2",
4
+ "version": "0.1.23",
6
5
  "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
6
  "author": {
8
7
  "name": "Simon He",
@@ -78,19 +77,8 @@
78
77
  "files": [
79
78
  "dist"
80
79
  ],
81
- "scripts": {
82
- "build": "tsdown ./src/index.ts --format cjs,esm --clean",
83
- "dev": "pnpm build --watch src",
84
- "format": "prettier --write --cache .",
85
- "lint": "eslint .",
86
- "lint:fix": "eslint . --fix",
87
- "prepublishOnly": "nr build",
88
- "release": "bumpp && npm publish",
89
- "start": "esno src/index.ts",
90
- "test": "vitest"
91
- },
92
80
  "dependencies": {
93
- "ccommand": "^1.0.88",
81
+ "ccommand": "^1.0.89",
94
82
  "fast-glob": "^3.3.3",
95
83
  "lazy-js-utils": "^0.1.49",
96
84
  "ora": "^8.2.0",
@@ -111,5 +99,15 @@
111
99
  },
112
100
  "lint-staged": {
113
101
  "*.{vue,js,ts,jsx,tsx,md,json}": "eslint . --fix"
102
+ },
103
+ "scripts": {
104
+ "build": "tsdown ./src/index.ts --format cjs,esm --clean",
105
+ "dev": "pnpm build --watch src",
106
+ "format": "prettier --write --cache .",
107
+ "lint": "eslint .",
108
+ "lint:fix": "eslint . --fix",
109
+ "release": "bumpp && npm publish",
110
+ "start": "esno src/index.ts",
111
+ "test": "vitest"
114
112
  }
115
- }
113
+ }