Viewing is open to everyone. Downloading and starring need a GitHub sign-in.
Sign in with GitHub
check.mjs
v0.1.0-build.85
Latest
Commit ede38f5
Sign in with GitHub to download. Each download is recorded with your GitHub username.
| 1 | // `node --check` every JavaScript file of the SDK (and, with --dist, require |
| 2 | // that dist/ is assembled, so `npm pack` never ships an unbuilt package). |
| 3 | import { execFileSync } from 'node:child_process'; |
| 4 | import { existsSync, readdirSync } from 'node:fs'; |
| 5 | import { dirname, join, resolve } from 'node:path'; |
| 6 | import { fileURLToPath } from 'node:url'; |
| 7 | |
| 8 | const root = resolve(dirname(fileURLToPath(import.meta.url)), '..'); |
| 9 | const files = []; |
| 10 | for (const dir of ['js', 'scripts', 'test', 'dist']) { |
| 11 | const d = join(root, dir); |
| 12 | if (!existsSync(d)) continue; |
| 13 | for (const f of readdirSync(d)) if (/\.(mjs|js)$/.test(f)) files.push(join(d, f)); |
| 14 | } |
| 15 | for (const f of files) execFileSync(process.execPath, ['--check', f], { stdio: 'inherit' }); |
| 16 | console.log(`node --check: ${files.length} files OK`); |
| 17 | if (process.argv.includes('--dist')) { |
| 18 | for (const f of ['ckey.mjs', 'ckey-core.mjs', 'ckey.wasm', 'ckey.d.ts']) { |
| 19 | if (!existsSync(join(root, 'dist', f))) { |
| 20 | console.error(`dist/${f} is missing: run npm run build first`); |
| 21 | process.exit(1); |
| 22 | } |
| 23 | } |
| 24 | } |