-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix-selectors.js
More file actions
40 lines (30 loc) · 1.07 KB
/
fix-selectors.js
File metadata and controls
40 lines (30 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const fs = require('fs');
const path = require('path');
function findTsFiles(dir, fileList = []) {
const files = fs.readdirSync(dir);
files.forEach(file => {
const filePath = path.join(dir, file);
const stat = fs.statSync(filePath);
if (stat.isDirectory()) {
findTsFiles(filePath, fileList);
} else if (file.endsWith('.ts')) {
fileList.push(filePath);
}
});
return fileList;
}
const tsFiles = findTsFiles('./projects/lib/src/lib');
tsFiles.forEach(filePath => {
let content = fs.readFileSync(filePath, 'utf8');
const originalContent = content;
// Replace lib- prefix in selectors
content = content.replace(/selector:\s*'lib-([^']+)'/g, "selector: '$1'");
// Also update any template references to lib- components
content = content.replace(/<lib-([^>\s]+)/g, "<$1");
content = content.replace(/<\/lib-([^>]+)>/g, "</$1>");
if (content !== originalContent) {
fs.writeFileSync(filePath, content);
console.log(`Updated: ${filePath}`);
}
});
console.log('✅ All lib- prefixes removed from component selectors');