-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix-paths.js
More file actions
29 lines (26 loc) · 1 KB
/
Copy pathfix-paths.js
File metadata and controls
29 lines (26 loc) · 1 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
const fs = require('fs');
const fixImports = (dir) => {
fs.readdirSync(dir).forEach(file => {
const fullPath = dir + '/' + file;
if (fs.statSync(fullPath).isDirectory()) {
fixImports(fullPath);
} else if (fullPath.endsWith('.tsx')) {
let content = fs.readFileSync(fullPath, 'utf8');
content = content.replace(/from '\.\.\/\.\.\/store\/useThemeStore'/g, "from '../store/useThemeStore'");
fs.writeFileSync(fullPath, content);
}
});
};
// Fix components
const fixComponentImports = (dir) => {
fs.readdirSync(dir).forEach(file => {
const fullPath = dir + '/' + file;
if (fullPath.endsWith('.tsx')) {
let content = fs.readFileSync(fullPath, 'utf8');
content = content.replace(/from '\.\.\/\.\.\/store\/useThemeStore'/g, "from '../store/useThemeStore'");
fs.writeFileSync(fullPath, content);
}
});
};
fixImports('./src/screens');
fixComponentImports('./src/components');