@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.
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "files.exclude": {
3
- "dist": true,
4
3
  ".vscode": true,
5
4
  "node_modules": true,
6
5
  ".gitattributes": true,
package/dist/cli.cjs CHANGED
@@ -1341,7 +1341,7 @@ function watchScaffold(cwd, options = {}) {
1341
1341
  // we already resolved scaffoldDir for watcher; pass it down
1342
1342
  scaffoldDir
1343
1343
  });
1344
- logger6.info("Scaffold run completed.");
1344
+ logger6.info("Scaffold run completed");
1345
1345
  } catch (err) {
1346
1346
  logger6.error("Scaffold run failed:", err);
1347
1347
  } finally {
@@ -1356,27 +1356,21 @@ function watchScaffold(cwd, options = {}) {
1356
1356
  if (timer) clearTimeout(timer);
1357
1357
  timer = setTimeout(run, debounceMs);
1358
1358
  }
1359
- const watcher = chokidar__default.default.watch(
1360
- [
1361
- // config files (ts/js/etc.)
1362
- path2__default.default.join(scaffoldDir, "config.*"),
1363
- // structure files: plain txt + our custom extensions
1364
- path2__default.default.join(scaffoldDir, "*.txt"),
1365
- path2__default.default.join(scaffoldDir, "*.tss"),
1366
- path2__default.default.join(scaffoldDir, "*.stx")
1367
- ],
1368
- {
1369
- ignoreInitial: false
1370
- }
1371
- );
1372
- watcher.on("add", (filePath) => {
1373
- logger6.debug(`File added: ${filePath}`);
1374
- scheduleRun();
1375
- }).on("change", (filePath) => {
1376
- logger6.debug(`File changed: ${filePath}`);
1377
- scheduleRun();
1378
- }).on("unlink", (filePath) => {
1379
- logger6.debug(`File removed: ${filePath}`);
1359
+ function isInteresting(filePath) {
1360
+ const rel = path2__default.default.relative(scaffoldDir, filePath);
1361
+ if (rel.startsWith("..")) return false;
1362
+ const base = path2__default.default.basename(filePath).toLowerCase();
1363
+ if (base.startsWith("config.")) return true;
1364
+ const ext = path2__default.default.extname(base);
1365
+ return ext === ".txt" || ext === ".tss" || ext === ".stx";
1366
+ }
1367
+ const watcher = chokidar__default.default.watch(scaffoldDir, {
1368
+ ignoreInitial: false,
1369
+ persistent: true
1370
+ });
1371
+ watcher.on("all", (event, filePath) => {
1372
+ if (!isInteresting(filePath)) return;
1373
+ logger6.debug(`Event ${event} on ${filePath}`);
1380
1374
  scheduleRun();
1381
1375
  }).on("error", (error) => {
1382
1376
  logger6.error("Watcher error:", error);