@locale-labs/miniapp-builder 0.1.4 → 0.1.6

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 +47 -2
  2. package/package.json +2 -2
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");
@@ -57217,15 +57219,36 @@ function ensureTempDir2() {
57217
57219
  fs7.mkdirSync(TEMP_DIR, { recursive: true });
57218
57220
  }
57219
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
+ }
57220
57236
  async function dev() {
57221
57237
  console.log("\u{1F440} Starting development server...");
57222
57238
  ensureTempDir2();
57239
+ console.log("[dev] Running initial processHtml...");
57223
57240
  await processHtml({ verbose: false });
57241
+ console.log("[dev] Running initial bundle...");
57242
+ bundle();
57243
+ console.log("[dev] Initial build done.");
57224
57244
  console.log(" Watching HTML...");
57245
+ console.log(`[dev] Watching HTML dir: ${HTML_SRC_DIR}`);
57225
57246
  fs7.watch(HTML_SRC_DIR, { recursive: true }, async (eventType, filename) => {
57247
+ console.log(`[dev] HTML watcher fired: event=${eventType}, file=${filename}`);
57226
57248
  if (filename && filename.endsWith(".html")) {
57227
57249
  console.log(`\u{1F4DD} HTML Changed: ${filename}`);
57228
57250
  await processHtml({ verbose: false });
57251
+ debouncedBundle("html-change");
57229
57252
  }
57230
57253
  });
57231
57254
  console.log(" Watching TypeScript...");
@@ -57238,7 +57261,15 @@ async function dev() {
57238
57261
  "process.env.MINIAPP_SUPABASE_URL": `'${process.env.MINIAPP_SUPABASE_URL || ""}'`,
57239
57262
  "process.env.MINIAPP_SUPABASE_ANON_PUBLIC": `'${process.env.MINIAPP_SUPABASE_ANON_PUBLIC || ""}'`
57240
57263
  },
57241
- 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
+ }]
57242
57273
  });
57243
57274
  await ctx.watch();
57244
57275
  console.log(" Watching CSS...");
@@ -57253,6 +57284,20 @@ async function dev() {
57253
57284
  stdio: "inherit",
57254
57285
  cwd: process.cwd()
57255
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
+ }
57256
57301
  process.on("SIGINT", async () => {
57257
57302
  console.log("\nStopping watchers...");
57258
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",
3
+ "version": "0.1.6",
4
4
  "description": "Build tool for Localé Mini-Apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  "security-check": "bunx @socketsecurity/cli ci"
20
20
  },
21
21
  "dependencies": {
22
- "@locale-labs/miniapp-sdk": "^0.1.2",
22
+ "@locale-labs/miniapp-sdk": "0.2.0-beta.1",
23
23
  "@types/html-minifier-terser": "7.0.2",
24
24
  "autoprefixer": "10.4.23",
25
25
  "html-minifier-terser": "7.2.0",