@timeax/scaffold 0.0.11 → 0.0.13

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/cli.mjs CHANGED
@@ -1330,7 +1330,7 @@ function watchScaffold(cwd, options = {}) {
1330
1330
  // we already resolved scaffoldDir for watcher; pass it down
1331
1331
  scaffoldDir
1332
1332
  });
1333
- logger6.info("Scaffold run completed.");
1333
+ logger6.info("Scaffold run completed");
1334
1334
  } catch (err) {
1335
1335
  logger6.error("Scaffold run failed:", err);
1336
1336
  } finally {
@@ -1345,27 +1345,21 @@ function watchScaffold(cwd, options = {}) {
1345
1345
  if (timer) clearTimeout(timer);
1346
1346
  timer = setTimeout(run, debounceMs);
1347
1347
  }
1348
- const watcher = chokidar.watch(
1349
- [
1350
- // config files (ts/js/etc.)
1351
- path2.join(scaffoldDir, "config.*"),
1352
- // structure files: plain txt + our custom extensions
1353
- path2.join(scaffoldDir, "*.txt"),
1354
- path2.join(scaffoldDir, "*.tss"),
1355
- path2.join(scaffoldDir, "*.stx")
1356
- ],
1357
- {
1358
- ignoreInitial: false
1359
- }
1360
- );
1361
- watcher.on("add", (filePath) => {
1362
- logger6.debug(`File added: ${filePath}`);
1363
- scheduleRun();
1364
- }).on("change", (filePath) => {
1365
- logger6.debug(`File changed: ${filePath}`);
1366
- scheduleRun();
1367
- }).on("unlink", (filePath) => {
1368
- logger6.debug(`File removed: ${filePath}`);
1348
+ function isInteresting(filePath) {
1349
+ const rel = path2.relative(scaffoldDir, filePath);
1350
+ if (rel.startsWith("..")) return false;
1351
+ const base = path2.basename(filePath).toLowerCase();
1352
+ if (base.startsWith("config.")) return true;
1353
+ const ext = path2.extname(base);
1354
+ return ext === ".txt" || ext === ".tss" || ext === ".stx";
1355
+ }
1356
+ const watcher = chokidar.watch(scaffoldDir, {
1357
+ ignoreInitial: false,
1358
+ persistent: true
1359
+ });
1360
+ watcher.on("all", (event, filePath) => {
1361
+ if (!isInteresting(filePath)) return;
1362
+ logger6.debug(`Event ${event} on ${filePath}`);
1369
1363
  scheduleRun();
1370
1364
  }).on("error", (error) => {
1371
1365
  logger6.error("Watcher error:", error);