mirror of
https://github.com/PR0M3TH3AN/bitgate.git
synced 2026-10-27 08:31:00 +00:00
feat: bootstrap workspace with CI, typecheck, and import guardrails
This commit is contained in:
1 parent
34152e3577
commit
81998396b9
19 files changed
+972
No files matched your search
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const FORBIDDEN_PATHS = [
|
||||
'/home/user/Documents/GitHub/bitvid',
|
||||
'/home/user/Documents/GitHub/bitroad'
|
||||
];
|
||||
|
||||
async function checkImports(rootPath) {
|
||||
const pkgPath = join(rootPath, 'package.json');
|
||||
const pkg = JSON.parse(await readFile(pkgPath, 'utf-8'));
|
||||
|
||||
const violations = [];
|
||||
|
||||
for (const workspace of pkg.workspaces || []) {
|
||||
const workspacePath = join(rootPath, workspace);
|
||||
const workspacePkgPath = join(workspacePath, 'package.json');
|
||||
const workspacePkg = JSON.parse(await readFile(workspacePkgPath, 'utf-8'));
|
||||
|
||||
for (const dep of Object.keys(workspacePkg.dependencies || {})) {
|
||||
if (FORBIDDEN_PATHS.some(path => dep.startsWith(path))) {
|
||||
violations.push(`Workspace ${workspace} depends on forbidden path: ${dep}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (violations.length > 0) {
|
||||
console.error('\nReference import violations detected:');
|
||||
violations.forEach(v => console.error(`- ${v}`));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log('✓ No forbidden imports detected');
|
||||
}
|
||||
|
||||
checkImports(fileURLToPath(new URL('.', import.meta.url))).catch(err => {
|
||||
console.error('Check failed:', err);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in new issue
Block a user