From 5f93e28d758428dff9c30f48fa06e85462ec0f5e Mon Sep 17 00:00:00 2001 From: AkaraChen Date: Mon, 21 Oct 2024 09:45:52 +0800 Subject: [PATCH] fix: gen-icon script phantom deps --- .../components/base/icons/{script.js => script.mjs} | 11 ++++++----- web/package.json | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) rename web/app/components/base/icons/{script.js => script.mjs} (94%) diff --git a/web/app/components/base/icons/script.js b/web/app/components/base/icons/script.mjs similarity index 94% rename from web/app/components/base/icons/script.js rename to web/app/components/base/icons/script.mjs index 0ff6a2a483..1952a15251 100644 --- a/web/app/components/base/icons/script.js +++ b/web/app/components/base/icons/script.mjs @@ -1,8 +1,9 @@ -const path = require('node:path') -const { open, readdir, access, mkdir, writeFile, appendFile, rm } = require('node:fs/promises') -const { parseXml } = require('@rgrove/parse-xml') -const camelCase = require('lodash/camelCase') -const template = require('lodash/template') +import path from 'node:path' +import { access, appendFile, mkdir, open, readdir, rm, writeFile } from 'node:fs/promises' +import { parseXml } from '@rgrove/parse-xml' +import { camelCase, template } from 'lodash-es' + +const __dirname = path.dirname(new URL(import.meta.url).pathname) const generateDir = async (currentPath) => { try { diff --git a/web/package.json b/web/package.json index b8b57e42a4..5e42a7c670 100644 --- a/web/package.json +++ b/web/package.json @@ -13,7 +13,7 @@ "fix": "next lint --fix", "eslint-fix": "eslint --fix", "prepare": "cd ../ && node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || husky install ./web/.husky", - "gen-icons": "node ./app/components/base/icons/script.js", + "gen-icons": "node ./app/components/base/icons/script.mjs", "uglify-embed": "node ./bin/uglify-embed", "check-i18n": "node ./i18n/check-i18n.js", "auto-gen-i18n": "node ./i18n/auto-gen-i18n.js",