From 820f724d5bec14951cbe81d7c6984451de66d93b Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Wed, 7 Sep 2022 21:53:26 +0800 Subject: [PATCH] chore: use pnpm `shell-emulator` instead of `cross-env` --- .husky/lintstagedrc.js | 2 +- .npmrc | 3 +++ package.json | 11 +++++------ pnpm-lock.yaml | 19 +++---------------- 4 files changed, 12 insertions(+), 23 deletions(-) create mode 100644 .npmrc diff --git a/.husky/lintstagedrc.js b/.husky/lintstagedrc.js index 6b03351..a9b439c 100644 --- a/.husky/lintstagedrc.js +++ b/.husky/lintstagedrc.js @@ -1,6 +1,6 @@ module.exports = { "*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"], - "{!(package)*.json,.!(browserslist)*rc}": ["prettier --write--parser json"], + "{!(package)*.json}": ["prettier --write--parser json"], "package.json": ["prettier --write"], "*.vue": ["eslint --fix", "prettier --write", "stylelint --fix"], "*.{vue,css,scss,postcss,less}": ["stylelint --fix", "prettier --write"], diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..0154bc0 --- /dev/null +++ b/.npmrc @@ -0,0 +1,3 @@ +shamefully-hoist=true +strict-peer-dependencies=false +shell-emulator=true \ No newline at end of file diff --git a/package.json b/package.json index ff83a87..61a0b9c 100644 --- a/package.json +++ b/package.json @@ -3,15 +3,15 @@ "version": "3.4.6", "private": true, "scripts": { - "dev": "cross-env --max_old_space_size=4096 vite", + "dev": "NODE_OPTIONS=--max-old-space-size=4096 vite", "serve": "pnpm dev", - "build": "rimraf dist && cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build", - "build:staging": "rimraf dist && cross-env vite build --mode staging", - "report": "rimraf dist && cross-env vite build", + "build": "rimraf dist && NODE_OPTIONS=--max-old-space-size=8192 vite build", + "build:staging": "rimraf dist && vite build --mode staging", + "report": "rimraf dist && vite build", "preview": "vite preview", "preview:build": "pnpm build && vite preview", "typecheck": "tsc --noEmit && vue-tsc --noEmit --skipLibCheck", - "cloc": "cross-env --max_old_space_size=4096 cloc . --exclude-dir=node_modules --exclude-lang=YAML", + "cloc": "NODE_OPTIONS=--max-old-space-size=4096 cloc . --exclude-dir=node_modules --exclude-lang=YAML", "clean:cache": "rm -rf node_modules && rm -rf .eslintcache && pnpm install", "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix", "lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"", @@ -88,7 +88,6 @@ "@vue/runtime-core": "^3.2.38", "autoprefixer": "^10.4.8", "cloc": "^2.10.0", - "cross-env": "7.0.3", "eslint": "^8.8.0", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-vue": "^8.4.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7adaae3..bb466ee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -37,7 +37,6 @@ specifiers: autoprefixer: ^10.4.8 axios: ^0.27.2 cloc: ^2.10.0 - cross-env: 7.0.3 dayjs: ^1.11.4 echarts: ^5.3.3 element-plus: ^2.2.16 @@ -155,7 +154,6 @@ devDependencies: "@vue/runtime-core": 3.2.38 autoprefixer: 10.4.8_postcss@8.4.16 cloc: 2.10.0 - cross-env: 7.0.3 eslint: 8.23.0 eslint-plugin-prettier: 4.2.1_eslint@8.23.0+prettier@2.7.1 eslint-plugin-vue: 8.7.1_eslint@8.23.0 @@ -2371,7 +2369,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001390 - electron-to-chromium: 1.4.242 + electron-to-chromium: 1.4.243 node-releases: 2.0.6 update-browserslist-db: 1.0.7_browserslist@4.21.3 dev: true @@ -2779,17 +2777,6 @@ packages: } dev: true - /cross-env/7.0.3: - resolution: - { - integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== - } - engines: { node: ">=10.14", npm: ">=6", yarn: ">=1" } - hasBin: true - dependencies: - cross-spawn: 7.0.3 - dev: true - /cross-spawn/7.0.3: resolution: { @@ -3218,10 +3205,10 @@ packages: } dev: true - /electron-to-chromium/1.4.242: + /electron-to-chromium/1.4.243: resolution: { - integrity: sha512-nPdgMWtjjWGCtreW/2adkrB2jyHjClo9PtVhR6rW+oxa4E4Wom642Tn+5LslHP3XPL5MCpkn5/UEY60EXylNeQ== + integrity: sha512-BgLD2gBX43OSXwlT01oYRRD5NIB4n3okTRxkzEAC6G0SZG4TTlyrWMjbOo0fajCwqwpRtMHXQNMjtRN6qpNtfw== } dev: true