@autobest-ui/scripts 1.0.3 → 1.1.0
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/common/appConfig.js
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
1
2
|
const { getProjectPath } = require('./utils');
|
|
2
3
|
|
|
4
|
+
let pkgInfo = {
|
|
5
|
+
name: 'ui',
|
|
6
|
+
version: '1.0.0'
|
|
7
|
+
};
|
|
8
|
+
try {
|
|
9
|
+
const pkgPath = getProjectPath('/package.json');
|
|
10
|
+
const pkgStr = fs.readFileSync(pkgPath);
|
|
11
|
+
pkgInfo = JSON.parse(pkgStr);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
// eslint-disable-next-line no-console
|
|
14
|
+
console.warn('The current project does not have a package.json file or content error!!!');
|
|
15
|
+
}
|
|
16
|
+
|
|
3
17
|
const configPath = getProjectPath('/config/app.config.js');
|
|
4
18
|
|
|
5
19
|
const config = require(configPath);
|
|
6
20
|
|
|
7
21
|
module.exports = {
|
|
22
|
+
projectName: pkgInfo.name,
|
|
23
|
+
projectVersion: pkgInfo.version,
|
|
8
24
|
startDefaultPort: 3030,
|
|
9
25
|
startEntry: '/src/index.tsx',
|
|
10
26
|
...config
|
package/common/webpack.common.js
CHANGED
|
@@ -88,6 +88,20 @@ module.exports = (appConfig, extendEnv, { isProd, isServer, isHotServer }) => {
|
|
|
88
88
|
output: {
|
|
89
89
|
publicPath: '/'
|
|
90
90
|
},
|
|
91
|
+
cache: {
|
|
92
|
+
type: 'filesystem',
|
|
93
|
+
version: `${appConfig.projectName}_${isProd ? '1' : '0'}${isServer ? '1' : '0'}${isHotServer ? '1' : '0'}_${
|
|
94
|
+
appConfig.projectVersion
|
|
95
|
+
}`,
|
|
96
|
+
store: 'pack',
|
|
97
|
+
buildDependencies: {
|
|
98
|
+
defaultWebpack: ['webpack/lib/'],
|
|
99
|
+
config: [__filename]
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
infrastructureLogging: {
|
|
103
|
+
level: 'none'
|
|
104
|
+
},
|
|
91
105
|
// 配置各种loader
|
|
92
106
|
module: {
|
|
93
107
|
// 警告替换为Error
|
|
@@ -205,8 +219,11 @@ module.exports = (appConfig, extendEnv, { isProd, isServer, isHotServer }) => {
|
|
|
205
219
|
plugins: [
|
|
206
220
|
new webpack.DefinePlugin(extendEnv.stringified),
|
|
207
221
|
new ESLintPlugin({
|
|
222
|
+
exclude: 'node_modules',
|
|
223
|
+
threads: 4,
|
|
208
224
|
failOnError: false,
|
|
209
|
-
|
|
225
|
+
lintDirtyModulesOnly: isProd,
|
|
226
|
+
extensions: ['tsx', 'ts', 'js']
|
|
210
227
|
}),
|
|
211
228
|
new ProgressBarPlugin({
|
|
212
229
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -218,7 +235,6 @@ module.exports = (appConfig, extendEnv, { isProd, isServer, isHotServer }) => {
|
|
|
218
235
|
if (isProd && !isServer) {
|
|
219
236
|
result.optimization = {
|
|
220
237
|
chunkIds: 'named',
|
|
221
|
-
moduleIds: 'named',
|
|
222
238
|
minimize: true
|
|
223
239
|
};
|
|
224
240
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autobest-ui/scripts",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "utils for project tools",
|
|
6
6
|
"bin": {
|
|
@@ -86,10 +86,11 @@
|
|
|
86
86
|
"sass-loader": "12.6.0",
|
|
87
87
|
"style-loader": "3.3.1",
|
|
88
88
|
"terser-webpack-plugin": "5.3.1",
|
|
89
|
+
"ts-node": "9.1.1",
|
|
89
90
|
"webpack": "5.70.0",
|
|
90
91
|
"webpack-dev-server": "4.7.4",
|
|
91
92
|
"webpack-merge": "5.8.0",
|
|
92
93
|
"webpack-node-externals": "3.0.0"
|
|
93
94
|
},
|
|
94
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "54fc1daf543e5e91f26409cf62e1a9edec3e4196"
|
|
95
96
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const webpack = require('webpack');
|
|
1
2
|
const nodeExternals = require('webpack-node-externals');
|
|
2
3
|
const { merge } = require('webpack-merge');
|
|
3
4
|
const { getProjectPath } = require('../common/utils');
|
|
@@ -44,6 +45,8 @@ module.exports = function (appConfig, extendEnv) {
|
|
|
44
45
|
}
|
|
45
46
|
]
|
|
46
47
|
},
|
|
48
|
+
// 覆盖查找规则, 减少无用模块
|
|
49
|
+
plugins: [new webpack.ContextReplacementPlugin(/any-promise/)],
|
|
47
50
|
// 避免路径丢失
|
|
48
51
|
node: {
|
|
49
52
|
__filename: true,
|