akfun 2.0.7 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akfun",
3
- "version": "2.0.7",
3
+ "version": "3.0.3",
4
4
  "description": "前端脚手架:支持Vue技术栈和react技术栈",
5
5
  "keywords": [
6
6
  "前端工程",
@@ -44,124 +44,124 @@
44
44
  "url": "https://github.com/wibetter/akfun/issues"
45
45
  },
46
46
  "peerDependencies": {
47
- "eslint": "^6.2.0 || ^7.0.0"
47
+ "eslint": "^8.8.0",
48
+ "chalk": "^4.0.0",
49
+ "ora": "^4.0.4"
48
50
  },
49
51
  "dependencies": {
50
- "@babel/cli": "^7.10.1",
51
- "@babel/core": "^7.10.2",
52
- "@babel/plugin-proposal-class-properties": "^7.10.1",
53
- "@babel/plugin-proposal-decorators": "^7.10.1",
54
- "@babel/plugin-proposal-export-namespace-from": "^7.10.1",
55
- "@babel/plugin-proposal-function-sent": "^7.10.1",
56
- "@babel/plugin-proposal-json-strings": "^7.10.1",
57
- "@babel/plugin-proposal-numeric-separator": "^7.10.1",
58
- "@babel/plugin-proposal-throw-expressions": "^7.10.1",
52
+ "@babel/cli": "^7.17.0",
53
+ "@babel/core": "^7.17.0",
54
+ "@babel/plugin-proposal-class-properties": "^7.16.7",
55
+ "@babel/plugin-proposal-decorators": "^7.17.0",
56
+ "@babel/plugin-proposal-export-namespace-from": "^7.16.7",
57
+ "@babel/plugin-proposal-function-sent": "^7.16.7",
58
+ "@babel/plugin-proposal-json-strings": "^7.16.7",
59
+ "@babel/plugin-proposal-numeric-separator": "^7.16.7",
60
+ "@babel/plugin-proposal-throw-expressions": "^7.16.7",
59
61
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
60
- "@babel/plugin-syntax-import-meta": "^7.10.1",
61
- "@babel/plugin-transform-runtime": "^7.10.1",
62
+ "@babel/plugin-syntax-import-meta": "^7.10.4",
63
+ "@babel/plugin-transform-runtime": "^7.17.0",
62
64
  "@babel/polyfill": "^7.10.1",
63
- "@babel/preset-env": "^7.10.2",
64
- "@babel/preset-react": "^7.10.1",
65
- "@babel/preset-typescript": "^7.10.4",
66
- "@babel/register": "^7.10.1",
67
- "@mapbox/stylelint-processor-arbitrary-tags": "^0.3.0",
68
- "@rollup/plugin-alias": "^3.1.1",
69
- "@rollup/plugin-babel": "^5.2.0",
70
- "@rollup/plugin-commonjs": "^15.0.0",
71
- "@rollup/plugin-image": "^2.0.5",
65
+ "@babel/preset-env": "^7.16.11",
66
+ "@babel/preset-react": "^7.16.7",
67
+ "@babel/preset-typescript": "^7.16.7",
68
+ "@babel/register": "^7.17.0",
69
+ "@mapbox/stylelint-processor-arbitrary-tags": "^0.4.0",
70
+ "@rollup/plugin-alias": "^3.1.9",
71
+ "@rollup/plugin-babel": "^5.3.0",
72
+ "@rollup/plugin-commonjs": "^21.0.1",
73
+ "@rollup/plugin-image": "^2.1.1",
72
74
  "@rollup/plugin-json": "^4.1.0",
73
- "@rollup/plugin-node-resolve": "^9.0.0",
74
- "@typescript-eslint/eslint-plugin": "^3.9.0",
75
- "@typescript-eslint/parser": "^3.9.0",
76
- "@vue/compiler-sfc": "^3.0.0-rc.10",
77
- "@vue/eslint-config-typescript": "^5.0.2",
78
- "autoprefixer": "^9.8.0",
79
- "babel-eslint": "^10.1.0",
80
- "babel-loader": "^8.1.0",
81
- "babel-plugin-import": "^1.13.0",
82
- "cache-loader": "^4.1.0",
75
+ "@rollup/plugin-node-resolve": "^13.1.3",
76
+ "@typescript-eslint/eslint-plugin": "^5.10.2",
77
+ "@typescript-eslint/parser": "^5.10.2",
78
+ "@vue/compiler-sfc": "^3.2.29",
79
+ "@vue/eslint-config-typescript": "^10.0.0",
80
+ "autoprefixer": "^10.4.2",
81
+ "@babel/eslint-parser": "^7.17.0",
82
+ "babel-loader": "^8.2.3",
83
+ "babel-plugin-import": "^1.13.3",
83
84
  "chalk": "^4.0.0",
84
- "compression-webpack-plugin": "^4.0.0",
85
+ "compression-webpack-plugin": "^9.2.0",
85
86
  "connect-history-api-fallback": "^1.6.0",
86
- "copy-webpack-plugin": "^6.0.2",
87
- "css-loader": "^3.5.3",
88
- "cssnano": "^4.1.10",
87
+ "copy-webpack-plugin": "^10.2.4",
88
+ "css-loader": "^6.6.0",
89
+ "cssnano": "^5.0.16",
89
90
  "deepmerge": "^4.2.2",
90
- "del": "^3.0.0",
91
+ "del": "^6.0.0",
91
92
  "es6-promise-polyfill": "^1.2.0",
92
- "eslint": "^7.2.0",
93
- "eslint-config-airbnb-base": "^14.1.0",
94
- "eslint-config-prettier": "^7.2.0",
93
+ "eslint": "^8.8.0",
94
+ "eslint-config-airbnb-base": "^15.0.0",
95
+ "eslint-config-prettier": "^8.3.0",
95
96
  "eslint-friendly-formatter": "^4.0.1",
96
- "eslint-import-resolver-webpack": "^0.12.1",
97
- "eslint-loader": "^4.0.2",
98
- "eslint-plugin-html": "^6.0.2",
99
- "eslint-plugin-import": "^2.21.1",
100
- "eslint-plugin-prettier": "^3.1.3",
101
- "eslint-plugin-react": "^7.20.0",
102
- "eslint-plugin-vue": "^6.2.2",
97
+ "eslint-import-resolver-webpack": "^0.13.2",
98
+ "eslint-webpack-plugin": "^3.1.1",
99
+ "eslint-plugin-html": "^6.2.0",
100
+ "eslint-plugin-import": "^2.25.4",
101
+ "eslint-plugin-prettier": "^4.0.0",
102
+ "eslint-plugin-react": "^7.28.0",
103
+ "eslint-plugin-vue": "^8.4.0",
103
104
  "eventsource-polyfill": "^0.9.6",
104
- "express": "^4.17.1",
105
- "figlet": "^1.2.0",
106
- "file-loader": "^6.0.0",
107
- "friendly-errors-webpack-plugin": "^1.7.0",
108
- "git-clone": "^0.1.0",
109
- "glob": "^7.1.2",
110
- "html-loader": "^1.1.0",
111
- "html-webpack-plugin": "^4.3.0",
112
- "http-proxy-middleware": "^1.0.4",
113
- "inquirer": "^7.3.3",
114
- "mini-css-extract-plugin": "^0.9.0",
105
+ "express": "^4.17.2",
106
+ "figlet": "^1.5.2",
107
+ "file-loader": "^6.2.0",
108
+ "git-clone": "^0.2.0",
109
+ "glob": "^7.2.0",
110
+ "html-loader": "^3.1.0",
111
+ "html-webpack-plugin": "^5.5.0",
112
+ "http-proxy-middleware": "^2.0.2",
113
+ "inquirer": "^8.2.0",
114
+ "mini-css-extract-plugin": "^2.5.3",
115
+ "css-minimizer-webpack-plugin": "^3.4.1",
115
116
  "monaco-editor-webpack-plugin": "6.0.0",
116
- "node-sass": "^4.14.1",
117
- "opn": "^6.0.0",
118
- "optimize-css-assets-webpack-plugin": "^5.0.3",
117
+ "sass": "^1.49.7",
118
+ "open": "^8.4.0",
119
119
  "ora": "^4.0.4",
120
120
  "params-replace-loader": "^1.1.6",
121
- "portfinder": "^1.0.26",
122
- "postcss-loader": "^3.0.0",
123
- "postcss-nested": "^4.2.3",
124
- "postcss-preset-env": "^6.7.0",
125
- "postcss-simple-vars": "^5.0.2",
121
+ "portfinder": "^1.0.28",
122
+ "postcss-loader": "^6.2.1",
123
+ "postcss-nested": "^5.0.6",
124
+ "postcss-preset-env": "^7.3.1",
125
+ "postcss-simple-vars": "^6.0.3",
126
126
  "progress-bar-webpack-plugin": "^2.1.0",
127
- "qs": "^6.9.4",
127
+ "qs": "^6.10.3",
128
128
  "rimraf": "^3.0.2",
129
- "rollup": "^2.26.5",
130
- "rollup-plugin-postcss": "^3.1.8",
131
- "rollup-plugin-terser": "^7.0.0",
132
- "rollup-plugin-vue": "^6.0.0-beta.10",
133
- "sass-loader": "^8.0.2",
134
- "sass-resources-loader": "^2.0.3",
135
- "semver": "^7.3.2",
136
- "shelljs": "^0.8.4",
137
- "string-replace-loader": "^2.3.0",
138
- "style-loader": "^1.2.1",
139
- "stylelint": "^13.6.0",
140
- "stylelint-config-standard": "^20.0.0",
141
- "stylelint-webpack-plugin": "^2.0.0",
142
- "ts-import-plugin": "^1.6.5",
143
- "ts-loader": "^8.0.14",
144
- "typescript": "^3.9.7",
145
- "url-loader": "^4.1.0",
146
- "vue-eslint-parser": "^7.1.0",
147
- "vue-loader": "^15.9.2",
148
- "vue-style-loader": "^4.1.2",
149
- "vue-template-compiler": "^2.6.11",
150
- "webpack": "^5.65.0",
151
- "webpack-bundle-analyzer": "^3.8.0",
152
- "webpack-cli": "^4.9.1",
153
- "webpack-dev-middleware": "^3.7.2",
154
- "webpack-hot-middleware": "^2.25.0",
155
- "webpack-merge": "^4.2.2",
129
+ "rollup": "^2.67.0",
130
+ "rollup-plugin-postcss": "^4.0.2",
131
+ "rollup-plugin-terser": "^7.0.2",
132
+ "rollup-plugin-vue": "^6.0.0",
133
+ "sass-loader": "^12.4.0",
134
+ "sass-resources-loader": "^2.2.4",
135
+ "semver": "^7.3.5",
136
+ "shelljs": "^0.8.5",
137
+ "string-replace-loader": "^3.1.0",
138
+ "style-loader": "^3.3.1",
139
+ "stylelint": "^14.3.0",
140
+ "stylelint-config-standard": "^24.0.0",
141
+ "stylelint-webpack-plugin": "^3.1.1",
142
+ "ts-import-plugin": "^2.0.0",
143
+ "ts-loader": "^9.2.6",
144
+ "typescript": "^4.5.5",
145
+ "url-loader": "^4.1.1",
146
+ "vue-eslint-parser": "^8.2.0",
147
+ "vue-loader": "^15.9.8",
148
+ "vue-style-loader": "^4.1.3",
149
+ "vue-template-compiler": "^2.6.14",
150
+ "webpack": "^5.68.0",
151
+ "webpack-bundle-analyzer": "^4.5.0",
152
+ "webpack-cli": "^4.9.2",
153
+ "webpack-dev-middleware": "^5.3.1",
154
+ "webpack-hot-middleware": "^2.25.1",
155
+ "webpack-merge": "^5.8.0",
156
156
  "webpack-node-externals": "^3.0.0",
157
- "yargs": "^12.0.2"
157
+ "yargs": "^17.3.1"
158
158
  },
159
159
  "devDependencies": {
160
- "@commitlint/cli": "^8.3.5",
161
- "@commitlint/config-conventional": "^9.1.1",
162
- "husky": "^4.2.5",
163
- "lint-staged": "^10.2.9",
164
- "prettier": "^2.0.5"
160
+ "@commitlint/cli": "^16.1.0",
161
+ "@commitlint/config-conventional": "^16.0.0",
162
+ "husky": "^4.3.8",
163
+ "lint-staged": "^12.3.3",
164
+ "prettier": "^2.5.1"
165
165
  },
166
166
  "engines": {
167
167
  "node": ">= 10.13.0",
@@ -1,12 +1,13 @@
1
- const getCurWebpackConfig = require('../utils/getCurWebpackConfig.js'); // 用于获取当前webpack配置的方法
1
+ const getCurWebpackConfig = require('../utils/getCurWebpackConfig'); // 用于获取当前webpack配置的方法
2
2
  const curWebpackBaseConfPath = getCurWebpackConfig('base');
3
3
 
4
4
  module.exports = {
5
5
  root: true,
6
- parser: 'babel-eslint', // 指定eslint解析器的,解析器必须符合规则
6
+ parser: '@babel/eslint-parser', // 指定eslint解析器的,解析器必须符合规则
7
7
  // 此项是用来指定javaScript语言类型和风格,sourceType用来指定js导入的方式,默认是script,此处设置为module,指某块导入方式
8
8
  parserOptions: {
9
- ecmaVersion: 6,
9
+ ecmaVersion: 8,
10
+ requireConfigFile: false,
10
11
  sourceType: 'module', // 支持的ES语法版本,默认为5。注意只是语法,不包括ES的全局变量
11
12
  ecmaFeatures: {
12
13
  // Features是特征的意思,这里用于指定要使用其他那些语言对象
@@ -1,4 +1,4 @@
1
- const getCurWebpackConfig = require('../utils/getCurWebpackConfig.js'); // 用于获取当前webpack配置的方法
1
+ const getCurWebpackConfig = require('../utils/getCurWebpackConfig'); // 用于获取当前webpack配置的方法
2
2
  const curWebpackBaseConfPath = getCurWebpackConfig('base');
3
3
 
4
4
  module.exports = {
@@ -6,8 +6,9 @@ module.exports = {
6
6
  parser: '@typescript-eslint/parser',
7
7
  // 此项是用来指定javaScript语言类型和风格,sourceType用来指定js导入的方式,默认是script,此处设置为module,指某块导入方式
8
8
  parserOptions: {
9
- parser: 'babel-eslint', // babel-eslint解析器是对babel解析器的包装使其与ESLint解析
10
- ecmaVersion: 6,
9
+ parser: '@babel/eslint-parser', // babel-eslint解析器是对babel解析器的包装使其与ESLint解析
10
+ ecmaVersion: 8,
11
+ requireConfigFile: false,
11
12
  sourceType: 'module', // 支持的ES语法版本,默认为5。注意只是语法,不包括ES的全局变量
12
13
  ecmaFeatures: {
13
14
  // Features是特征的意思,这里用于指定要使用其他那些语言对象
@@ -83,8 +84,5 @@ module.exports = {
83
84
  'object-curly-newline': 0, // 该规则在对象文字括号或销毁分配中强制使用一致的换行符
84
85
  'operator-linebreak': [0, 'before'], // 换行时运算符在行尾还是行首
85
86
  'max-len': ['warn', { code: 150 }]
86
- },
87
- linterOptions: {
88
- exclude: ['node_modules']
89
87
  }
90
88
  };
@@ -1,4 +1,4 @@
1
- const getCurWebpackConfig = require('../utils/getCurWebpackConfig.js'); // 用于获取当前webpack配置的方法
1
+ const getCurWebpackConfig = require('../utils/getCurWebpackConfig'); // 用于获取当前webpack配置的方法
2
2
  const curWebpackBaseConfPath = getCurWebpackConfig('base');
3
3
 
4
4
  module.exports = {
@@ -6,8 +6,9 @@ module.exports = {
6
6
  parser: 'vue-eslint-parser', // 指定eslint解析器的,解析器必须符合规则
7
7
  // 此项是用来指定javaScript语言类型和风格,sourceType用来指定js导入的方式,默认是script,此处设置为module,指某块导入方式
8
8
  parserOptions: {
9
- parser: 'babel-eslint', // babel-eslint解析器是对babel解析器的包装使其与ESLint解析
10
- ecmaVersion: 6,
9
+ parser: '@babel/eslint-parser', // babel-eslint解析器是对babel解析器的包装使其与ESLint解析
10
+ ecmaVersion: 8,
11
+ requireConfigFile: false,
11
12
  sourceType: 'module', // 支持的ES语法版本,默认为5。注意只是语法,不包括ES的全局变量
12
13
  ecmaFeatures: {
13
14
  // Features是特征的意思,这里用于指定要使用其他那些语言对象
@@ -1,16 +1,18 @@
1
1
  // https://www.npmjs.com/package/autoprefixer
2
2
 
3
3
  module.exports = {
4
- plugins: [
5
- require('autoprefixer')({
6
- overrideBrowserslist: [
7
- '> 1%',
8
- 'last 2 versions',
9
- 'not ie <= 8',
10
- 'iOS >= 8',
11
- 'Firefox >= 20',
12
- 'Android > 4.4'
13
- ]
14
- })
15
- ]
4
+ postcssOptions: {
5
+ plugins: [
6
+ require('autoprefixer')({
7
+ overrideBrowserslist: [
8
+ '> 1%',
9
+ 'last 2 versions',
10
+ 'not ie <= 8',
11
+ 'iOS >= 8',
12
+ 'Firefox >= 20',
13
+ 'Android > 4.4'
14
+ ]
15
+ })
16
+ ]
17
+ }
16
18
  };
package/src/dev-server.js CHANGED
@@ -1,4 +1,4 @@
1
- const opn = require('opn');
1
+ const open = require('open');
2
2
  const ora = require('ora');
3
3
  const path = require('path');
4
4
  const express = require('express');
@@ -43,16 +43,26 @@ module.exports = function (akfunConfig, _consoleTag) {
43
43
 
44
44
  // 使用 express 启动一个服务
45
45
  const app = express();
46
+
46
47
  // 获取开发环境的webpack基本配置
47
48
  const webpackConfig = getDevWebpackConfig(config);
49
+
50
+ // serve pure public assets
51
+ // 拼接 public 文件夹的静态资源路径
52
+ const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory);
53
+ app.use(staticPath, express.static(resolve('public')));
54
+
48
55
  const compiler = webpack(webpackConfig); // 启动 webpack 进行编译
49
56
 
50
57
  // 启动 webpack-dev-middleware,将编译后的文件暂存到内存中
51
58
  const devMiddleware = require('webpack-dev-middleware')(compiler, {
52
59
  publicPath: webpackConfig.output.publicPath,
53
- quiet: true
60
+ stats: true
54
61
  });
55
62
 
63
+ // serve webpack bundle output
64
+ app.use(devMiddleware);
65
+
56
66
  // 启动 webpack-hot-middleware,也就是我们常说的 Hot-reload
57
67
  const hotMiddleware = require('webpack-hot-middleware')(compiler, {
58
68
  log: false,
@@ -83,15 +93,6 @@ module.exports = function (akfunConfig, _consoleTag) {
83
93
  // handle fallback for HTML5 history API
84
94
  app.use(require('connect-history-api-fallback')());
85
95
 
86
- // serve webpack bundle output
87
- app.use(devMiddleware);
88
-
89
- // serve pure public assets
90
- // 拼接 public 文件夹的静态资源路径
91
- const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory);
92
-
93
- app.use(staticPath, express.static(resolve('public')));
94
-
95
96
  let _resolve;
96
97
  let _reject;
97
98
  const readyPromise = new Promise((resolve, reject) => {
@@ -127,7 +128,7 @@ module.exports = function (akfunConfig, _consoleTag) {
127
128
  console.info(
128
129
  `当前运行脚本:\n ${projPath}${filename}.js\n当前运行样式[可能不存在]:\n${projPath}${filename}.css`
129
130
  );
130
- opn(`${projPath}${filename}.html`);
131
+ open(`${projPath}${filename}.html`, { wait: true });
131
132
  }
132
133
  }
133
134
  server = app.listen(port);
@@ -0,0 +1,138 @@
1
+ {
2
+ "name": "akfun",
3
+ "version": "1.2.12",
4
+ "description": "前端脚手架:支持Vue技术站和react技术栈",
5
+ "keywords": ["前端工程", "前端脚手架", "webpack"],
6
+ "author": "ldan@wibetter",
7
+ "license": "MIT",
8
+ "bin": {
9
+ "akfun": "./bin/akfun.js"
10
+ },
11
+ "main": "module/main.js",
12
+ "scripts": {
13
+ "akfun": "akfun",
14
+ "lint": "eslint --ext .js,.vue src",
15
+ "lintFix": "eslint --ext .js,.vue src --fix",
16
+ "format": "prettier --write \"src/**/**/*.{js,vue,tsx,ts,scss,json}\""
17
+ },
18
+ "files": ["bin/*", "module/*", "src/*"],
19
+ "husky": {
20
+ "hooks": {
21
+ "pre-commit": "lint-staged",
22
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
23
+ }
24
+ },
25
+ "lint-staged": {
26
+ "src/**/**/*.{js,vue,tsx,ts,scss,json}": ["eslint --ext --fix"],
27
+ "src/**/**/*.{js,vue,tsx,ts,scss,json}": ["prettier --write"]
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+http://git@github.com:wibetter/akfun.git"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/wibetter/akfun/issues"
35
+ },
36
+ "peerDependencies": {
37
+ "eslint": "^6.2.0 || ^7.0.0"
38
+ },
39
+ "dependencies": {
40
+ "del": "^3.0.0",
41
+ "figlet": "^1.2.0",
42
+ "glob": "^7.1.2",
43
+ "yargs": "^12.0.2",
44
+ "chalk": "^4.0.0",
45
+ "opn": "^6.0.0",
46
+ "ora": "^4.0.4",
47
+ "qs": "^6.9.4",
48
+ "rimraf": "^3.0.2",
49
+ "express": "^4.17.1",
50
+ "node-sass": "^4.14.1",
51
+ "portfinder": "^1.0.26",
52
+ "semver": "^7.3.2",
53
+ "shelljs": "^0.8.4",
54
+ "git-clone": "^0.1.0",
55
+ "webpack": "^4.43.0",
56
+ "webpack-bundle-analyzer": "^3.8.0",
57
+ "webpack-cli": "^3.3.11",
58
+ "webpack-dev-middleware": "^3.7.2",
59
+ "webpack-hot-middleware": "^2.25.0",
60
+ "webpack-merge": "^4.2.2",
61
+ "vue-loader": "^15.9.2",
62
+ "vue-style-loader": "^4.1.2",
63
+ "vue-template-compiler": "^2.6.11",
64
+ "cache-loader": "^4.1.0",
65
+ "compression-webpack-plugin": "^4.0.0",
66
+ "connect-history-api-fallback": "^1.6.0",
67
+ "copy-webpack-plugin": "^6.0.2",
68
+ "css-loader": "^3.5.3",
69
+ "es6-promise-polyfill": "^1.2.0",
70
+ "html-loader": "^1.1.0",
71
+ "html-webpack-plugin": "^4.3.0",
72
+ "http-proxy-middleware": "^1.0.4",
73
+ "autoprefixer": "^9.8.0",
74
+ "mini-css-extract-plugin": "^0.9.0",
75
+ "optimize-css-assets-webpack-plugin": "^5.0.3",
76
+ "params-replace-loader": "^1.1.6",
77
+ "progress-bar-webpack-plugin": "^2.1.0",
78
+ "sass-loader": "^8.0.2",
79
+ "sass-resources-loader": "^2.0.3",
80
+ "string-replace-loader": "^2.3.0",
81
+ "style-loader": "^1.2.1",
82
+ "eventsource-polyfill": "^0.9.6",
83
+ "friendly-errors-webpack-plugin": "^1.7.0",
84
+ "babel-loader": "^8.1.0",
85
+ "@babel/cli": "^7.10.1",
86
+ "@babel/core": "^7.10.2",
87
+ "@babel/polyfill": "^7.10.1",
88
+ "@babel/plugin-proposal-class-properties": "^7.10.1",
89
+ "@babel/plugin-proposal-decorators": "^7.10.1",
90
+ "@babel/plugin-proposal-export-namespace-from": "^7.10.1",
91
+ "@babel/plugin-proposal-function-sent": "^7.10.1",
92
+ "@babel/plugin-proposal-json-strings": "^7.10.1",
93
+ "@babel/plugin-proposal-numeric-separator": "^7.10.1",
94
+ "@babel/plugin-proposal-throw-expressions": "^7.10.1",
95
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
96
+ "@babel/plugin-syntax-import-meta": "^7.10.1",
97
+ "@babel/plugin-transform-runtime": "^7.10.1",
98
+ "@babel/preset-env": "^7.10.2",
99
+ "@babel/preset-react": "^7.10.1",
100
+ "@babel/register": "^7.10.1",
101
+ "babel-eslint": "^10.1.0",
102
+ "babel-plugin-import": "^1.13.0",
103
+ "eslint-loader": "^4.0.2",
104
+ "eslint": "^7.2.0",
105
+ "eslint-config-airbnb-base": "^14.1.0",
106
+ "eslint-friendly-formatter": "^4.0.1",
107
+ "eslint-import-resolver-webpack": "^0.12.1",
108
+ "eslint-plugin-html": "^6.0.2",
109
+ "eslint-plugin-import": "^2.21.1",
110
+ "eslint-plugin-prettier": "^3.1.3",
111
+ "eslint-plugin-react": "^7.20.0",
112
+ "eslint-plugin-vue": "^6.2.2",
113
+ "vue-eslint-parser": "^7.1.0",
114
+ "stylelint": "^13.6.0",
115
+ "stylelint-config-standard": "^20.0.0",
116
+ "stylelint-webpack-plugin": "^2.0.0",
117
+ "@mapbox/stylelint-processor-arbitrary-tags": "^0.3.0"
118
+ },
119
+ "devDependencies": {
120
+ "husky": "^4.2.5",
121
+ "lint-staged": "^10.2.9",
122
+ "prettier": "^2.0.5",
123
+ "@commitlint/cli": "^8.3.5",
124
+ "@commitlint/config-conventional": "^9.1.1"
125
+ },
126
+ "engines": {
127
+ "node": ">= 10.13.0",
128
+ "npm": ">= 6.4.1"
129
+ },
130
+ "browserslist": [
131
+ "> 1%",
132
+ "last 2 versions",
133
+ "not ie <= 8",
134
+ "iOS >= 8",
135
+ "Firefox >= 20",
136
+ "Android > 4.4"
137
+ ]
138
+ }
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "akfun",
3
- "version": "1.2.12",
4
- "description": "前端脚手架:支持Vue技术站和react技术栈",
5
- "keywords": ["前端工程", "前端脚手架", "webpack"],
6
- "author": "ldan@wibetter",
3
+ "version": "3.0.0",
4
+ "description": "前端脚手架:支持Vue技术栈和react技术栈",
5
+ "keywords": [
6
+ "前端工程",
7
+ "前端脚手架",
8
+ "webpack",
9
+ "react项目脚手架",
10
+ "vue项目脚手架",
11
+ "lib库构建工具"
12
+ ],
13
+ "author": "wibetter",
7
14
  "license": "MIT",
8
15
  "bin": {
9
16
  "akfun": "./bin/akfun.js"
@@ -11,8 +18,6 @@
11
18
  "main": "module/main.js",
12
19
  "scripts": {
13
20
  "akfun": "akfun",
14
- "lint": "eslint --ext .js,.vue src",
15
- "lintFix": "eslint --ext .js,.vue src --fix",
16
21
  "format": "prettier --write \"src/**/**/*.{js,vue,tsx,ts,scss,json}\""
17
22
  },
18
23
  "files": ["bin/*", "module/*", "src/*"],
@@ -23,8 +28,7 @@
23
28
  }
24
29
  },
25
30
  "lint-staged": {
26
- "src/**/**/*.{js,vue,tsx,ts,scss,json}": ["eslint --ext --fix"],
27
- "src/**/**/*.{js,vue,tsx,ts,scss,json}": ["prettier --write"]
31
+ "src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}": ["prettier --write"]
28
32
  },
29
33
  "repository": {
30
34
  "type": "git",
@@ -34,96 +38,121 @@
34
38
  "url": "https://github.com/wibetter/akfun/issues"
35
39
  },
36
40
  "peerDependencies": {
37
- "eslint": "^6.2.0 || ^7.0.0"
41
+ "eslint": "^8.8.0",
42
+ "chalk": "^4.0.0",
43
+ "ora": "^4.0.4"
38
44
  },
39
45
  "dependencies": {
40
- "del": "^3.0.0",
41
- "figlet": "^1.2.0",
42
- "glob": "^7.1.2",
43
- "yargs": "^12.0.2",
46
+ "@babel/cli": "^7.17.0",
47
+ "@babel/core": "^7.17.0",
48
+ "@babel/plugin-proposal-class-properties": "^7.16.7",
49
+ "@babel/plugin-proposal-decorators": "^7.17.0",
50
+ "@babel/plugin-proposal-export-namespace-from": "^7.16.7",
51
+ "@babel/plugin-proposal-function-sent": "^7.16.7",
52
+ "@babel/plugin-proposal-json-strings": "^7.16.7",
53
+ "@babel/plugin-proposal-numeric-separator": "^7.16.7",
54
+ "@babel/plugin-proposal-throw-expressions": "^7.16.7",
55
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
56
+ "@babel/plugin-syntax-import-meta": "^7.10.4",
57
+ "@babel/plugin-transform-runtime": "^7.17.0",
58
+ "@babel/polyfill": "^7.10.1",
59
+ "@babel/preset-env": "^7.16.11",
60
+ "@babel/preset-react": "^7.16.7",
61
+ "@babel/preset-typescript": "^7.16.7",
62
+ "@babel/register": "^7.17.0",
63
+ "@mapbox/stylelint-processor-arbitrary-tags": "^0.4.0",
64
+ "@rollup/plugin-alias": "^3.1.9",
65
+ "@rollup/plugin-babel": "^5.3.0",
66
+ "@rollup/plugin-commonjs": "^21.0.1",
67
+ "@rollup/plugin-image": "^2.1.1",
68
+ "@rollup/plugin-json": "^4.1.0",
69
+ "@rollup/plugin-node-resolve": "^13.1.3",
70
+ "@typescript-eslint/eslint-plugin": "^5.10.2",
71
+ "@typescript-eslint/parser": "^5.10.2",
72
+ "@vue/compiler-sfc": "^3.2.29",
73
+ "@vue/eslint-config-typescript": "^10.0.0",
74
+ "autoprefixer": "^10.4.2",
75
+ "@babel/eslint-parser": "^7.17.0",
76
+ "babel-loader": "^8.2.3",
77
+ "babel-plugin-import": "^1.13.3",
44
78
  "chalk": "^4.0.0",
45
- "opn": "^6.0.0",
46
- "ora": "^4.0.4",
47
- "qs": "^6.9.4",
48
- "rimraf": "^3.0.2",
49
- "express": "^4.17.1",
50
- "node-sass": "^4.14.1",
51
- "portfinder": "^1.0.26",
52
- "semver": "^7.3.2",
53
- "shelljs": "^0.8.4",
54
- "git-clone": "^0.1.0",
55
- "webpack": "^4.43.0",
56
- "webpack-bundle-analyzer": "^3.8.0",
57
- "webpack-cli": "^3.3.11",
58
- "webpack-dev-middleware": "^3.7.2",
59
- "webpack-hot-middleware": "^2.25.0",
60
- "webpack-merge": "^4.2.2",
61
- "url-loader": "^4.1.0",
62
- "vue-loader": "^15.9.2",
63
- "vue-style-loader": "^4.1.2",
64
- "vue-template-compiler": "^2.6.11",
65
- "cache-loader": "^4.1.0",
66
- "compression-webpack-plugin": "^4.0.0",
79
+ "compression-webpack-plugin": "^9.2.0",
67
80
  "connect-history-api-fallback": "^1.6.0",
68
- "copy-webpack-plugin": "^6.0.2",
69
- "css-loader": "^3.5.3",
81
+ "copy-webpack-plugin": "^10.2.4",
82
+ "css-loader": "^6.6.0",
83
+ "cssnano": "^5.0.16",
84
+ "deepmerge": "^4.2.2",
85
+ "del": "^6.0.0",
70
86
  "es6-promise-polyfill": "^1.2.0",
71
- "html-loader": "^1.1.0",
72
- "html-webpack-plugin": "^4.3.0",
73
- "http-proxy-middleware": "^1.0.4",
74
- "autoprefixer": "^9.8.0",
75
- "mini-css-extract-plugin": "^0.9.0",
76
- "file-loader": "^6.0.0",
77
- "optimize-css-assets-webpack-plugin": "^5.0.3",
87
+ "eslint": "^8.8.0",
88
+ "eslint-config-airbnb-base": "^15.0.0",
89
+ "eslint-config-prettier": "^8.3.0",
90
+ "eslint-friendly-formatter": "^4.0.1",
91
+ "eslint-import-resolver-webpack": "^0.13.2",
92
+ "eslint-webpack-plugin": "^3.1.1",
93
+ "eslint-plugin-html": "^6.2.0",
94
+ "eslint-plugin-import": "^2.25.4",
95
+ "eslint-plugin-prettier": "^4.0.0",
96
+ "eslint-plugin-react": "^7.28.0",
97
+ "eslint-plugin-vue": "^8.4.0",
98
+ "eventsource-polyfill": "^0.9.6",
99
+ "express": "^4.17.2",
100
+ "figlet": "^1.5.2",
101
+ "git-clone": "^0.2.0",
102
+ "glob": "^7.2.0",
103
+ "html-loader": "^3.1.0",
104
+ "html-webpack-plugin": "^5.5.0",
105
+ "http-proxy-middleware": "^2.0.2",
106
+ "inquirer": "^8.2.0",
107
+ "mini-css-extract-plugin": "^2.5.3",
108
+ "monaco-editor-webpack-plugin": "6.0.0",
109
+ "sass": "^1.49.7",
110
+ "open": "^8.4.0",
111
+ "ora": "^4.0.4",
78
112
  "params-replace-loader": "^1.1.6",
113
+ "portfinder": "^1.0.28",
114
+ "postcss-loader": "^6.2.1",
115
+ "postcss-nested": "^5.0.6",
116
+ "postcss-preset-env": "^7.3.1",
117
+ "postcss-simple-vars": "^6.0.3",
79
118
  "progress-bar-webpack-plugin": "^2.1.0",
80
- "sass-loader": "^8.0.2",
81
- "sass-resources-loader": "^2.0.3",
82
- "string-replace-loader": "^2.3.0",
83
- "style-loader": "^1.2.1",
84
- "eventsource-polyfill": "^0.9.6",
85
- "friendly-errors-webpack-plugin": "^1.7.0",
86
- "babel-loader": "^8.1.0",
87
- "@babel/cli": "^7.10.1",
88
- "@babel/core": "^7.10.2",
89
- "@babel/polyfill": "^7.10.1",
90
- "@babel/plugin-proposal-class-properties": "^7.10.1",
91
- "@babel/plugin-proposal-decorators": "^7.10.1",
92
- "@babel/plugin-proposal-export-namespace-from": "^7.10.1",
93
- "@babel/plugin-proposal-function-sent": "^7.10.1",
94
- "@babel/plugin-proposal-json-strings": "^7.10.1",
95
- "@babel/plugin-proposal-numeric-separator": "^7.10.1",
96
- "@babel/plugin-proposal-throw-expressions": "^7.10.1",
97
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
98
- "@babel/plugin-syntax-import-meta": "^7.10.1",
99
- "@babel/plugin-transform-runtime": "^7.10.1",
100
- "@babel/preset-env": "^7.10.2",
101
- "@babel/preset-react": "^7.10.1",
102
- "@babel/register": "^7.10.1",
103
- "babel-eslint": "^10.1.0",
104
- "babel-plugin-import": "^1.13.0",
105
- "eslint-loader": "^4.0.2",
106
- "eslint": "^7.2.0",
107
- "eslint-config-airbnb-base": "^14.1.0",
108
- "eslint-friendly-formatter": "^4.0.1",
109
- "eslint-import-resolver-webpack": "^0.12.1",
110
- "eslint-plugin-html": "^6.0.2",
111
- "eslint-plugin-import": "^2.21.1",
112
- "eslint-plugin-prettier": "^3.1.3",
113
- "eslint-plugin-react": "^7.20.0",
114
- "eslint-plugin-vue": "^6.2.2",
115
- "vue-eslint-parser": "^7.1.0",
116
- "stylelint": "^13.6.0",
117
- "stylelint-config-standard": "^20.0.0",
118
- "stylelint-webpack-plugin": "^2.0.0",
119
- "@mapbox/stylelint-processor-arbitrary-tags": "^0.3.0"
119
+ "qs": "^6.10.3",
120
+ "rimraf": "^3.0.2",
121
+ "rollup": "^2.67.0",
122
+ "rollup-plugin-postcss": "^4.0.2",
123
+ "rollup-plugin-terser": "^7.0.2",
124
+ "rollup-plugin-vue": "^6.0.0",
125
+ "sass-loader": "^12.4.0",
126
+ "sass-resources-loader": "^2.2.4",
127
+ "semver": "^7.3.5",
128
+ "shelljs": "^0.8.5",
129
+ "string-replace-loader": "^3.1.0",
130
+ "style-loader": "^3.3.1",
131
+ "stylelint": "^14.3.0",
132
+ "stylelint-config-standard": "^24.0.0",
133
+ "stylelint-webpack-plugin": "^3.1.1",
134
+ "ts-import-plugin": "^2.0.0",
135
+ "ts-loader": "^9.2.6",
136
+ "typescript": "^4.5.5",
137
+ "vue-eslint-parser": "^8.2.0",
138
+ "vue-loader": "^15.9.8",
139
+ "vue-style-loader": "^4.1.3",
140
+ "vue-template-compiler": "^2.6.14",
141
+ "webpack": "^5.68.0",
142
+ "webpack-bundle-analyzer": "^4.5.0",
143
+ "webpack-cli": "^4.9.2",
144
+ "webpack-dev-middleware": "^5.3.1",
145
+ "webpack-hot-middleware": "^2.25.1",
146
+ "webpack-merge": "^5.8.0",
147
+ "webpack-node-externals": "^3.0.0",
148
+ "yargs": "^17.3.1"
120
149
  },
121
150
  "devDependencies": {
122
- "husky": "^4.2.5",
123
- "lint-staged": "^10.2.9",
124
- "prettier": "^2.0.5",
125
- "@commitlint/cli": "^8.3.5",
126
- "@commitlint/config-conventional": "^9.1.1"
151
+ "@commitlint/cli": "^16.1.0",
152
+ "@commitlint/config-conventional": "^16.0.0",
153
+ "husky": "^4.3.8",
154
+ "lint-staged": "^12.3.3",
155
+ "prettier": "^2.5.1"
127
156
  },
128
157
  "engines": {
129
158
  "node": ">= 10.13.0",
@@ -3,10 +3,11 @@ const { curWebpackBaseConfPath } = require('akfun');
3
3
 
4
4
  module.exports = {
5
5
  root: true,
6
- parser: 'babel-eslint', // 指定eslint解析器的,解析器必须符合规则
6
+ parser: '@babel/eslint-parser', // 指定eslint解析器的,解析器必须符合规则
7
7
  // 此项是用来指定javaScript语言类型和风格,sourceType用来指定js导入的方式,默认是script,此处设置为module,指某块导入方式
8
8
  parserOptions: {
9
- ecmaVersion: 6,
9
+ ecmaVersion: 8,
10
+ requireConfigFile: false,
10
11
  sourceType: 'module', // 支持的ES语法版本,默认为5。注意只是语法,不包括ES的全局变量
11
12
  ecmaFeatures: {
12
13
  // Features是特征的意思,这里用于指定要使用其他那些语言对象
@@ -23,11 +24,11 @@ module.exports = {
23
24
  // 此项是用来配置标准的js风格,就是说写代码的时候要规范的写,如果你使用vs-code我觉得应该可以避免出错
24
25
  extends: [
25
26
  'airbnb-base', // eslint-config-airbnb-base
26
- '@vue/typescript' // @vue/eslint-config-typescript: https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
27
+ 'prettier' // eslint-config-prettier
27
28
  ],
28
29
  // 此项是用来提供插件的,插件名称省略了eslint-plugin-,下面这个配置是用来规范html的
29
30
  // required to lint *.src files
30
- plugins: ['@typescript-eslint', 'prettier', 'html', 'react', 'vue'],
31
+ plugins: ['prettier', 'html', 'react'],
31
32
  // check if imports actually resolve
32
33
  settings: {
33
34
  'import/resolver': {
@@ -52,8 +53,8 @@ module.exports = {
52
53
  vue: 'never'
53
54
  }
54
55
  ],
55
- 'react/jsx-uses-react': 'error',
56
- 'react/jsx-uses-vars': 'error',
56
+ 'react/jsx-uses-react': 'error', // 防止在JSX中使用的变量被错误地标记为未使用
57
+ 'react/jsx-uses-vars': 'error', // 防止在JSX中使用的变量被错误地标记为未使用
57
58
  'import/first': 0,
58
59
  'arrow-parens': 0,
59
60
  'no-underscore-dangle': 'off',
@@ -80,6 +81,7 @@ module.exports = {
80
81
  'no-lonely-if': 0, // 禁止else语句内只有if语句
81
82
  'no-eval': 1, // JavaScript的eval()功能具有潜在的危险,并且经常被滥用
82
83
  'object-curly-newline': 0, // 该规则在对象文字括号或销毁分配中强制使用一致的换行符
83
- 'operator-linebreak': [0, 'before'] // 换行时运算符在行尾还是行首
84
+ 'operator-linebreak': [0, 'before'], // 换行时运算符在行尾还是行首
85
+ 'max-len': ['warn', { code: 150 }]
84
86
  }
85
87
  };
@@ -12,7 +12,7 @@ module.exports = {
12
12
  settings: {
13
13
  enableESLint: false, // 调试模式是否开启ESLint,默认关闭ESLint检测代码格式
14
14
  enableESLintFix: false, // 是否自动修正代码格式,默认不自动修正
15
- enableStyleLint: true, // 是否开启StyleLint,默认开启ESLint检测代码格式
15
+ enableStyleLint: false, // 是否开启StyleLint,默认开启ESLint检测代码格式
16
16
  enableStyleLintFix: false // 是否需要StyleLint自动修正代码格式
17
17
  },
18
18
  webpack: {
@@ -22,7 +22,7 @@ module.exports = {
22
22
  },
23
23
  resolve: {
24
24
  // webpack的resolve配置
25
- extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', 'json'], // 用于配置webpack在尝试过程中用到的后缀列表
25
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue', '.json'], // 用于配置webpack在尝试过程中用到的后缀列表
26
26
  alias: {
27
27
  '@': resolve('src'),
28
28
  $components: resolve('src/components'),
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {},
37
37
  "devDependencies": {
38
- "akfun": "^1.0.1",
38
+ "akfun": "^3.0.1",
39
39
  "@commitlint/cli": "^8.3.5",
40
40
  "@commitlint/config-conventional": "^9.1.1",
41
41
  "husky": "^4.2.5",
@@ -24,7 +24,7 @@ module.exports = function (entryConfig, curDefaultHtmlTemplate) {
24
24
  filename: `${filename}.html`,
25
25
  template: curPageTemplate,
26
26
  chunks: ['vendor', 'common', filename],
27
- inject: true, // 当传递true或body时,所有javascript资源都将放置在body元素的底部。
27
+ inject: 'body', // 当传递true或body时,所有javascript资源都将放置在body元素的底部。
28
28
  minify: false, // mode: 'production'模式下会自定压缩html代码,优先级比minify高
29
29
  // necessary to consistently work with multiple chunks via CommonsChunkPlugin
30
30
  chunksSortMode: 'auto'
@@ -36,6 +36,20 @@ exports.cssLoaders = function (options) {
36
36
  const cssLoader = {
37
37
  loader: 'css-loader',
38
38
  options: {
39
+ // url: false, // enables/disables url()/image-set() functions handling
40
+ url: {
41
+ filter: (url, resourcePath) => {
42
+ /*// 自定义配置优先
43
+ if (options.cssLoaderUrl !== undefined) {
44
+ return options.cssLoaderUrl;
45
+ }*/
46
+ // Don't handle `node_modules` urls
47
+ if (resourcePath.includes('node_modules')) {
48
+ return true;
49
+ }
50
+ return false;
51
+ },
52
+ },
39
53
  sourceMap: options.sourceMap
40
54
  }
41
55
  };
@@ -56,7 +70,7 @@ exports.cssLoaders = function (options) {
56
70
  {
57
71
  loader: MiniCssExtractPlugin.loader,
58
72
  options: {
59
- esModule: true
73
+ esModule: false // enable a CommonJS syntax using
60
74
  }
61
75
  },
62
76
  cssLoader,
@@ -5,8 +5,9 @@ const webpack = require('webpack');
5
5
  const StyleLintPlugin = require('stylelint-webpack-plugin');
6
6
  const VueLoaderPlugin = require('vue-loader/lib/plugin');
7
7
  const nodeExternals = require('webpack-node-externals');
8
- const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
8
+ // const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
9
9
  const ProgressBarPlugin = require('progress-bar-webpack-plugin');
10
+ const ESLintPlugin = require('eslint-webpack-plugin');
10
11
  const utils = require('./loaderUtils');
11
12
  const vueLoaderConfig = require('./vue-loader.conf');
12
13
  const { resolve, resolveToCurrentRoot } = require('../utils/pathUtils');
@@ -120,34 +121,43 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
120
121
  url-loader 功能类似于 file-loader,在文件大小(单位 byte)低于指定的限制时,可以返回一个 DataURL。
121
122
  */
122
123
  test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
123
- loader: 'url-loader',
124
- options: {
125
- limit: 10000,
126
- name: utils.assetsPath('img/[name].[hash:7].[ext]')
124
+ type: 'asset',
125
+ parser: {
126
+ dataUrlCondition: {
127
+ maxSize: 2 * 1024 //data转成url的条件,也就是转成bas64的条件,maxSize相当于limit
128
+ }
129
+ },
130
+ generator: {
131
+ // filename,和output中设置assetModuleFilename一样,将资源打包至img文件夹
132
+ filename: utils.assetsPath('img/[name].[hash:7][ext]') //[name]指原来的名字,[hash:6]取哈希的前六位,[ext]指原来的扩展名
127
133
  }
128
134
  },
129
135
  {
130
136
  // 视频音频资源
131
137
  test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
132
- loader: 'url-loader',
133
- options: {
134
- limit: 10000,
135
- name: utils.assetsPath('media/[name].[hash:7].[ext]')
138
+ type: 'asset',
139
+ parser: {
140
+ dataUrlCondition: {
141
+ maxSize: 2 * 1024 //data转成url的条件,也就是转成bas64的条件,maxSize相当于limit
142
+ }
143
+ },
144
+ generator: {
145
+ // filename,和output中设置assetModuleFilename一样,将资源打包至imgs文件夹
146
+ filename: utils.assetsPath('media/[name].[hash:7][ext]') //[name]指原来的名字,[hash:6]取哈希的前六位,[ext]指原来的扩展名
136
147
  }
137
148
  },
138
149
  {
139
150
  // 字体资源
140
151
  test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
141
- loader: 'url-loader',
142
- options: {
143
- limit: 10000,
144
- name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
145
- }
146
- },
147
- {
148
- test: /\.(html)$/,
149
- use: {
150
- loader: 'html-loader'
152
+ type: 'asset',
153
+ parser: {
154
+ dataUrlCondition: {
155
+ maxSize: 2 * 1024 //data转成url的条件,也就是转成bas64的条件,maxSize相当于limit
156
+ }
157
+ },
158
+ generator: {
159
+ // filename,和output中设置assetModuleFilename一样,将资源打包至fonts目录中
160
+ filename: utils.assetsPath('fonts/[name].[hash:7][ext]') //[name]指原来的名字,[hash:6]取哈希的前六位,[ext]指原来的扩展名
151
161
  }
152
162
  },
153
163
  {
@@ -156,6 +166,16 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
156
166
  include: curProjectDir, // [resolve('src')],
157
167
  exclude: [/node_modules/, resolve('src/mock/data')], // 排除不需要进行校验的文件夹
158
168
  options: config.envParams
169
+ },
170
+ {
171
+ test: /\.(html)$/,
172
+ use: {
173
+ loader: 'html-loader',
174
+ options: {
175
+ minimize: true,
176
+ sources: false // Enables/Disables sources handling
177
+ }
178
+ }
159
179
  }
160
180
  ]
161
181
  },
@@ -166,7 +186,7 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
166
186
  }),
167
187
  // 请确保引入这个插件来施展魔法
168
188
  new VueLoaderPlugin(),
169
- new FriendlyErrorsPlugin(),
189
+ // new FriendlyErrorsPlugin(),
170
190
  new ProgressBarPlugin()
171
191
  ]
172
192
  };
@@ -218,47 +238,42 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
218
238
  // 是否开启ESLint
219
239
  if (config.settings.enableESLint) {
220
240
  // ts类型
221
- webpackConfig.module.rules.push({
222
- test: /\.tsx?$/,
223
- loader: 'eslint-loader',
224
- enforce: 'pre',
225
- include: curProjectDir, // [resolve('src')],
226
- exclude: /node_modules/,
227
- options: {
241
+ webpackConfig.plugins.push(
242
+ new ESLintPlugin({
243
+ // context: resolve('src'),
244
+ extensions: ['ts', 'tsx'],
245
+ // include: curProjectDir, // [resolve('src')],
246
+ exclude: 'node_modules',
228
247
  cache: true,
229
248
  fix: config.settings.enableESLintFix || false,
230
249
  formatter: require('eslint-friendly-formatter'),
231
- configFile: path.resolve(__dirname, '../config/.eslintrc.ts.js')
232
- }
233
- });
250
+ overrideConfigFile: path.resolve(__dirname, '../config/.eslintrc.ts.js')
251
+ })
252
+ );
234
253
  // 通用js类型
235
- webpackConfig.module.rules.push({
236
- test: /\.jsx?$/,
237
- loader: 'eslint-loader',
238
- enforce: 'pre',
239
- include: curProjectDir, // [resolve('src')],
240
- exclude: /node_modules/,
241
- options: {
242
- cache: true, // the cache is written to the ./node_modules/.cache/eslint-loader director
254
+ webpackConfig.plugins.push(
255
+ new ESLintPlugin({
256
+ extensions: ['js', 'jsx'],
257
+ // include: curProjectDir, // [resolve('src')],
258
+ exclude: 'node_modules',
259
+ cache: true,
243
260
  fix: config.settings.enableESLintFix || false,
244
261
  formatter: require('eslint-friendly-formatter'),
245
- configFile: path.resolve(__dirname, '../config/.eslintrc.js')
246
- }
247
- });
262
+ overrideConfigFile: path.resolve(__dirname, '../config/.eslintrc.js')
263
+ })
264
+ );
248
265
  // vue单文件类型
249
- webpackConfig.module.rules.push({
250
- test: /\.vue$/,
251
- loader: 'eslint-loader',
252
- enforce: 'pre',
253
- include: curProjectDir, // [resolve('src')],
254
- exclude: /node_modules/,
255
- options: {
266
+ webpackConfig.plugins.push(
267
+ new ESLintPlugin({
268
+ extensions: ['vue'],
269
+ // include: curProjectDir, // [resolve('src')],
270
+ exclude: 'node_modules',
256
271
  cache: true,
257
272
  fix: config.settings.enableESLintFix || false,
258
273
  formatter: require('eslint-friendly-formatter'),
259
- configFile: path.resolve(__dirname, '../config/.eslintrc.vue.js')
260
- }
261
- });
274
+ overrideConfigFile: path.resolve(__dirname, '../config/.eslintrc.vue.js')
275
+ })
276
+ );
262
277
  }
263
278
  // 是否开启StyleLint: 用于验证scss文件里面的style规范
264
279
  if (config.settings.enableStyleLint) {
@@ -269,7 +284,7 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
269
284
  webpackConfig.plugins.push(
270
285
  new StyleLintPlugin({
271
286
  files: ['src/**/*.vue'],
272
- quiet: true,
287
+ // quiet: true,
273
288
  cache: true,
274
289
  cacheLocation: resolveToCurrentRoot('./node_modules/stylelint/.vue-cache'),
275
290
  fix: config.settings.enableStyleLintFix,
@@ -281,7 +296,7 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
281
296
  webpackConfig.plugins.push(
282
297
  new StyleLintPlugin({
283
298
  files: 'src/**/*.s?(a|c)ss',
284
- quiet: true,
299
+ // quiet: true,
285
300
  cache: true,
286
301
  cacheLocation: resolveToCurrentRoot('./node_modules/stylelint/.cache'),
287
302
  fix: config.settings.enableStyleLintFix,
@@ -1,13 +1,13 @@
1
1
  const webpack = require('webpack');
2
2
  const path = require('path');
3
- const merge = require('webpack-merge');
3
+ const { merge } = require('webpack-merge');
4
4
  const utils = require('./loaderUtils');
5
5
  // 引入当前项目配置文件
6
6
  const projectConfig = require('../config/index');
7
7
  const getBaseWebpackConfig = require('./webpack.base.conf');
8
8
  const entrys2htmlWebpackPlugin = require('../utils/entrys2htmlWebpackPlugin');
9
9
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
10
- const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
10
+ // const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
11
11
 
12
12
  module.exports = (akfunConfig) => {
13
13
  let config = akfunConfig || projectConfig; // 默认使用执行命令目录下的配置数据
@@ -36,7 +36,8 @@ module.exports = (akfunConfig) => {
36
36
  devtool: curEnvConfig.productionSourceMap ? curEnvConfig.devtool || 'eval-source-map' : 'eval', // 开发环境
37
37
  optimization: {
38
38
  chunkIds: 'named', // named 对调试更友好的可读的 id。
39
- emitOnErrors: true
39
+ emitOnErrors: true,
40
+ minimize: false
40
41
  },
41
42
  plugins: [
42
43
  // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
@@ -46,11 +47,6 @@ module.exports = (akfunConfig) => {
46
47
  filename: '[name].css',
47
48
  chunkFilename: '[name].css',
48
49
  ignoreOrder: false
49
- }),
50
- new OptimizeCSSPlugin({
51
- cssProcessorOptions: {
52
- safe: true
53
- }
54
50
  })
55
51
  ]
56
52
  });
@@ -1,6 +1,6 @@
1
- const merge = require('webpack-merge');
2
- const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
1
+ const { merge } = require('webpack-merge');
3
2
  const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // 替换extract-text-webpack-plugin
3
+ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
4
4
  const CompressionWebpackPlugin = require('compression-webpack-plugin');
5
5
  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
6
6
 
@@ -41,7 +41,13 @@ module.exports = (akfunConfig) => {
41
41
  * deterministic 在不同的编译中不变的短数字 id。有益于长期缓存。在生产模式中会默认开启。
42
42
  */
43
43
  chunkIds: 'named',
44
- emitOnErrors: true
44
+ emitOnErrors: true,
45
+ minimize: true,
46
+ minimizer: [
47
+ // For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
48
+ `...`,
49
+ new CssMinimizerPlugin()
50
+ ]
45
51
  },
46
52
  plugins: [
47
53
  new MiniCssExtractPlugin({
@@ -49,11 +55,6 @@ module.exports = (akfunConfig) => {
49
55
  filename: '[name].css',
50
56
  chunkFilename: '[name].css',
51
57
  ignoreOrder: false
52
- }),
53
- new OptimizeCSSPlugin({
54
- cssProcessorOptions: {
55
- safe: true
56
- }
57
58
  })
58
59
  ]
59
60
  });
@@ -1,10 +1,10 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
- const merge = require('webpack-merge');
3
+ const { merge } = require('webpack-merge');
4
4
  const CopyWebpackPlugin = require('copy-webpack-plugin');
5
5
  // const ExtractTextPlugin = require('extract-text-webpack-plugin'); // 不支持webpack4.0
6
- const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
7
6
  const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // 替换extract-text-webpack-plugin
7
+ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
8
8
  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
9
9
  const CompressionWebpackPlugin = require('compression-webpack-plugin');
10
10
  const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
@@ -70,13 +70,19 @@ module.exports = (akfunConfig) => {
70
70
  reuseExistingChunk: true
71
71
  }
72
72
  }
73
- }
73
+ },
74
+ minimize: true,
75
+ minimizer: [
76
+ // For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
77
+ `...`,
78
+ new CssMinimizerPlugin()
79
+ ]
74
80
  },
75
81
  plugins: [
76
82
  new MiniCssExtractPlugin({
77
83
  filename: utils.assetsPath('css/[name].[contenthash:8].css'),
78
84
  ignoreOrder: false // Enable to remove warnings about conflicting order
79
- }),
85
+ })
80
86
  // Compress extracted CSS. We are using this plugin so that possible
81
87
  // duplicated CSS from different components can be deduped.
82
88
  /**
@@ -87,11 +93,6 @@ module.exports = (akfunConfig) => {
87
93
  * cssProcessorOptions:传递给cssProcessor的选项,默认为 {}
88
94
  * canPrint:一个布尔值,指示插件是否可以将消息打印到控制台,默认为 true
89
95
  */
90
- new OptimizeCSSPlugin({
91
- cssProcessorOptions: {
92
- safe: true
93
- }
94
- })
95
96
  ]
96
97
  });
97
98
 
@@ -1,47 +0,0 @@
1
- # Numerous always-ignore extensions
2
- *.bak
3
- *.patch
4
- *.diff
5
- *.err
6
-
7
- # temp file for git conflict merging
8
- *.orig
9
- *.log
10
- *.rej
11
- *.swo
12
- *.swp
13
- *.zip
14
- *.vi
15
- *~
16
- *.sass-cache
17
- *.tmp.html
18
- *.dump
19
-
20
- # OS or Editor folders
21
- .DS_Store
22
- ._*
23
- .cache
24
- .project
25
- .settings
26
- .tmproj
27
- *.esproj
28
- *.sublime-project
29
- *.sublime-workspace
30
- nbproject
31
- thumbs.db
32
- *.iml
33
- .vscode/
34
-
35
- # Folders to ignore
36
- .hg
37
- .svn
38
- .CVS
39
- .idea
40
- node_modules/
41
- jscoverage_lib/
42
- .svn
43
-
44
- # log files
45
- npm-debug.log*
46
- yarn-debug.log*
47
- yarn-error.log*