@weaver-wow/cli 1.1.0 → 1.1.2

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/wvr.mjs +13 -6
  2. package/package.json +1 -1
package/dist/wvr.mjs CHANGED
@@ -3263,7 +3263,7 @@ import { existsSync } from "node:fs";
3263
3263
  async function findWoWPath() {
3264
3264
  if (process.platform === "win32") {
3265
3265
  try {
3266
- const result = execSync('reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Blizzard Entertainment\\World of Warcraft" /v InstallPath', { encoding: "utf-8" });
3266
+ const result = execSync('reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Blizzard Entertainment\\World of Warcraft" /v InstallPath 2>nul', { encoding: "utf-8" });
3267
3267
  const match = result.match(/REG_SZ\s+(.*)/);
3268
3268
  if (match && match[1]) {
3269
3269
  const path = match[1].trim();
@@ -3517,7 +3517,7 @@ async function loadConfig() {
3517
3517
  var import_picocolors4 = __toESM(require_picocolors(), 1);
3518
3518
  import { execSync as execSync2 } from "node:child_process";
3519
3519
  import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync4, readdirSync, mkdirSync as mkdirSync2, unlinkSync } from "node:fs";
3520
- import { dirname, join, relative } from "node:path";
3520
+ import { dirname, join, relative, resolve } from "node:path";
3521
3521
  import { createRequire as createRequire2 } from "node:module";
3522
3522
  var require2 = createRequire2(import.meta.url);
3523
3523
  var GENERATED_TSTL_CONFIG = ".tstl.build.json";
@@ -3539,6 +3539,10 @@ async function buildProject(config, silent = false) {
3539
3539
  throw new Error(`Missing ${import_picocolors4.default.bold("tsconfig.json")}.
3540
3540
  Run ${import_picocolors4.default.cyan("wvr init")} to set up your project structure.`);
3541
3541
  }
3542
+ if (!existsSync4("node_modules")) {
3543
+ throw new Error(`Missing ${import_picocolors4.default.bold("node_modules")}.
3544
+ Run ${import_picocolors4.default.cyan("bun install")} or ${import_picocolors4.default.cyan("npm install")} to install dependencies.`);
3545
+ }
3542
3546
  let entryPoint = config?.entry;
3543
3547
  if (!entryPoint) {
3544
3548
  const potentialEntries = ["src/App.tsx", "src/index.tsx", "src/App.ts", "src/index.ts"];
@@ -3564,10 +3568,13 @@ async function buildProject(config, silent = false) {
3564
3568
  mkdirSync2("dist");
3565
3569
  const buildConfig = generateBuildConfig(finalEntryPoint);
3566
3570
  try {
3571
+ const tstlPath = resolve("node_modules", "typescript-to-lua", "dist", "tstl.js");
3572
+ const cmd = existsSync4(tstlPath) ? `node "${tstlPath}"` : "npx typescript-to-lua";
3573
+ console.log(`[Weaver] Running: ${cmd}`);
3567
3574
  if (silent) {
3568
- execSync2(`npx tstl -p ${GENERATED_TSTL_CONFIG}`, { stdio: "pipe" });
3575
+ execSync2(`${cmd} -p ${GENERATED_TSTL_CONFIG}`, { stdio: "pipe" });
3569
3576
  } else {
3570
- execSync2(`npx tstl -p ${GENERATED_TSTL_CONFIG}`, { stdio: "inherit" });
3577
+ execSync2(`${cmd} -p ${GENERATED_TSTL_CONFIG}`, { stdio: "inherit" });
3571
3578
  }
3572
3579
  } catch (e) {
3573
3580
  let rawError = (e.stdout?.toString() || "") + (e.stderr?.toString() || "") + (e.message || "");
@@ -3810,7 +3817,7 @@ async function devCommand() {
3810
3817
 
3811
3818
  // src/cli/commands/link.ts
3812
3819
  import { symlinkSync, existsSync as existsSync5, rmSync, statSync, readFileSync as readFileSync3 } from "node:fs";
3813
- import { join as join2, resolve } from "node:path";
3820
+ import { join as join2, resolve as resolve2 } from "node:path";
3814
3821
  var import_picocolors7 = __toESM(require_picocolors(), 1);
3815
3822
  async function linkCommand() {
3816
3823
  Nt(import_picocolors7.default.bgBlue(" \uD83E\uDDF5 Weaver Link "));
@@ -3865,7 +3872,7 @@ async function linkCommand() {
3865
3872
  process.exit(1);
3866
3873
  }
3867
3874
  const targetLinkPath = join2(addonsDir, addonName);
3868
- const sourceDistPath = resolve("dist");
3875
+ const sourceDistPath = resolve2("dist");
3869
3876
  if (!existsSync5(sourceDistPath)) {
3870
3877
  console.error(import_picocolors7.default.red("dist/ folder does not exist. Run 'bun wvr build' first."));
3871
3878
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weaver-wow/cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Command line toolchain for building Weaver addons",
5
5
  "bin": {
6
6
  "wvr": "dist/wvr.mjs"