mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-08 08:39:58 -04:00
413c8cbf3c
# Description of Changes This PR: - standardizes the prettier config across all TypeScript projects - adds a root level package.json - standardizes all `pnpm` commands to be the same - updates documentation accordingly - adds some additional typescript testing for serialization and deserialization **IMPORTANT!** Once this PR merges we will need to change the `compile-and-test` required check to `build-and-test` # API and ABI breaking changes No breaking changes. # Expected complexity level and risk 2 - It in principle doesn't change any code, but could affect deploy processes. # Testing - [x] Just the automated testing that we had previously - [x] I added additional automated tests --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
const navPath = '../docs/nav.mjs';
|
|
|
|
const mdListPath = process.argv[2];
|
|
if (!mdListPath) {
|
|
console.error('Usage: node checkNav.mjs <md-list-file>');
|
|
process.exit(1);
|
|
}
|
|
|
|
const navFile = path.resolve(__dirname, navPath);
|
|
const nav = await import(pathToFileURL(navFile).href).then(mod => mod.default);
|
|
|
|
const extractPathsFromNav = items =>
|
|
items.filter(item => item.type === 'page').map(page => page.path);
|
|
|
|
const navPaths = extractPathsFromNav(nav.items);
|
|
const navPathSet = new Set(navPaths);
|
|
|
|
const expectedMdPaths = fs
|
|
.readFileSync(path.resolve(__dirname, mdListPath), 'utf8')
|
|
.split('\n')
|
|
.map(line => line.trim())
|
|
.filter(Boolean);
|
|
const expectedPathSet = new Set(expectedMdPaths);
|
|
|
|
const missingInNav = expectedMdPaths.filter(p => !navPathSet.has(p));
|
|
const extraInNav = navPaths.filter(p => !expectedPathSet.has(p));
|
|
|
|
let failed = false;
|
|
|
|
if (missingInNav.length > 0) {
|
|
console.error('❌ These docs are missing from nav:');
|
|
missingInNav.forEach(p => console.error(`- ${p}`));
|
|
failed = true;
|
|
}
|
|
|
|
if (extraInNav.length > 0) {
|
|
console.error('❌ These docs are listed in nav but not found under docs/:');
|
|
extraInNav.forEach(p => console.error(`- ${p}`));
|
|
failed = true;
|
|
}
|
|
|
|
if (!failed) {
|
|
console.log('✅ nav list matches filesystem.');
|
|
} else {
|
|
process.exit(1);
|
|
}
|