akfun 2.0.6 → 3.0.2

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.6",
3
+ "version": "3.0.2",
4
4
  "description": "前端脚手架:支持Vue技术栈和react技术栈",
5
5
  "keywords": [
6
6
  "前端工程",
@@ -44,124 +44,123 @@
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
115
  "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",
116
+ "sass": "^1.49.7",
117
+ "open": "^8.4.0",
119
118
  "ora": "^4.0.4",
120
119
  "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",
120
+ "portfinder": "^1.0.28",
121
+ "postcss-loader": "^6.2.1",
122
+ "postcss-nested": "^5.0.6",
123
+ "postcss-preset-env": "^7.3.1",
124
+ "postcss-simple-vars": "^6.0.3",
126
125
  "progress-bar-webpack-plugin": "^2.1.0",
127
- "qs": "^6.9.4",
126
+ "qs": "^6.10.3",
128
127
  "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",
128
+ "rollup": "^2.67.0",
129
+ "rollup-plugin-postcss": "^4.0.2",
130
+ "rollup-plugin-terser": "^7.0.2",
131
+ "rollup-plugin-vue": "^6.0.0",
132
+ "sass-loader": "^12.4.0",
133
+ "sass-resources-loader": "^2.2.4",
134
+ "semver": "^7.3.5",
135
+ "shelljs": "^0.8.5",
136
+ "string-replace-loader": "^3.1.0",
137
+ "style-loader": "^3.3.1",
138
+ "stylelint": "^14.3.0",
139
+ "stylelint-config-standard": "^24.0.0",
140
+ "stylelint-webpack-plugin": "^3.1.1",
141
+ "ts-import-plugin": "^2.0.0",
142
+ "ts-loader": "^9.2.6",
143
+ "typescript": "^4.5.5",
144
+ "url-loader": "^4.1.1",
145
+ "vue-eslint-parser": "^8.2.0",
146
+ "vue-loader": "^15.9.8",
147
+ "vue-style-loader": "^4.1.3",
148
+ "vue-template-compiler": "^2.6.14",
149
+ "webpack": "^5.68.0",
150
+ "webpack-bundle-analyzer": "^4.5.0",
151
+ "webpack-cli": "^4.9.2",
152
+ "webpack-dev-middleware": "^5.3.1",
153
+ "webpack-hot-middleware": "^2.25.1",
154
+ "webpack-merge": "^5.8.0",
156
155
  "webpack-node-externals": "^3.0.0",
157
- "yargs": "^12.0.2"
156
+ "yargs": "^17.3.1"
158
157
  },
159
158
  "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"
159
+ "@commitlint/cli": "^16.1.0",
160
+ "@commitlint/config-conventional": "^16.0.0",
161
+ "husky": "^4.3.8",
162
+ "lint-staged": "^12.3.3",
163
+ "prettier": "^2.5.1"
165
164
  },
166
165
  "engines": {
167
166
  "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) => {
@@ -125,9 +126,9 @@ module.exports = function (akfunConfig, _consoleTag) {
125
126
  // 获取第一个入口文件
126
127
  const filename = entryFiles[0];
127
128
  console.info(
128
- `当前运行脚本:\n ${projPath}${filename}.html\n当前运行样式[可能不存在]:\n${projPath}${filename}.css`
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,140 @@
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
+ "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",
67
+ "connect-history-api-fallback": "^1.6.0",
68
+ "copy-webpack-plugin": "^6.0.2",
69
+ "css-loader": "^3.5.3",
70
+ "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",
78
+ "params-replace-loader": "^1.1.6",
79
+ "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"
120
+ },
121
+ "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"
127
+ },
128
+ "engines": {
129
+ "node": ">= 10.13.0",
130
+ "npm": ">= 6.4.1"
131
+ },
132
+ "browserslist": [
133
+ "> 1%",
134
+ "last 2 versions",
135
+ "not ie <= 8",
136
+ "iOS >= 8",
137
+ "Firefox >= 20",
138
+ "Android > 4.4"
139
+ ]
140
+ }
@@ -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,123 @@
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
+ "file-loader": "^6.2.0",
102
+ "git-clone": "^0.2.0",
103
+ "glob": "^7.2.0",
104
+ "html-loader": "^3.1.0",
105
+ "html-webpack-plugin": "^5.5.0",
106
+ "http-proxy-middleware": "^2.0.2",
107
+ "inquirer": "^8.2.0",
108
+ "mini-css-extract-plugin": "^2.5.3",
109
+ "monaco-editor-webpack-plugin": "6.0.0",
110
+ "sass": "^1.49.7",
111
+ "open": "^8.4.0",
112
+ "ora": "^4.0.4",
78
113
  "params-replace-loader": "^1.1.6",
114
+ "portfinder": "^1.0.28",
115
+ "postcss-loader": "^6.2.1",
116
+ "postcss-nested": "^5.0.6",
117
+ "postcss-preset-env": "^7.3.1",
118
+ "postcss-simple-vars": "^6.0.3",
79
119
  "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"
120
+ "qs": "^6.10.3",
121
+ "rimraf": "^3.0.2",
122
+ "rollup": "^2.67.0",
123
+ "rollup-plugin-postcss": "^4.0.2",
124
+ "rollup-plugin-terser": "^7.0.2",
125
+ "rollup-plugin-vue": "^6.0.0",
126
+ "sass-loader": "^12.4.0",
127
+ "sass-resources-loader": "^2.2.4",
128
+ "semver": "^7.3.5",
129
+ "shelljs": "^0.8.5",
130
+ "string-replace-loader": "^3.1.0",
131
+ "style-loader": "^3.3.1",
132
+ "stylelint": "^14.3.0",
133
+ "stylelint-config-standard": "^24.0.0",
134
+ "stylelint-webpack-plugin": "^3.1.1",
135
+ "ts-import-plugin": "^2.0.0",
136
+ "ts-loader": "^9.2.6",
137
+ "typescript": "^4.5.5",
138
+ "url-loader": "^4.1.1",
139
+ "vue-eslint-parser": "^8.2.0",
140
+ "vue-loader": "^15.9.8",
141
+ "vue-style-loader": "^4.1.3",
142
+ "vue-template-compiler": "^2.6.14",
143
+ "webpack": "^5.68.0",
144
+ "webpack-bundle-analyzer": "^4.5.0",
145
+ "webpack-cli": "^4.9.2",
146
+ "webpack-dev-middleware": "^5.3.1",
147
+ "webpack-hot-middleware": "^2.25.1",
148
+ "webpack-merge": "^5.8.0",
149
+ "webpack-node-externals": "^3.0.0",
150
+ "yargs": "^17.3.1"
120
151
  },
121
152
  "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"
153
+ "@commitlint/cli": "^16.1.0",
154
+ "@commitlint/config-conventional": "^16.0.0",
155
+ "husky": "^4.3.8",
156
+ "lint-staged": "^12.3.3",
157
+ "prettier": "^2.5.1"
127
158
  },
128
159
  "engines": {
129
160
  "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,7 @@ 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
39
40
  sourceMap: options.sourceMap
40
41
  }
41
42
  };
@@ -56,7 +57,7 @@ exports.cssLoaders = function (options) {
56
57
  {
57
58
  loader: MiniCssExtractPlugin.loader,
58
59
  options: {
59
- esModule: true
60
+ esModule: false // enable a CommonJS syntax using
60
61
  }
61
62
  },
62
63
  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');
@@ -144,18 +145,22 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
144
145
  name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
145
146
  }
146
147
  },
147
- {
148
- test: /\.(html)$/,
149
- use: {
150
- loader: 'html-loader'
151
- }
152
- },
153
148
  {
154
149
  test: /\.(js|ts|tsx|jsx|vue|css|html)$/,
155
150
  loader: 'params-replace-loader',
156
151
  include: curProjectDir, // [resolve('src')],
157
152
  exclude: [/node_modules/, resolve('src/mock/data')], // 排除不需要进行校验的文件夹
158
153
  options: config.envParams
154
+ },
155
+ {
156
+ test: /\.(html)$/,
157
+ use: {
158
+ loader: 'html-loader',
159
+ options: {
160
+ minimize: true,
161
+ sources: false // Enables/Disables sources handling
162
+ }
163
+ }
159
164
  }
160
165
  ]
161
166
  },
@@ -166,7 +171,7 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
166
171
  }),
167
172
  // 请确保引入这个插件来施展魔法
168
173
  new VueLoaderPlugin(),
169
- new FriendlyErrorsPlugin(),
174
+ // new FriendlyErrorsPlugin(),
170
175
  new ProgressBarPlugin()
171
176
  ]
172
177
  };
@@ -218,47 +223,42 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
218
223
  // 是否开启ESLint
219
224
  if (config.settings.enableESLint) {
220
225
  // 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: {
226
+ webpackConfig.plugins.push(
227
+ new ESLintPlugin({
228
+ // context: resolve('src'),
229
+ extensions: ['ts', 'tsx'],
230
+ // include: curProjectDir, // [resolve('src')],
231
+ exclude: 'node_modules',
228
232
  cache: true,
229
233
  fix: config.settings.enableESLintFix || false,
230
234
  formatter: require('eslint-friendly-formatter'),
231
- configFile: path.resolve(__dirname, '../config/.eslintrc.ts.js')
232
- }
233
- });
235
+ overrideConfigFile: path.resolve(__dirname, '../config/.eslintrc.ts.js')
236
+ })
237
+ );
234
238
  // 通用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
239
+ webpackConfig.plugins.push(
240
+ new ESLintPlugin({
241
+ extensions: ['js', 'jsx'],
242
+ // include: curProjectDir, // [resolve('src')],
243
+ exclude: 'node_modules',
244
+ cache: true,
243
245
  fix: config.settings.enableESLintFix || false,
244
246
  formatter: require('eslint-friendly-formatter'),
245
- configFile: path.resolve(__dirname, '../config/.eslintrc.js')
246
- }
247
- });
247
+ overrideConfigFile: path.resolve(__dirname, '../config/.eslintrc.js')
248
+ })
249
+ );
248
250
  // 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: {
251
+ webpackConfig.plugins.push(
252
+ new ESLintPlugin({
253
+ extensions: ['vue'],
254
+ // include: curProjectDir, // [resolve('src')],
255
+ exclude: 'node_modules',
256
256
  cache: true,
257
257
  fix: config.settings.enableESLintFix || false,
258
258
  formatter: require('eslint-friendly-formatter'),
259
- configFile: path.resolve(__dirname, '../config/.eslintrc.vue.js')
260
- }
261
- });
259
+ overrideConfigFile: path.resolve(__dirname, '../config/.eslintrc.vue.js')
260
+ })
261
+ );
262
262
  }
263
263
  // 是否开启StyleLint: 用于验证scss文件里面的style规范
264
264
  if (config.settings.enableStyleLint) {
@@ -269,7 +269,7 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
269
269
  webpackConfig.plugins.push(
270
270
  new StyleLintPlugin({
271
271
  files: ['src/**/*.vue'],
272
- quiet: true,
272
+ // quiet: true,
273
273
  cache: true,
274
274
  cacheLocation: resolveToCurrentRoot('./node_modules/stylelint/.vue-cache'),
275
275
  fix: config.settings.enableStyleLintFix,
@@ -281,7 +281,7 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
281
281
  webpackConfig.plugins.push(
282
282
  new StyleLintPlugin({
283
283
  files: 'src/**/*.s?(a|c)ss',
284
- quiet: true,
284
+ // quiet: true,
285
285
  cache: true,
286
286
  cacheLocation: resolveToCurrentRoot('./node_modules/stylelint/.cache'),
287
287
  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 OptimizeCSSPlugin = require('optimize-css-assets-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,5 +1,5 @@
1
- const merge = require('webpack-merge');
2
- const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
1
+ const { merge } = require('webpack-merge');
2
+ // const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
3
3
  const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // 替换extract-text-webpack-plugin
4
4
  const CompressionWebpackPlugin = require('compression-webpack-plugin');
5
5
  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
@@ -41,7 +41,8 @@ module.exports = (akfunConfig) => {
41
41
  * deterministic 在不同的编译中不变的短数字 id。有益于长期缓存。在生产模式中会默认开启。
42
42
  */
43
43
  chunkIds: 'named',
44
- emitOnErrors: true
44
+ emitOnErrors: true,
45
+ minimize: true
45
46
  },
46
47
  plugins: [
47
48
  new MiniCssExtractPlugin({
@@ -49,11 +50,6 @@ module.exports = (akfunConfig) => {
49
50
  filename: '[name].css',
50
51
  chunkFilename: '[name].css',
51
52
  ignoreOrder: false
52
- }),
53
- new OptimizeCSSPlugin({
54
- cssProcessorOptions: {
55
- safe: true
56
- }
57
53
  })
58
54
  ]
59
55
  });
@@ -1,9 +1,9 @@
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');
6
+ // const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
7
7
  const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // 替换extract-text-webpack-plugin
8
8
  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
9
9
  const CompressionWebpackPlugin = require('compression-webpack-plugin');
@@ -70,13 +70,14 @@ module.exports = (akfunConfig) => {
70
70
  reuseExistingChunk: true
71
71
  }
72
72
  }
73
- }
73
+ },
74
+ minimize: true
74
75
  },
75
76
  plugins: [
76
77
  new MiniCssExtractPlugin({
77
78
  filename: utils.assetsPath('css/[name].[contenthash:8].css'),
78
79
  ignoreOrder: false // Enable to remove warnings about conflicting order
79
- }),
80
+ })
80
81
  // Compress extracted CSS. We are using this plugin so that possible
81
82
  // duplicated CSS from different components can be deduped.
82
83
  /**
@@ -87,11 +88,6 @@ module.exports = (akfunConfig) => {
87
88
  * cssProcessorOptions:传递给cssProcessor的选项,默认为 {}
88
89
  * canPrint:一个布尔值,指示插件是否可以将消息打印到控制台,默认为 true
89
90
  */
90
- new OptimizeCSSPlugin({
91
- cssProcessorOptions: {
92
- safe: true
93
- }
94
- })
95
91
  ]
96
92
  });
97
93
 
@@ -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*