You've already forked Atomcms-edit
Fix DEP0169 url.parse() deprecation warning by patching tailwindcss dependencies
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
"check": "yarn lint:all && yarn format:check",
|
"check": "yarn lint:all && yarn format:check",
|
||||||
"check:php": "php -l app/ && php -l routes/ && php -l database/ && php -l resources/",
|
"check:php": "php -l app/ && php -l routes/ && php -l database/ && php -l resources/",
|
||||||
"check:security": "composer audit && npm audit",
|
"check:security": "composer audit && npm audit",
|
||||||
|
"postinstall": "node scripts/patch-url-parse.mjs",
|
||||||
"check:deps": "npm outdated --long --json || true",
|
"check:deps": "npm outdated --long --json || true",
|
||||||
"clean": "rm -rf .vite-cache node_modules/.vite",
|
"clean": "rm -rf .vite-cache node_modules/.vite",
|
||||||
"rebuild": "yarn clean && yarn install && yarn build"
|
"rebuild": "yarn clean && yarn install && yarn build"
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
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}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user