fix: add dist-check guard + List<T> type parsing + state machine examples
Some checks failed
Deploy Landing Page to Storj / deploy (push) Failing after 2s

- check-dist.sh: Prevents DIST DESYNC by verifying all dist/*.js files
  are newer than their src/*.ts sources. Fails build if stale.
- Makefile: Standard build targets (build/check-dist/test/recompile/clean)
- src/index.ts: Integrated dist freshness check before compilation
- src/parser.ts: Added List<T> type parsing alongside existing Set<T>/Map<K,V>
  (e.g., 'log: List<LogEntry>' now parses as { type: 'list', elementType })
- examples/: Restored v0.3 state machine specs (TigerBeetleLedger,
  AccountLedger, ToggleSwitch, TwoPhaseCommit)
- DIST DESYNC is a known recurring anti-pattern — this guard prevents it

Tests: 39/41 pass (2 pre-existing E2E WASM failures due to missing wabt)
This commit is contained in:
Scott Scoble 2026-05-05 03:11:53 -07:00
parent 7230650628
commit a2f7b7b2e9
16 changed files with 408 additions and 9 deletions

View file

@ -8,7 +8,20 @@ import { generateSPDX } from './generators/spdx.js';
import { generateTypeScriptStateMachine } from './generators/typescript-state-machine.js';
import { generateWASM } from './generators/wasm.js';
import fs from 'fs';
import path from 'path';
async function main() {
// Guard: check that dist is not stale before compiling
const checkScript = path.join(path.dirname(new URL(import.meta.url).pathname), '..', 'check-dist.sh');
if (fs.existsSync(checkScript)) {
try {
const { execSync } = await import('child_process');
execSync(`bash "${checkScript}"`, { stdio: 'inherit' });
}
catch {
console.error('\n❌ Cannot compile with stale dist. Rebuild first.');
process.exit(1);
}
}
const argv = await yargs(hideBin(process.argv))
.command('$0 <file>', 'Compile a SpeckDL specification', (yargsCmd) => {
return yargsCmd