@0x-jerry/x 2.3.3 → 2.3.4

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.
Files changed (2) hide show
  1. package/dist/xr.js +6 -10
  2. package/package.json +2 -2
package/dist/xr.js CHANGED
@@ -11,7 +11,7 @@ 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
- import { statSync } from "fs";
14
+ import { existsSync } from "fs";
15
15
  var { red, cyan } = pc;
16
16
  async function runScript(command, params = []) {
17
17
  const [scriptExecuteContent, allScripts] = await getScriptContent(command);
@@ -29,20 +29,16 @@ async function runScript(command, params = []) {
29
29
  function makeEnv() {
30
30
  const cwd = process.cwd();
31
31
  const env = process.env;
32
- const envPaths = [];
32
+ const envPaths = process.env.PATH?.split(path.delimiter) || [];
33
33
  let dir = cwd;
34
34
  do {
35
- const PATH2 = join(dir, "node_modules", ".bin");
36
- try {
37
- statSync(PATH2);
38
- envPaths.push(PATH2);
39
- } catch (_error) {
35
+ const binPath = join(dir, "node_modules", ".bin");
36
+ if (existsSync(binPath)) {
37
+ envPaths.push(binPath);
40
38
  }
41
39
  dir = resolve(dir, "..");
42
40
  } while (dir !== resolve(dir, ".."));
43
- const separator = path.delimiter;
44
- const PATH = envPaths.join(separator);
45
- env.PATH = [process.env.PATH || "", PATH].filter(Boolean).join(separator);
41
+ env.PATH = envPaths.join(path.delimiter);
46
42
  return env;
47
43
  }
48
44
  async function getPackageScripts() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0x-jerry/x",
3
- "version": "2.3.3",
3
+ "version": "2.3.4",
4
4
  "main": "dist/index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@0x-jerry/silver": "^0.1.5",
38
- "@0x-jerry/utils": "^2.2.2",
38
+ "@0x-jerry/utils": "^2.2.3",
39
39
  "decompress": "^4.2.1",
40
40
  "fs-extra": "^11.2.0",
41
41
  "global-agent": "^3.0.0",