mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-07-21 18:33:22 -07:00
v1.6.1
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const CHAR_LIMIT = 11000;
|
||||
const srcDir = path.join(__dirname, '..', 'src');
|
||||
|
||||
const files = fs.readdirSync(srcDir)
|
||||
.filter(f => f.startsWith('plan2code-') && f.endsWith('.md'))
|
||||
.sort();
|
||||
|
||||
const failures = [];
|
||||
|
||||
for (const file of files) {
|
||||
const filePath = path.join(srcDir, file);
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
const charCount = content.length;
|
||||
if (charCount > CHAR_LIMIT) {
|
||||
failures.push({ file: path.join('src', file), charCount });
|
||||
}
|
||||
}
|
||||
|
||||
if (failures.length > 0) {
|
||||
console.error('Character limit exceeded:');
|
||||
console.error('');
|
||||
for (const { file, charCount } of failures) {
|
||||
console.error(` ${file}: ${charCount} / ${CHAR_LIMIT} (+${charCount - CHAR_LIMIT} over)`);
|
||||
}
|
||||
console.error('');
|
||||
console.error(`${failures.length} file(s) over the ${CHAR_LIMIT} character limit.`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`All ${files.length} files under ${CHAR_LIMIT} characters \u2713`);
|
||||
process.exit(0);
|
||||
Reference in New Issue
Block a user