You've already forked Atomcms-edit
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
|
|
let files = [
|
|
'node_modules/blade-formatter/node_modules/tailwindcss/src/lib/setupContextUtils.js',
|
|
'node_modules/@shufo/tailwindcss-class-sorter/node_modules/tailwindcss/src/lib/setupContextUtils.js',
|
|
];
|
|
|
|
for (let file of files) {
|
|
if (!existsSync(file)) {
|
|
console.log(` Skipped (not found): ${file}`);
|
|
continue;
|
|
}
|
|
let content = readFileSync(file, 'utf8');
|
|
let original = content;
|
|
|
|
content = content.replace("import url from 'url'\n", '');
|
|
content = content.replace(
|
|
` let parsed = url.parse(file)
|
|
let pathname = parsed.hash ? parsed.href.replace(parsed.hash, '') : parsed.href
|
|
pathname = parsed.search ? pathname.replace(parsed.search, '') : pathname`,
|
|
` let pathname = file.includes('#') ? file.split('#')[0] : file
|
|
pathname = pathname.includes('?') ? pathname.split('?')[0] : pathname`
|
|
);
|
|
|
|
if (content !== original) {
|
|
writeFileSync(file, content, 'utf8');
|
|
console.log(` Patched: ${file}`);
|
|
} else {
|
|
console.log(` No changes needed: ${file}`);
|
|
}
|
|
}
|