akfun 3.0.1 → 3.0.6
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 +4 -3
- package/src/initData/akfun-package-1.x.json +0 -2
- package/src/initData/akfun-package.json +0 -2
- package/src/utils/entrys2htmlWebpackPlugin.js +1 -1
- package/src/utils/gitClone.js +3 -3
- package/src/webpack/loaderUtils.js +14 -1
- package/src/webpack/webpack.base.conf.js +27 -12
- package/src/webpack/webpack.dev.conf.js +1 -1
- package/src/webpack/webpack.library.conf.js +7 -2
- package/src/webpack/webpack.prod.conf.js +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akfun",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"description": "前端脚手架:支持Vue技术栈和react技术栈",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"前端工程",
|
|
@@ -105,13 +105,14 @@
|
|
|
105
105
|
"express": "^4.17.2",
|
|
106
106
|
"figlet": "^1.5.2",
|
|
107
107
|
"file-loader": "^6.2.0",
|
|
108
|
-
"git-clone": "
|
|
108
|
+
"git-clone": "0.1.0",
|
|
109
109
|
"glob": "^7.2.0",
|
|
110
110
|
"html-loader": "^3.1.0",
|
|
111
111
|
"html-webpack-plugin": "^5.5.0",
|
|
112
112
|
"http-proxy-middleware": "^2.0.2",
|
|
113
113
|
"inquirer": "^8.2.0",
|
|
114
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
117
|
"sass": "^1.49.7",
|
|
117
118
|
"open": "^8.4.0",
|
|
@@ -153,7 +154,7 @@
|
|
|
153
154
|
"webpack-hot-middleware": "^2.25.1",
|
|
154
155
|
"webpack-merge": "^5.8.0",
|
|
155
156
|
"webpack-node-externals": "^3.0.0",
|
|
156
|
-
"yargs": "^
|
|
157
|
+
"yargs": "^12.0.5"
|
|
157
158
|
},
|
|
158
159
|
"devDependencies": {
|
|
159
160
|
"@commitlint/cli": "^16.1.0",
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"webpack-dev-middleware": "^3.7.2",
|
|
59
59
|
"webpack-hot-middleware": "^2.25.0",
|
|
60
60
|
"webpack-merge": "^4.2.2",
|
|
61
|
-
"url-loader": "^4.1.0",
|
|
62
61
|
"vue-loader": "^15.9.2",
|
|
63
62
|
"vue-style-loader": "^4.1.2",
|
|
64
63
|
"vue-template-compiler": "^2.6.11",
|
|
@@ -73,7 +72,6 @@
|
|
|
73
72
|
"http-proxy-middleware": "^1.0.4",
|
|
74
73
|
"autoprefixer": "^9.8.0",
|
|
75
74
|
"mini-css-extract-plugin": "^0.9.0",
|
|
76
|
-
"file-loader": "^6.0.0",
|
|
77
75
|
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
|
78
76
|
"params-replace-loader": "^1.1.6",
|
|
79
77
|
"progress-bar-webpack-plugin": "^2.1.0",
|
|
@@ -98,7 +98,6 @@
|
|
|
98
98
|
"eventsource-polyfill": "^0.9.6",
|
|
99
99
|
"express": "^4.17.2",
|
|
100
100
|
"figlet": "^1.5.2",
|
|
101
|
-
"file-loader": "^6.2.0",
|
|
102
101
|
"git-clone": "^0.2.0",
|
|
103
102
|
"glob": "^7.2.0",
|
|
104
103
|
"html-loader": "^3.1.0",
|
|
@@ -135,7 +134,6 @@
|
|
|
135
134
|
"ts-import-plugin": "^2.0.0",
|
|
136
135
|
"ts-loader": "^9.2.6",
|
|
137
136
|
"typescript": "^4.5.5",
|
|
138
|
-
"url-loader": "^4.1.1",
|
|
139
137
|
"vue-eslint-parser": "^8.2.0",
|
|
140
138
|
"vue-loader": "^15.9.8",
|
|
141
139
|
"vue-style-loader": "^4.1.3",
|
|
@@ -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:
|
|
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'
|
package/src/utils/gitClone.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const ora = require('ora');
|
|
3
|
-
const
|
|
3
|
+
const gitClone = require('git-clone');
|
|
4
4
|
const rm = require('rimraf').sync;
|
|
5
5
|
const { resolveToCurrentRoot } = require('../utils/pathUtils');
|
|
6
6
|
const {curConsoleTag} = require("./akfunParams");
|
|
@@ -8,7 +8,7 @@ const {curConsoleTag} = require("./akfunParams");
|
|
|
8
8
|
function _gitClone(gitUrl, dir, callback, _consoleTag) {
|
|
9
9
|
const consoleTag = _consoleTag || curConsoleTag;
|
|
10
10
|
const spinner = ora(`${consoleTag}正在加载项目模板...`).start();
|
|
11
|
-
|
|
11
|
+
gitClone(
|
|
12
12
|
gitUrl,
|
|
13
13
|
resolveToCurrentRoot(dir),
|
|
14
14
|
{
|
|
@@ -20,7 +20,7 @@ function _gitClone(gitUrl, dir, callback, _consoleTag) {
|
|
|
20
20
|
spinner.succeed(`${consoleTag}项目模板加载完成!`);
|
|
21
21
|
callback();
|
|
22
22
|
} else {
|
|
23
|
-
|
|
23
|
+
spinner.fail(err);
|
|
24
24
|
callback(err);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -36,7 +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
|
|
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
|
+
},
|
|
40
53
|
sourceMap: options.sourceMap
|
|
41
54
|
}
|
|
42
55
|
};
|
|
@@ -121,28 +121,43 @@ module.exports = (_curEnvConfig, _akfunConfig) => {
|
|
|
121
121
|
url-loader 功能类似于 file-loader,在文件大小(单位 byte)低于指定的限制时,可以返回一个 DataURL。
|
|
122
122
|
*/
|
|
123
123
|
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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]指原来的扩展名
|
|
128
133
|
}
|
|
129
134
|
},
|
|
130
135
|
{
|
|
131
136
|
// 视频音频资源
|
|
132
137
|
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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]指原来的扩展名
|
|
137
147
|
}
|
|
138
148
|
},
|
|
139
149
|
{
|
|
140
150
|
// 字体资源
|
|
141
151
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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]指原来的扩展名
|
|
146
161
|
}
|
|
147
162
|
},
|
|
148
163
|
{
|
|
@@ -7,7 +7,7 @@ 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
|
|
10
|
+
// const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
|
|
11
11
|
|
|
12
12
|
module.exports = (akfunConfig) => {
|
|
13
13
|
let config = akfunConfig || projectConfig; // 默认使用执行命令目录下的配置数据
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { merge } = require('webpack-merge');
|
|
2
|
-
// const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
|
|
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
|
|
|
@@ -42,7 +42,12 @@ module.exports = (akfunConfig) => {
|
|
|
42
42
|
*/
|
|
43
43
|
chunkIds: 'named',
|
|
44
44
|
emitOnErrors: true,
|
|
45
|
-
minimize: 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
|
+
]
|
|
46
51
|
},
|
|
47
52
|
plugins: [
|
|
48
53
|
new MiniCssExtractPlugin({
|
|
@@ -3,8 +3,8 @@ const path = require('path');
|
|
|
3
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');
|
|
@@ -71,7 +71,12 @@ module.exports = (akfunConfig) => {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
|
-
minimize: true
|
|
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
|
+
]
|
|
75
80
|
},
|
|
76
81
|
plugins: [
|
|
77
82
|
new MiniCssExtractPlugin({
|