@xyd-js/cli 0.0.0-build-139078b-20250813084450 → 0.0.0-build-b24fb82-20250813100124

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/index.js +24 -8
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -13,14 +13,30 @@ import updateNotifier from "update-notifier";
13
13
  var MIN_NODE_VERSION = 22;
14
14
 
15
15
  // src/utils.ts
16
- import { readFileSync } from "fs";
16
+ import { readFileSync, realpathSync } from "fs";
17
17
  import { fileURLToPath } from "url";
18
18
  import { dirname, join } from "path";
19
19
  import colors from "picocolors";
20
- var __filename = fileURLToPath(import.meta.url);
21
- var __dirname = dirname(__filename);
22
- var packageJsonPath = join(__dirname, "..", "package.json");
23
- var packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
20
+ var packageJson = {};
21
+ (() => {
22
+ const cliPath = realpathSync(process.argv[1]);
23
+ let packageJsonRaw = "";
24
+ try {
25
+ packageJsonRaw = readFileSync(join(cliPath, "package.json"), "utf8");
26
+ } catch (e) {
27
+ try {
28
+ packageJsonRaw = readFileSync(join(cliPath, "..", "package.json"), "utf8");
29
+ } catch (e2) {
30
+ }
31
+ }
32
+ if (!packageJsonRaw) {
33
+ const __filename = fileURLToPath(import.meta.url);
34
+ const __dirname = dirname(__filename);
35
+ const packageJsonPath = join(__dirname, "..", "package.json");
36
+ packageJsonRaw = readFileSync(packageJsonPath, "utf8");
37
+ }
38
+ packageJson = JSON.parse(packageJsonRaw || "{}");
39
+ })();
24
40
  function getPackageJson() {
25
41
  return packageJson;
26
42
  }
@@ -161,9 +177,9 @@ import { spawn } from "child_process";
161
177
  import { fileURLToPath as fileURLToPath2 } from "url";
162
178
  import { dirname as dirname2, join as join2 } from "path";
163
179
  async function build() {
164
- const __filename2 = fileURLToPath2(import.meta.url);
165
- const __dirname2 = dirname2(__filename2);
166
- const buildScript = join2(__dirname2, "..", "dist", "build.js");
180
+ const __filename = fileURLToPath2(import.meta.url);
181
+ const __dirname = dirname2(__filename);
182
+ const buildScript = join2(__dirname, "..", "dist", "build.js");
167
183
  return new Promise((resolve2, reject) => {
168
184
  const args = process.argv.slice(2);
169
185
  const child = spawn("node", [buildScript, ...args], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyd-js/cli",
3
- "version": "0.0.0-build-139078b-20250813084450",
3
+ "version": "0.0.0-build-b24fb82-20250813100124",
4
4
  "keywords": [],
5
5
  "author": "",
6
6
  "description": "",
@@ -26,9 +26,9 @@
26
26
  "semver": "^7.6.3",
27
27
  "unist-util-visit": "^5.0.0",
28
28
  "update-notifier": "^7.3.1",
29
- "@xyd-js/documan": "0.0.0-build-139078b-20250813084450",
30
- "@xyd-js/host": "0.0.0-build-139078b-20250813084450",
31
- "@xyd-js/core": "0.0.0-build-139078b-20250813084450"
29
+ "@xyd-js/documan": "0.0.0-build-b24fb82-20250813100124",
30
+ "@xyd-js/host": "0.0.0-build-b24fb82-20250813100124",
31
+ "@xyd-js/core": "0.0.0-build-b24fb82-20250813100124"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/update-notifier": "^6.0.8",