@locale-labs/miniapp-builder 0.1.4 → 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.
- package/dist/index.js +47 -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
|
-
|
|
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();
|