将包管理器更换为 pnpm,更新 Vue CLI 版本,调整配置文件

This commit is contained in:
2022-03-17 11:50:19 +08:00
parent 347dcd837c
commit d165a0e2be
7 changed files with 13047 additions and 35564 deletions

View File

@@ -1,24 +1,26 @@
// const isProduction = (process.env.NODE_ENV === 'production');
module.exports = { module.exports = {
root: true, root: true,
env: { env: {
node: true node: true,
}, },
extends: [ extends: [
'plugin:vue/recommended', 'plugin:vue/recommended',
'eslint:recommended' 'eslint:recommended',
], ],
parserOptions: { parserOptions: {
parser: 'babel-eslint' parser: '@babel/eslint-parser',
}, },
rules: { rules: {
'no-console': 'off', // 'no-console': (isProduction ? 'warn' : 'off'),
'no-debugger': 'off', // 'no-debugger': (isProduction ? 'warn' : 'off'),
'vue/html-closing-bracket-newline': 'off', 'vue/html-closing-bracket-newline': 'off',
'vue/html-indent': 'off', 'vue/html-indent': 'off',
'vue/html-self-closing': 'off', 'vue/html-self-closing': 'off',
'vue/max-attributes-per-line': 'off', 'vue/max-attributes-per-line': 'off',
'vue/multiline-html-element-content-newline': 'off', 'vue/multiline-html-element-content-newline': 'off',
'vue/no-v-html': 'off', 'vue/no-v-html': 'off',
'vue/singleline-html-element-content-newline': 'off' 'vue/singleline-html-element-content-newline': 'off',
} }
}; };

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
shamefully-hoist=true

View File

@@ -1,14 +1,21 @@
{ {
"compilerOptions": { "compilerOptions": {
"baseUrl": "./", "baseUrl": "./",
"module": "CommonJS", "lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
],
"module": "esnext",
"moduleResolution": "node",
"paths": { "paths": {
"@/*": [ "@/*": [
"src/*" "src/*"
] ]
}, },
"sourceMap": false, "sourceMap": false,
"target": "ES5" "target": "es5"
}, },
"include": [ "include": [
"src/**/*.vue", "src/**/*.vue",

35509
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,43 +7,49 @@
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve --mode development", "serve": "vue-cli-service serve --mode development",
"serve:production": "vue-cli-service serve --mode production", "serve-production": "vue-cli-service serve --mode production",
"serve:all": "vue-cli-service serve --host 0.0.0.0 --mode development", "serve-all": "vue-cli-service serve --mode development --host 0.0.0.0",
"serve:local": "vue-cli-service serve --host 127.0.0.1 --mode development", "serve-local": "vue-cli-service serve --mode development --host 127.0.0.1",
"build": "vue-cli-service build --mode production", "build": "vue-cli-service build --mode production",
"build:modern": "vue-cli-service build --mode production --modern", "build-modern": "vue-cli-service build --mode production --modern",
"lint:check": "vue-cli-service lint --no-fix", "lint-check": "vue-cli-service lint --no-fix",
"lint:fix": "vue-cli-service lint" "lint-fix": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"bookmark-file-parser": "^1.0.6", "bookmark-file-parser": "^1.0.6",
"codemirror": "^5.63.3", "codemirror": "^5.65.2",
"core-js": "^3.6.5", "core-js": "^3.8.3",
"dayjs": "^1.10.7", "dayjs": "^1.11.0",
"element-ui": "^2.15.6", "element-ui": "^2.15.6",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"html-entities": "^2.3.2", "html-entities": "^2.3.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mathjs": "^10.0.0", "mathjs": "^10.4.0",
"ress": "^4.0.0", "ress": "^5.0.2",
"vue": "^2.6.11", "vue": "^2.6.14",
"vue-router": "^3.2.0" "vue-router": "^3.5.1",
"vuex": "^3.6.2"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0", "@babel/core": "^7.12.16",
"@vue/cli-plugin-eslint": "~4.5.0", "@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-service": "~4.5.0", "@vue/cli-plugin-eslint": "~5.0.0",
"babel-eslint": "^10.1.0", "@vue/cli-plugin-router": "~5.0.0",
"eslint": "^6.7.2", "@vue/cli-plugin-vuex": "~5.0.0",
"eslint-plugin-vue": "^6.2.2", "@vue/cli-service": "~5.0.0",
"less": "^3.0.4", "@vue/eslint-config-standard": "^6.1.0",
"less-loader": "^5.0.0", "eslint": "^7.32.0",
"postcss-pxtorem": "^5.1.1", "eslint-plugin-import": "^2.25.3",
"sass": "^1.42.1", "eslint-plugin-node": "^11.1.0",
"sass-loader": "^8.0.2", "eslint-plugin-promise": "^5.1.0",
"style-resources-loader": "^1.4.1", "eslint-plugin-vue": "^8.0.3",
"vue-cli-plugin-style-resources-loader": "^0.1.5", "less": "^4.0.0",
"vue-template-compiler": "^2.6.11" "less-loader": "^8.0.0",
"postcss-pxtorem": "^6.0.0",
"sass": "^1.32.7",
"sass-loader": "^12.0.0",
"style-resources-loader": "^1.5.0",
"vue-template-compiler": "^2.6.14"
} }
} }

12954
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,51 @@
const path = require('path'); const path = require('path');
const packageName = process.env.npm_package_name;
const { defineConfig } = require('@vue/cli-service');
const { npm_package_name: packageName } = process.env;
function addStyleRes({ config = null, processor = '', patterns = [] }) {
if (!config) {
return;
}
const rule = config.module.rule(processor);
const types = ['normal', 'normal-modules', 'vue', 'vue-modules'];
types.forEach((type) => {
rule.oneOf(type)
.use('style-resources-loader')
.loader('style-resources-loader')
.options({ patterns });
});
}
if (packageName) { if (packageName) {
process.title = packageName; process.title = packageName;
} }
module.exports = { module.exports = defineConfig({
productionSourceMap: false,
assetsDir: 'static', assetsDir: 'static',
publicPath: './',
outputDir: 'dist', outputDir: 'dist',
publicPath: './',
productionSourceMap: false,
transpileDependencies: false,
chainWebpack: (config) => {
addStyleRes({
config,
processor: 'less',
patterns: [
path.resolve(__dirname, 'src/assets/css/variable.less'),
]
});
},
devServer: {
host: '0.0.0.0',
port: 9005,
},
pages: { pages: {
mainPage: { mainPage: {
@@ -26,18 +62,4 @@ module.exports = {
}, },
}, },
pluginOptions: { });
'style-resources-loader': {
preProcessor: 'less',
// 全局 Less 变量
patterns: [
path.resolve(__dirname, 'src/assets/css/variable.less'),
],
},
},
devServer: {
host: '0.0.0.0',
port: 9005,
}
};