@locale-labs/miniapp-builder 0.1.4-beta.1 → 0.1.5

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 +49 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -57055,7 +57055,9 @@ function resolveConfig(name, optionValue, envName) {
57055
57055
  }
57056
57056
  async function deploy(options = {}) {
57057
57057
  const CWD2 = process.cwd();
57058
- await bumpVersion();
57058
+ if (process.stdin.isTTY) {
57059
+ await bumpVersion();
57060
+ }
57059
57061
  const MINIAPP_FUNCTIONS_URL = resolveConfig("MiniApp Functions URL", options.functionsUrl, "MINIAPP_SUPABASE_URL");
57060
57062
  const MINIAPP_API_KEY = resolveConfig("MiniApp API Key", options.apiKey, "MINIAPP_API_KEY");
57061
57063
  const packagePath = path3.join(CWD2, "package.json");
@@ -57123,7 +57125,8 @@ ${fileContent}`;
57123
57125
  },
57124
57126
  body: JSON.stringify({
57125
57127
  version,
57126
- html_content: fileContent
57128
+ html_content: fileContent,
57129
+ env: process.env.DEPLOY_ENV || "prod"
57127
57130
  })
57128
57131
  });
57129
57132
  if (!response.ok) {
@@ -57216,15 +57219,36 @@ function ensureTempDir2() {
57216
57219
  fs7.mkdirSync(TEMP_DIR, { recursive: true });
57217
57220
  }
57218
57221
  }
57222
+ var bundleTimeout = null;
57223
+ function debouncedBundle(trigger) {
57224
+ console.log(`[dev] \u{1F504} Bundle triggered by: ${trigger}`);
57225
+ if (bundleTimeout) clearTimeout(bundleTimeout);
57226
+ bundleTimeout = setTimeout(() => {
57227
+ try {
57228
+ console.log(`[dev] \u{1F4E6} Running bundle...`);
57229
+ bundle();
57230
+ console.log(`[dev] \u2705 Bundle complete. Output: ${FILES.outputHtml}`);
57231
+ } catch (error) {
57232
+ console.error("[dev] \u274C Bundle error:", error);
57233
+ }
57234
+ }, 300);
57235
+ }
57219
57236
  async function dev() {
57220
57237
  console.log("\u{1F440} Starting development server...");
57221
57238
  ensureTempDir2();
57239
+ console.log("[dev] Running initial processHtml...");
57222
57240
  await processHtml({ verbose: false });
57241
+ console.log("[dev] Running initial bundle...");
57242
+ bundle();
57243
+ console.log("[dev] Initial build done.");
57223
57244
  console.log(" Watching HTML...");
57245
+ console.log(`[dev] Watching HTML dir: ${HTML_SRC_DIR}`);
57224
57246
  fs7.watch(HTML_SRC_DIR, { recursive: true }, async (eventType, filename) => {
57247
+ console.log(`[dev] HTML watcher fired: event=${eventType}, file=${filename}`);
57225
57248
  if (filename && filename.endsWith(".html")) {
57226
57249
  console.log(`\u{1F4DD} HTML Changed: ${filename}`);
57227
57250
  await processHtml({ verbose: false });
57251
+ debouncedBundle("html-change");
57228
57252
  }
57229
57253
  });
57230
57254
  console.log(" Watching TypeScript...");
@@ -57237,7 +57261,15 @@ async function dev() {
57237
57261
  "process.env.MINIAPP_SUPABASE_URL": `'${process.env.MINIAPP_SUPABASE_URL || ""}'`,
57238
57262
  "process.env.MINIAPP_SUPABASE_ANON_PUBLIC": `'${process.env.MINIAPP_SUPABASE_ANON_PUBLIC || ""}'`
57239
57263
  },
57240
- logLevel: "info"
57264
+ logLevel: "info",
57265
+ plugins: [{
57266
+ name: "bundle-on-rebuild",
57267
+ setup(build3) {
57268
+ build3.onEnd(() => {
57269
+ debouncedBundle("ts-rebuild");
57270
+ });
57271
+ }
57272
+ }]
57241
57273
  });
57242
57274
  await ctx.watch();
57243
57275
  console.log(" Watching CSS...");
@@ -57252,6 +57284,20 @@ async function dev() {
57252
57284
  stdio: "inherit",
57253
57285
  cwd: process.cwd()
57254
57286
  });
57287
+ if (fs7.existsSync(FILES.css)) {
57288
+ fs7.watch(FILES.css, () => {
57289
+ debouncedBundle("css-change");
57290
+ });
57291
+ } else {
57292
+ const checkInterval = setInterval(() => {
57293
+ if (fs7.existsSync(FILES.css)) {
57294
+ clearInterval(checkInterval);
57295
+ fs7.watch(FILES.css, () => {
57296
+ debouncedBundle("css-change");
57297
+ });
57298
+ }
57299
+ }, 1e3);
57300
+ }
57255
57301
  process.on("SIGINT", async () => {
57256
57302
  console.log("\nStopping watchers...");
57257
57303
  await ctx.dispose();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locale-labs/miniapp-builder",
3
- "version": "0.1.4-beta.1",
3
+ "version": "0.1.5",
4
4
  "description": "Build tool for Localé Mini-Apps",
5
5
  "repository": {
6
6
  "type": "git",