@mafly/bdev-cli 0.1.0 → 1.0.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.
package/dist/index.js CHANGED
@@ -6,11 +6,12 @@ import { devCommand } from "./commands/dev.js";
6
6
  import { packageCommand } from "./commands/package.js";
7
7
  import { doctorCommand } from "./commands/doctor.js";
8
8
  import { setConfigCommand, getConfigCommand, setPathCommand, } from "./commands/config.js";
9
+ import { getVersion } from "./utils/version.js";
9
10
  const program = new Command();
10
11
  program
11
12
  .name("bdev")
12
13
  .description("Modern CLI tool for Minecraft Bedrock Edition Addon development")
13
- .version("0.1.0");
14
+ .version(getVersion());
14
15
  program
15
16
  .command("init [directory]")
16
17
  .description("Scaffold a new Bedrock addon project")
@@ -0,0 +1 @@
1
+ export declare function getVersion(): string;
@@ -0,0 +1,23 @@
1
+ import fs from "node:fs";
2
+ export function getVersion() {
3
+ if (typeof __BDEV_VERSION__ !== "undefined") {
4
+ return __BDEV_VERSION__;
5
+ }
6
+ if (process.env.BDEV_VERSION) {
7
+ return process.env.BDEV_VERSION;
8
+ }
9
+ try {
10
+ const pkgUrl = new URL("../../package.json", import.meta.url);
11
+ if (fs.existsSync(pkgUrl)) {
12
+ const raw = fs.readFileSync(pkgUrl, "utf-8");
13
+ const pkg = JSON.parse(raw);
14
+ if (pkg.version) {
15
+ return pkg.version;
16
+ }
17
+ }
18
+ }
19
+ catch {
20
+ // Fallback
21
+ }
22
+ return "0.0.0-dev";
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mafly/bdev-cli",
3
- "version": "0.1.0",
3
+ "version": "1.0.1",
4
4
  "description": "Modern CLI tool for Minecraft Bedrock Edition Addon development",
5
5
  "author": "Mafly",
6
6
  "license": "MIT",