@0x-jerry/x 2.1.1 → 2.2.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.
@@ -2,10 +2,19 @@
2
2
  import { execa } from "execa";
3
3
  import { stat } from "fs/promises";
4
4
  import pc from "picocolors";
5
+ import os from "os";
5
6
  async function run(cmd, env) {
6
7
  console.log(pc.dim("$"), pc.dim(cmd));
7
8
  try {
8
- await execa("sh", ["-c", cmd], { stdio: "inherit", env });
9
+ if (os.platform() === "win32") {
10
+ const finalCmd = JSON.stringify(cmd).replaceAll(`\\"`, '`"');
11
+ await execa("powershell", ["Invoke-Expression", finalCmd], {
12
+ stdio: "inherit",
13
+ env
14
+ });
15
+ } else {
16
+ await execa("sh", ["-c", cmd], { stdio: "inherit", env });
17
+ }
9
18
  } catch (error) {
10
19
  process.exit(1);
11
20
  }
package/dist/xn.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  exec,
4
4
  exists
5
- } from "./chunk-5X7RM5CJ.js";
5
+ } from "./chunk-OL62CB6T.js";
6
6
 
7
7
  // src/xn.ts
8
8
  import { sliver } from "@0x-jerry/silver";
package/dist/xr.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  exec
4
- } from "./chunk-5X7RM5CJ.js";
4
+ } from "./chunk-OL62CB6T.js";
5
5
 
6
6
  // src/xr.ts
7
7
  import { sliver } from "@0x-jerry/silver";
@@ -12,6 +12,7 @@ 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";
15
16
  var { red, cyan } = pc;
16
17
  async function runScript(command, params = []) {
17
18
  const [scriptExecuteContent, allScripts] = await getScriptContent(command);
@@ -40,8 +41,9 @@ function makeEnv() {
40
41
  }
41
42
  dir = resolve(dir, "..");
42
43
  } while (dir !== resolve(dir, ".."));
43
- const PATH = envPaths.join(":");
44
- env.PATH = [process.env.PATH || "", PATH].filter(Boolean).join(":");
44
+ const separator = os.platform() === "win32" ? ";" : ":";
45
+ const PATH = envPaths.join(separator);
46
+ env.PATH = [process.env.PATH || "", PATH].filter(Boolean).join(separator);
45
47
  return env;
46
48
  }
47
49
  async function getPackageScripts() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0x-jerry/x",
3
- "version": "2.1.1",
3
+ "version": "2.2.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>",
@@ -8,7 +8,7 @@
8
8
  "type": "module",
9
9
  "publishConfig": {
10
10
  "access": "public",
11
- "registry": "https://registry.npmjs.org"
11
+ "registry": "https://registry.npmjs.com"
12
12
  },
13
13
  "files": [
14
14
  "dist"
@@ -44,7 +44,7 @@
44
44
  "prompts": "^2.4.2"
45
45
  },
46
46
  "devDependencies": {
47
- "@0x-jerry/x-release": "^0.3.9",
47
+ "@0x-jerry/x-release": "^0.4.0",
48
48
  "@types/decompress": "^4.2.4",
49
49
  "@types/fs-extra": "^11.0.2",
50
50
  "@types/global-agent": "^2.1.1",
package/readme.md CHANGED
@@ -1,19 +1,19 @@
1
- # X
2
-
3
- Some useful command for myself.
4
-
5
- ## Install
6
-
7
- ```sh
8
- npm i -g @0x-jerry/x
9
- ```
10
-
11
- ## Command Completions
12
-
13
- Add this code to `~/.zshrc`
14
-
15
- ```zsh
16
- source <(x completions)
17
- source <(xr completions)
18
- source <(xn completions)
19
- ```
1
+ # X
2
+
3
+ Some useful command for myself.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm i -g @0x-jerry/x
9
+ ```
10
+
11
+ ## Command Completions
12
+
13
+ Add this code to `~/.zshrc`
14
+
15
+ ```zsh
16
+ source <(x completions)
17
+ source <(xr completions)
18
+ source <(xn completions)
19
+ ```