-
Notifications
You must be signed in to change notification settings - Fork 37
/
out.js
22 lines (18 loc) · 644 Bytes
/
out.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// create out directory for static Chrome Extension
const fs = require('fs');
const glob = require('glob');
const files = glob.sync('out/**/*.html');
files.forEach((file) => {
const content = fs.readFileSync(file, 'utf-8');
const modifiedContent = content.replace(/\/_next/g, './next');
fs.writeFileSync(file, modifiedContent, 'utf-8');
});
const sourcePath = 'out/_next';
const destinationPath = 'out/next';
fs.rename(sourcePath, destinationPath, (err) => {
if (err) {
console.error('Failed to rename "_next" directory to "next".', err);
} else {
console.log('Renamed "_next" directory to "next" successfully.');
}
});