@techninja/clearstack 0.4.9 → 0.4.11

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.
@@ -44,6 +44,7 @@ export function loadConfig(projectDir) {
44
44
  docsExt: (env.SPEC_DOCS_EXTENSIONS || '.md').split(','),
45
45
  testPattern: env.SPEC_TEST_PATTERN || '.test.js',
46
46
  ignore: (env.SPEC_IGNORE_DIRS || 'node_modules,src/vendor,.git,.configs').split(','),
47
+ watchDirs: env.SPEC_WATCH_DIRS ? env.SPEC_WATCH_DIRS.split(',').map((d) => d.trim()) : null,
47
48
  };
48
49
  }
49
50
 
@@ -56,7 +56,13 @@ export function runKeys(specRows, keys, ctx) {
56
56
  * @param {{ fast: ReturnType<typeof setTimeout>|null, slow: ReturnType<typeof setTimeout>|null }} timers
57
57
  * @param {(keys: Set<string>) => void} run
58
58
  */
59
+ let fixing = false;
60
+
61
+ /**
62
+ *
63
+ */
59
64
  export function schedule(specRows, ctx, pending, timers, run, checksForExt, ext) {
65
+ if (fixing) return;
60
66
  for (const k of checksForExt(ext)) {
61
67
  const row = specRows.find((r) => r.key === k);
62
68
  if (row) row.pass = null;
@@ -85,6 +91,7 @@ export function setupFix(specRows, cmds, ctx, pending, timers, run) {
85
91
  pending.slow.add(row.key);
86
92
  }
87
93
  render(ctx.rows, ctx.lastCheck.value, ctx.watchDirs, ctx.currentViolations.value);
94
+ fixing = true;
88
95
  for (const row of fixable) {
89
96
  try {
90
97
  if (row.fix) row.fix();
@@ -93,6 +100,6 @@ export function setupFix(specRows, cmds, ctx, pending, timers, run) {
93
100
  }
94
101
  clearTimeout(timers.fast);
95
102
  clearTimeout(timers.slow);
96
- timers.slow = setTimeout(() => { const keys = new Set(pending.slow); pending.slow.clear(); run(keys); }, 2000);
103
+ timers.slow = setTimeout(() => { fixing = false; const keys = new Set(pending.slow); pending.slow.clear(); run(keys); }, 2000);
97
104
  });
98
105
  }
package/lib/watch.js CHANGED
@@ -28,7 +28,7 @@ export async function startWatch(projectDir) {
28
28
  const specRows = checks.map(toRow);
29
29
  const checksForExt = makeExtMap(checks);
30
30
 
31
- const watchDirs = ['src', 'scripts', 'docs'].filter((d) => existsSync(resolve(projectDir, d)));
31
+ const watchDirs = (cfg.watchDirs ?? ['src', 'scripts', 'docs']).filter((d) => existsSync(resolve(projectDir, d)));
32
32
 
33
33
  const serverCmd = detectServerCmd(projectDir, cfg);
34
34
  const serverRow = serverCmd
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techninja/clearstack",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "type": "module",
5
5
  "description": "A no-build web component framework specification — scaffold, validate, and evolve spec-compliant projects",
6
6
  "bin": {