@0x-jerry/x 2.3.1 → 2.3.3

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.
@@ -0,0 +1,15 @@
1
+ // src/utils.ts
2
+ import { existsSync } from "fs";
3
+ import { run } from "@0x-jerry/utils/node";
4
+ async function exec(script, params, env) {
5
+ const cmd = [script, ...params].join(" ");
6
+ await run(cmd, env);
7
+ }
8
+ function exists(path) {
9
+ return existsSync(path);
10
+ }
11
+
12
+ export {
13
+ exec,
14
+ exists
15
+ };
package/dist/x.d.ts CHANGED
@@ -1,2 +1 @@
1
-
2
- export { }
1
+ #!/usr/bin/env node
package/dist/x.js CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  // src/x.ts
2
4
  import { sliver } from "@0x-jerry/silver";
3
5
 
package/dist/xn.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  exec,
4
4
  exists
5
- } from "./chunk-M2RNBMSR.js";
5
+ } from "./chunk-O5N22U5G.js";
6
6
 
7
7
  // src/xn.ts
8
8
  import { sliver } from "@0x-jerry/silver";
@@ -47,19 +47,19 @@ async function runNpm(action, ...params) {
47
47
  }
48
48
  async function detectNpmCommand(cwd = process.cwd()) {
49
49
  const bunLockFile = join(cwd, "bun.lockb");
50
- if (await exists(bunLockFile)) {
50
+ if (exists(bunLockFile)) {
51
51
  return "bun";
52
52
  }
53
53
  const pnpmLockFile = join(cwd, "pnpm-lock.yaml");
54
- if (await exists(pnpmLockFile)) {
54
+ if (exists(pnpmLockFile)) {
55
55
  return "pnpm";
56
56
  }
57
57
  const yarnLockFile = join(cwd, "yarn.lock");
58
- if (await exists(yarnLockFile)) {
58
+ if (exists(yarnLockFile)) {
59
59
  return "yarn";
60
60
  }
61
61
  const jsonLockFile = join(cwd, "package-lock.json");
62
- if (await exists(jsonLockFile)) {
62
+ if (exists(jsonLockFile)) {
63
63
  return "npm";
64
64
  }
65
65
  return "pnpm";
package/dist/xr.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  exec
4
- } from "./chunk-M2RNBMSR.js";
4
+ } from "./chunk-O5N22U5G.js";
5
5
 
6
6
  // src/xr.ts
7
7
  import { sliver } from "@0x-jerry/silver";
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@0x-jerry/x",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "main": "dist/index.js",
5
- "repository": "https://github.com/0x-jerry/x.git",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/0x-jerry/x.git"
8
+ },
6
9
  "author": "Jerry Wang <x.jerry.wang@gmail.com>",
7
10
  "license": "MIT",
8
11
  "type": "module",
@@ -32,9 +35,8 @@
32
35
  },
33
36
  "dependencies": {
34
37
  "@0x-jerry/silver": "^0.1.5",
35
- "@0x-jerry/utils": "^2.1.1",
38
+ "@0x-jerry/utils": "^2.2.2",
36
39
  "decompress": "^4.2.1",
37
- "execa": "^8.0.1",
38
40
  "fs-extra": "^11.2.0",
39
41
  "global-agent": "^3.0.0",
40
42
  "got": "^14.2.1",
@@ -44,21 +46,25 @@
44
46
  "prompts": "^2.4.2"
45
47
  },
46
48
  "devDependencies": {
47
- "@0x-jerry/x-release": "^1.0.0",
49
+ "@0x-jerry/x-release": "^1.0.1",
48
50
  "@types/decompress": "^4.2.7",
49
51
  "@types/fs-extra": "^11.0.4",
50
52
  "@types/global-agent": "^2.1.3",
51
- "@types/node": "^20.11.30",
53
+ "@types/node": "^20.12.11",
52
54
  "@types/prompts": "^2.4.9",
55
+ "@vitest/coverage-v8": "^1.6.0",
53
56
  "tsup": "^8.0.2",
54
- "tsx": "^4.7.1",
55
- "typescript": "^5.4.2"
57
+ "tsx": "^4.9.3",
58
+ "typescript": "^5.4.5",
59
+ "vitest": "^1.6.0"
56
60
  },
57
61
  "scripts": {
58
62
  "build": "tsup",
59
63
  "dev:xr": "tsx src/xr.ts",
60
64
  "dev:xn": "tsx src/xn.ts",
61
65
  "dev:x": "tsx src/x.ts",
66
+ "test": "vitest",
67
+ "ci:test": "vitest run",
62
68
  "release": "x-release"
63
69
  },
64
70
  "typings": "dist/index.d.ts"
@@ -1,39 +0,0 @@
1
- // src/utils.ts
2
- import { execa } from "execa";
3
- import { stat } from "fs/promises";
4
- import pc from "picocolors";
5
- import os from "os";
6
- async function run(cmd, env) {
7
- console.log(pc.dim("$"), pc.dim(cmd));
8
- try {
9
- if (os.platform() === "win32") {
10
- const finalCmd = JSON.stringify(cmd).replaceAll(`\\"`, '`"');
11
- await execa("pwsh", ["-c", finalCmd], {
12
- stdio: "inherit",
13
- shell: true,
14
- env
15
- });
16
- } else {
17
- await execa("sh", ["-c", cmd], { stdio: "inherit", env });
18
- }
19
- } catch (error) {
20
- process.exit(1);
21
- }
22
- }
23
- async function exec(script, params, env) {
24
- const cmd = [script, ...params].join(" ");
25
- await run(cmd, env);
26
- }
27
- async function exists(path) {
28
- try {
29
- await stat(path);
30
- return true;
31
- } catch (error) {
32
- return false;
33
- }
34
- }
35
-
36
- export {
37
- exec,
38
- exists
39
- };