Skip to content

Commit 5947532

Browse files
committed
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
1 parent f0309ed commit 5947532

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

commitlint.config.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ module.exports = {
1717
'build', // Build system → no release
1818
'revert' // Revert commit → PATCH
1919
]],
20-
// Subject must be lowercase
21-
'subject-case': [2, 'always', 'lower-case'],
20+
// Subject case - disabled to allow capital letters
21+
'subject-case': [0],
2222
// Max header length (type + scope + subject)
2323
'header-max-length': [2, 'always', 100]
2424
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"build:watch": "tsc --watch",
5555
"build:server": "tsc && node scripts/add-shebang.js",
5656
"build:all": "bun run ui:build && bun run build:server",
57-
"prebuild": "rm -rf dist tsconfig.tsbuildinfo",
57+
"prebuild": "node scripts/clean-dist.js",
5858
"prebuild:all": "rm -rf dist tsconfig.tsbuildinfo",
5959
"postbuild:all": "node scripts/verify-bundle.js",
6060
"typecheck": "tsc --noEmit",

scripts/clean-dist.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Clean dist directory while preserving UI bundle
5+
* The UI bundle is built separately and should not be deleted during regular builds
6+
*/
7+
8+
const fs = require('fs');
9+
const path = require('path');
10+
11+
const DIST_DIR = path.join(__dirname, '../dist');
12+
const TSCONFIG_BUILDINFO = path.join(__dirname, '../tsconfig.tsbuildinfo');
13+
14+
// Directories to preserve (from UI build)
15+
const PRESERVE = new Set(['ui']);
16+
17+
function cleanDist() {
18+
// Remove tsconfig.tsbuildinfo
19+
if (fs.existsSync(TSCONFIG_BUILDINFO)) {
20+
fs.unlinkSync(TSCONFIG_BUILDINFO);
21+
}
22+
23+
// If dist doesn't exist, nothing to clean
24+
if (!fs.existsSync(DIST_DIR)) {
25+
return;
26+
}
27+
28+
const entries = fs.readdirSync(DIST_DIR, { withFileTypes: true });
29+
30+
for (const entry of entries) {
31+
// Skip preserved directories
32+
if (PRESERVE.has(entry.name)) {
33+
continue;
34+
}
35+
36+
const fullPath = path.join(DIST_DIR, entry.name);
37+
38+
if (entry.isDirectory()) {
39+
fs.rmSync(fullPath, { recursive: true, force: true });
40+
} else {
41+
fs.unlinkSync(fullPath);
42+
}
43+
}
44+
}
45+
46+
cleanDist();

0 commit comments

Comments
 (0)