x
This commit is contained in:
1 parent
3c4bb06003
commit
f7aa4d099f
36 files changed
+528
-180
No files matched your search
@@ -0,0 +1,23 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
function walkDir(dir, callback) {
|
||||
fs.readdirSync(dir).forEach(f => {
|
||||
let dirPath = path.join(dir, f);
|
||||
let isDirectory = fs.statSync(dirPath).isDirectory();
|
||||
isDirectory ? walkDir(dirPath, callback) : callback(dirPath);
|
||||
});
|
||||
}
|
||||
|
||||
walkDir('apps/website/src/app/[lang]', (filePath) => {
|
||||
if (filePath.endsWith('.tsx') || filePath.endsWith('.ts')) {
|
||||
let content = fs.readFileSync(filePath, 'utf8');
|
||||
|
||||
const newContent = content.replace(/import Link from 'next\/link'/g, "import Link from '@/components/LocalizedLink'");
|
||||
|
||||
if (newContent !== content) {
|
||||
fs.writeFileSync(filePath, newContent, 'utf8');
|
||||
console.log('Fixed link in', filePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user