@dwizi/create-dzx 0.1.9 → 0.1.10

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/bin/index.js +9 -6
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -253,14 +253,17 @@ function printKeyValueList(items) {
253
253
  */
254
254
  async function getDzxVersion() {
255
255
  try {
256
- const { promisify } = await import("node:util");
257
- const { exec } = promisify(await import("node:child_process"));
258
- const { stdout } = await exec("npm view @dwizi/dzx version", { encoding: "utf8" });
259
- return stdout.trim();
256
+ const { createRequire } = await import("node:module");
257
+ const require = createRequire(import.meta.url);
258
+ const dzxPkgJsonPath = require.resolve("@dwizi/dzx/package.json", { paths: [process.cwd()] });
259
+ const dzxPkg = JSON.parse(fs.readFileSync(dzxPkgJsonPath, "utf8"));
260
+ if (dzxPkg && typeof dzxPkg.version === "string" && dzxPkg.version.trim()) {
261
+ return dzxPkg.version.trim();
262
+ }
260
263
  } catch {
261
- // Fallback version if npm query fails
262
- return "latest";
263
264
  }
265
+ // Fallback version if we cannot resolve an installed @dwizi/dzx
266
+ return "*";
264
267
  }
265
268
 
266
269
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dwizi/create-dzx",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {