-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_quotes.js
More file actions
23 lines (23 loc) · 804 Bytes
/
Copy pathfix_quotes.js
File metadata and controls
23 lines (23 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const fs = require('fs');
const path = require('path');
function walk(dir) {
let results = [];
fs.readdirSync(dir).forEach(file => {
file = path.join(dir, file);
if (fs.statSync(file).isDirectory()) results = results.concat(walk(file));
else if (file.endsWith('.jsx')) results.push(file);
});
return results;
}
const files = walk('e:/new_project_main/frontend/src');
files.forEach(file => {
let content = fs.readFileSync(file, 'utf8');
const lines = content.split('\n');
for (let i=0; i<lines.length; i++) {
if (lines[i].includes('import.meta.env.VITE_API_URL')) {
lines[i] = lines[i].replace("')", "` )").replace("', ", "` , ");
}
}
fs.writeFileSync(file, lines.join('\n'));
});
console.log('Fixed syntax errors');