@0x-jerry/x 2.2.2 → 2.3.1

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.
@@ -8,8 +8,9 @@ async function run(cmd, env) {
8
8
  try {
9
9
  if (os.platform() === "win32") {
10
10
  const finalCmd = JSON.stringify(cmd).replaceAll(`\\"`, '`"');
11
- await execa("powershell", ["Invoke-Expression", finalCmd], {
11
+ await execa("pwsh", ["-c", finalCmd], {
12
12
  stdio: "inherit",
13
+ shell: true,
13
14
  env
14
15
  });
15
16
  } else {
package/dist/x.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export { }
2
+ export { }
package/dist/xn.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  exec,
4
4
  exists
5
- } from "./chunk-OL62CB6T.js";
5
+ } from "./chunk-M2RNBMSR.js";
6
6
 
7
7
  // src/xn.ts
8
8
  import { sliver } from "@0x-jerry/silver";
@@ -16,17 +16,20 @@ var npmCommandMapper = {
16
16
  install: {
17
17
  npm: "i",
18
18
  yarn: "install",
19
- pnpm: "i"
19
+ pnpm: "i",
20
+ bun: "i"
20
21
  },
21
22
  add: {
22
23
  npm: "i",
23
24
  yarn: "add",
24
- pnpm: "i"
25
+ pnpm: "i",
26
+ bun: "add"
25
27
  },
26
28
  upgrade: {
27
29
  npm: "up",
28
30
  yarn: "upgrade",
29
- pnpm: "up"
31
+ pnpm: "up",
32
+ bun: "update"
30
33
  }
31
34
  };
32
35
  async function runNpm(action, ...params) {
@@ -43,6 +46,10 @@ async function runNpm(action, ...params) {
43
46
  await exec(npmCommand, [actionName, ...params]);
44
47
  }
45
48
  async function detectNpmCommand(cwd = process.cwd()) {
49
+ const bunLockFile = join(cwd, "bun.lockb");
50
+ if (await exists(bunLockFile)) {
51
+ return "bun";
52
+ }
46
53
  const pnpmLockFile = join(cwd, "pnpm-lock.yaml");
47
54
  if (await exists(pnpmLockFile)) {
48
55
  return "pnpm";
package/dist/xr.js CHANGED
@@ -1,18 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  exec
4
- } from "./chunk-OL62CB6T.js";
4
+ } from "./chunk-M2RNBMSR.js";
5
5
 
6
6
  // src/xr.ts
7
7
  import { sliver } from "@0x-jerry/silver";
8
8
 
9
9
  // src/commands/run.ts
10
- import { join, resolve } from "path";
10
+ import path, { join, resolve } from "path";
11
11
  import pc from "picocolors";
12
12
  import jsonc from "jsonc-parser";
13
13
  import { readFile, readdir } from "fs/promises";
14
14
  import { statSync } from "fs";
15
- import os from "os";
16
15
  var { red, cyan } = pc;
17
16
  async function runScript(command, params = []) {
18
17
  const [scriptExecuteContent, allScripts] = await getScriptContent(command);
@@ -41,7 +40,7 @@ function makeEnv() {
41
40
  }
42
41
  dir = resolve(dir, "..");
43
42
  } while (dir !== resolve(dir, ".."));
44
- const separator = os.platform() === "win32" ? ";" : ":";
43
+ const separator = path.delimiter;
45
44
  const PATH = envPaths.join(separator);
46
45
  env.PATH = [process.env.PATH || "", PATH].filter(Boolean).join(separator);
47
46
  return env;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0x-jerry/x",
3
- "version": "2.2.2",
3
+ "version": "2.3.1",
4
4
  "main": "dist/index.js",
5
5
  "repository": "https://github.com/0x-jerry/x.git",
6
6
  "author": "Jerry Wang <x.jerry.wang@gmail.com>",
@@ -32,27 +32,27 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@0x-jerry/silver": "^0.1.5",
35
- "@0x-jerry/utils": "^2.0.0",
35
+ "@0x-jerry/utils": "^2.1.1",
36
36
  "decompress": "^4.2.1",
37
37
  "execa": "^8.0.1",
38
- "fs-extra": "^11.1.1",
38
+ "fs-extra": "^11.2.0",
39
39
  "global-agent": "^3.0.0",
40
- "got": "^13.0.0",
41
- "jsonc-parser": "^3.2.0",
42
- "ora": "^7.0.1",
40
+ "got": "^14.2.1",
41
+ "jsonc-parser": "^3.2.1",
42
+ "ora": "^8.0.1",
43
43
  "picocolors": "^1.0.0",
44
44
  "prompts": "^2.4.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@0x-jerry/x-release": "^0.4.0",
48
- "@types/decompress": "^4.2.4",
49
- "@types/fs-extra": "^11.0.2",
50
- "@types/global-agent": "^2.1.1",
51
- "@types/node": "^20.6.2",
52
- "@types/prompts": "^2.4.4",
53
- "tsup": "^7.2.0",
54
- "tsx": "^3.12.10",
55
- "typescript": "^5.2.2"
47
+ "@0x-jerry/x-release": "^1.0.0",
48
+ "@types/decompress": "^4.2.7",
49
+ "@types/fs-extra": "^11.0.4",
50
+ "@types/global-agent": "^2.1.3",
51
+ "@types/node": "^20.11.30",
52
+ "@types/prompts": "^2.4.9",
53
+ "tsup": "^8.0.2",
54
+ "tsx": "^4.7.1",
55
+ "typescript": "^5.4.2"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsup",