@jsnchn/buntastic 0.0.5 → 0.0.7

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/package.json +1 -1
  2. package/src/index.ts +10 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsnchn/buntastic",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "A simple static site generator built with Bun",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -292,18 +292,27 @@ async function dev(): Promise<void> {
292
292
 
293
293
  console.log(`Dev server running at http://localhost:${server.port}`);
294
294
 
295
+ await build(false);
296
+
295
297
  const watcher1 = fsWatch(CONTENT_DIR, { recursive: true });
296
298
  const watcher2 = fsWatch(LAYOUTS_DIR, { recursive: true });
297
299
  const watcher3 = fsWatch(PUBLIC_DIR, { recursive: true });
298
300
 
299
301
  const watchers = [watcher1, watcher2, watcher3];
300
302
 
303
+ let isBuilding = false;
301
304
  let debounceTimer: ReturnType<typeof setTimeout> | undefined;
302
305
  const rebuild = () => {
303
306
  clearTimeout(debounceTimer);
304
307
  debounceTimer = setTimeout(async () => {
308
+ if (isBuilding) return;
309
+ isBuilding = true;
305
310
  console.log("Rebuilding...");
306
- await build(false);
311
+ try {
312
+ await build(false);
313
+ } finally {
314
+ isBuilding = false;
315
+ }
307
316
  }, 100);
308
317
  };
309
318