Assemble Odin runtime organs
This commit is contained in:
parent
ecd1480fe1
commit
7c01732598
14 changed files with 1476 additions and 1143 deletions
34
scripts/check-syntax.cjs
Normal file
34
scripts/check-syntax.cjs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { spawnSync } = require("child_process");
|
||||
|
||||
const repoRoot = path.resolve(__dirname, "..");
|
||||
const files = [];
|
||||
|
||||
collect(path.join(repoRoot, "src"));
|
||||
|
||||
for (const file of files) {
|
||||
const result = spawnSync(process.execPath, ["--check", file], {
|
||||
cwd: repoRoot,
|
||||
encoding: "utf8",
|
||||
});
|
||||
if (result.stdout) process.stdout.write(result.stdout);
|
||||
if (result.stderr) process.stderr.write(result.stderr);
|
||||
if (result.status !== 0) process.exit(result.status);
|
||||
}
|
||||
|
||||
console.log(`Checked ${files.length} CommonJS files.`);
|
||||
|
||||
function collect(directory) {
|
||||
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
||||
const fullPath = path.join(directory, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
collect(fullPath);
|
||||
} else if (entry.isFile() && entry.name.endsWith(".cjs")) {
|
||||
files.push(fullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue