feat(build): disable commitlint subject-case rule and add clean-dist script

- Disable subject-case rule in commitlint to allow capital letters in commit subjects
- Add clean-dist.js script to preserve UI bundle during TypeScript builds
- Update package.json prebuild script to use new clean-dist.js
This commit is contained in:
kaitranntt
2025-12-07 23:33:03 -05:00
parent f0309ed8db
commit 5947532fc6
3 changed files with 49 additions and 3 deletions
+2 -2
View File
@@ -17,8 +17,8 @@ module.exports = {
'build', // Build system → no release
'revert' // Revert commit → PATCH
]],
// Subject must be lowercase
'subject-case': [2, 'always', 'lower-case'],
// Subject case - disabled to allow capital letters
'subject-case': [0],
// Max header length (type + scope + subject)
'header-max-length': [2, 'always', 100]
}
+1 -1
View File
@@ -54,7 +54,7 @@
"build:watch": "tsc --watch",
"build:server": "tsc && node scripts/add-shebang.js",
"build:all": "bun run ui:build && bun run build:server",
"prebuild": "rm -rf dist tsconfig.tsbuildinfo",
"prebuild": "node scripts/clean-dist.js",
"prebuild:all": "rm -rf dist tsconfig.tsbuildinfo",
"postbuild:all": "node scripts/verify-bundle.js",
"typecheck": "tsc --noEmit",
+46
View File
@@ -0,0 +1,46 @@
#!/usr/bin/env node
/**
* Clean dist directory while preserving UI bundle
* The UI bundle is built separately and should not be deleted during regular builds
*/
const fs = require('fs');
const path = require('path');
const DIST_DIR = path.join(__dirname, '../dist');
const TSCONFIG_BUILDINFO = path.join(__dirname, '../tsconfig.tsbuildinfo');
// Directories to preserve (from UI build)
const PRESERVE = new Set(['ui']);
function cleanDist() {
// Remove tsconfig.tsbuildinfo
if (fs.existsSync(TSCONFIG_BUILDINFO)) {
fs.unlinkSync(TSCONFIG_BUILDINFO);
}
// If dist doesn't exist, nothing to clean
if (!fs.existsSync(DIST_DIR)) {
return;
}
const entries = fs.readdirSync(DIST_DIR, { withFileTypes: true });
for (const entry of entries) {
// Skip preserved directories
if (PRESERVE.has(entry.name)) {
continue;
}
const fullPath = path.join(DIST_DIR, entry.name);
if (entry.isDirectory()) {
fs.rmSync(fullPath, { recursive: true, force: true });
} else {
fs.unlinkSync(fullPath);
}
}
}
cleanDist();