@0x-jerry/x 2.3.0 → 2.3.2
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/chunk-O5N22U5G.js +15 -0
- package/dist/x.d.ts +1 -2
- package/dist/x.js +2 -0
- package/dist/xn.js +5 -5
- package/dist/xr.js +1 -1
- package/package.json +10 -7
- package/dist/chunk-W6PTQLAH.js +0 -38
|
@@ -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
package/dist/xn.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
exec,
|
|
4
4
|
exists
|
|
5
|
-
} from "./chunk-
|
|
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 (
|
|
50
|
+
if (exists(bunLockFile)) {
|
|
51
51
|
return "bun";
|
|
52
52
|
}
|
|
53
53
|
const pnpmLockFile = join(cwd, "pnpm-lock.yaml");
|
|
54
|
-
if (
|
|
54
|
+
if (exists(pnpmLockFile)) {
|
|
55
55
|
return "pnpm";
|
|
56
56
|
}
|
|
57
57
|
const yarnLockFile = join(cwd, "yarn.lock");
|
|
58
|
-
if (
|
|
58
|
+
if (exists(yarnLockFile)) {
|
|
59
59
|
return "yarn";
|
|
60
60
|
}
|
|
61
61
|
const jsonLockFile = join(cwd, "package-lock.json");
|
|
62
|
-
if (
|
|
62
|
+
if (exists(jsonLockFile)) {
|
|
63
63
|
return "npm";
|
|
64
64
|
}
|
|
65
65
|
return "pnpm";
|
package/dist/xr.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0x-jerry/x",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
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,9 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@0x-jerry/silver": "^0.1.5",
|
|
35
|
-
"@0x-jerry/utils": "^2.
|
|
35
|
+
"@0x-jerry/utils": "^2.2.1",
|
|
36
36
|
"decompress": "^4.2.1",
|
|
37
|
-
"execa": "^8.0.1",
|
|
38
37
|
"fs-extra": "^11.2.0",
|
|
39
38
|
"global-agent": "^3.0.0",
|
|
40
39
|
"got": "^14.2.1",
|
|
@@ -44,21 +43,25 @@
|
|
|
44
43
|
"prompts": "^2.4.2"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
|
-
"@0x-jerry/x-release": "^1.0.
|
|
46
|
+
"@0x-jerry/x-release": "^1.0.1",
|
|
48
47
|
"@types/decompress": "^4.2.7",
|
|
49
48
|
"@types/fs-extra": "^11.0.4",
|
|
50
49
|
"@types/global-agent": "^2.1.3",
|
|
51
|
-
"@types/node": "^20.11
|
|
50
|
+
"@types/node": "^20.12.11",
|
|
52
51
|
"@types/prompts": "^2.4.9",
|
|
52
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
53
53
|
"tsup": "^8.0.2",
|
|
54
|
-
"tsx": "^4.
|
|
55
|
-
"typescript": "^5.4.
|
|
54
|
+
"tsx": "^4.9.3",
|
|
55
|
+
"typescript": "^5.4.5",
|
|
56
|
+
"vitest": "^1.6.0"
|
|
56
57
|
},
|
|
57
58
|
"scripts": {
|
|
58
59
|
"build": "tsup",
|
|
59
60
|
"dev:xr": "tsx src/xr.ts",
|
|
60
61
|
"dev:xn": "tsx src/xn.ts",
|
|
61
62
|
"dev:x": "tsx src/x.ts",
|
|
63
|
+
"test": "vitest",
|
|
64
|
+
"ci:test": "vitest run",
|
|
62
65
|
"release": "x-release"
|
|
63
66
|
},
|
|
64
67
|
"typings": "dist/index.d.ts"
|
package/dist/chunk-W6PTQLAH.js
DELETED
|
@@ -1,38 +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", ["Invoke-Expression", finalCmd], {
|
|
12
|
-
stdio: "inherit",
|
|
13
|
-
env
|
|
14
|
-
});
|
|
15
|
-
} else {
|
|
16
|
-
await execa("sh", ["-c", cmd], { stdio: "inherit", env });
|
|
17
|
-
}
|
|
18
|
-
} catch (error) {
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
async function exec(script, params, env) {
|
|
23
|
-
const cmd = [script, ...params].join(" ");
|
|
24
|
-
await run(cmd, env);
|
|
25
|
-
}
|
|
26
|
-
async function exists(path) {
|
|
27
|
-
try {
|
|
28
|
-
await stat(path);
|
|
29
|
-
return true;
|
|
30
|
-
} catch (error) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export {
|
|
36
|
-
exec,
|
|
37
|
-
exists
|
|
38
|
-
};
|