Lines 1-62javascript
2 * validate-form.mjs - Quality Gate for XrmForge Form Scripts
4 * Runs three checks in one command:
5 * 1. TypeScript Compiler (tsc --noEmit)
6 * 2. ESLint (src/ --max-warnings=0)
7 * 3. Pattern Compliance (critical rule violations via text search)
9 * Exit code: 0 = all green, 1 = errors found
12 * node scripts/validate-form.mjs
16import { execSync } from 'node:child_process';
17import { readdirSync, readFileSync } from 'node:fs';
HighChild Process
Package source references child process execution.
dist/templates/validate-form.mjsView on unpkg · L15 18import { join, relative } from 'node:path';
20const RED = '\x1b[31m';
21const GREEN = '\x1b[32m';
22const YELLOW = '\x1b[33m';
25// Error-handling wrappers an exported entry point may use (Check 3l). Single
26// source of truth - keep in sync with src/shared/error-handler.ts. wrapGridCommand
27// (subgrid ribbon commands, F-MK9-02), wrapWebResource (HTML WebResource init,
28// Runde 10 F-LMA10-02) and wrapEnableRule (ribbon Enable Rules, sync boolean) are
29// NOT substrings of wrapCommand, so they must be listed explicitly or the gate
30// false-flags correct code (FW-3 / F-LMA10-02).
31const HANDLER_WRAPPERS = ['wrapHandler', 'wrapCommand', 'wrapGridCommand', 'wrapWebResource', 'wrapEnableRule'];
35// ============================================================
36// 1. TypeScript Compiler
37// ============================================================
39console.log('=== XrmForge Quality Gate ===\n');
40console.log('--- TypeScript ---');
43 execSync('npx tsc --noEmit', { stdio: 'pipe', encoding: 'utf-8' });
44 console.log(`${GREEN}OK${NC} tsc --noEmit`);
HighRuntime Package Install
Package source invokes a package manager install command at runtime.
dist/templates/validate-form.mjsView on unpkg · L42 46 const output = (err.stdout || '') + (err.stderr || '');
47 const errorCount = (output.match(/error TS/g) || []).length;
48 console.log(`${RED}FAIL${NC} tsc --noEmit (${errorCount} errors)`);
49 console.log(output.split('\n').slice(0, 20).join('\n'));
50 totalErrors += errorCount || 1;
53// ============================================================
55// ============================================================
57console.log('\n--- ESLint ---');
60 execSync('npx eslint src/ --max-warnings=0', { stdio: 'pipe', encoding: 'utf-8' });
61 console.log(`${GREEN}OK${NC} eslint src/ --max-warnings=0`);