ko 5.3.5 → 5.3.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/lib/actions/build.js +5 -1
- package/lib/webpack/loaders/script.js +10 -3
- package/package.json +1 -2
- package/scripts/preinstall.js +0 -52
package/lib/actions/build.js
CHANGED
|
@@ -26,7 +26,7 @@ class Build extends creator_1.WebpackCreator {
|
|
|
26
26
|
},
|
|
27
27
|
plugins: [
|
|
28
28
|
new webpack_1.default.optimize.SplitChunksPlugin({
|
|
29
|
-
chunks: '
|
|
29
|
+
chunks: 'all',
|
|
30
30
|
minSize: 30000,
|
|
31
31
|
maxSize: 600000,
|
|
32
32
|
minChunks: 1,
|
|
@@ -34,6 +34,10 @@ class Build extends creator_1.WebpackCreator {
|
|
|
34
34
|
maxInitialRequests: 3,
|
|
35
35
|
automaticNameDelimiter: '_',
|
|
36
36
|
cacheGroups: {
|
|
37
|
+
baseCommon: {
|
|
38
|
+
test: new RegExp(`[\\\/]node_modules[\\\/](${['react', 'react-router', 'react-dom', 'react-redux', 'redux', 'react-router-redux', 'lodash'].join('|')})`),
|
|
39
|
+
priority: 1
|
|
40
|
+
},
|
|
37
41
|
antd: {
|
|
38
42
|
name: 'antd',
|
|
39
43
|
test: /[\\/]node_modules[\\/]antd[\\/]/,
|
|
@@ -17,9 +17,16 @@ const scriptLoader = [
|
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
test: /\.(t|j)sx?$/,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
include: (input) => {
|
|
21
|
+
if (input.includes('node_modules/dt-common/src/')) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
else if (input.includes('node_modules')) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
23
30
|
},
|
|
24
31
|
use: [
|
|
25
32
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ko",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.6",
|
|
4
4
|
"description": "build & lint library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ko",
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
"node": ">=10.13.0"
|
|
87
87
|
},
|
|
88
88
|
"scripts": {
|
|
89
|
-
"preinstall": "node scripts/preinstall.js",
|
|
90
89
|
"debug": "tsc -w --sourceMap",
|
|
91
90
|
"test": "jest",
|
|
92
91
|
"build": "tsc"
|
package/scripts/preinstall.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-octal-escape */
|
|
2
|
-
/**
|
|
3
|
-
* @link https://github.com/DTStack/devops/blob/main/force-using-yarn-and-lock-version/preinstall.js
|
|
4
|
-
*/
|
|
5
|
-
let err = false;
|
|
6
|
-
|
|
7
|
-
const LOCK_NODE_VERSION = true;
|
|
8
|
-
const LOCK_YARN_VERSION = false;
|
|
9
|
-
const FORCE_YARN_INSTALL = false;
|
|
10
|
-
|
|
11
|
-
if (LOCK_NODE_VERSION) {
|
|
12
|
-
const majorAndMinorNodeVersion = Number(
|
|
13
|
-
/(\d+).(\d+)/.exec(process.versions.node)[0]
|
|
14
|
-
);
|
|
15
|
-
/**
|
|
16
|
-
* webpack minor support version
|
|
17
|
-
* @link https://webpack.js.org/migrate/5/#preparations
|
|
18
|
-
*/
|
|
19
|
-
const webpack5SupportLeastVersion = 10.13;
|
|
20
|
-
|
|
21
|
-
if (majorAndMinorNodeVersion < webpack5SupportLeastVersion) {
|
|
22
|
-
console.error(
|
|
23
|
-
'\033[1;31m*** Webpack 5 requires at least Node.js 10.13.0 (LTS), please make sure you upgrade your Node.js.\033[0;0m'
|
|
24
|
-
);
|
|
25
|
-
err = true;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (LOCK_YARN_VERSION) {
|
|
30
|
-
const cp = require('child_process');
|
|
31
|
-
const yarnVersion = cp.execSync('yarn -v', { encoding: 'utf8' }).trim();
|
|
32
|
-
const parsedYarnVersion = /^(\d+)\.(\d+)\./.exec(yarnVersion);
|
|
33
|
-
const majorYarnVersion = parseInt(parsedYarnVersion[1]);
|
|
34
|
-
const minorYarnVersion = parseInt(parsedYarnVersion[2]);
|
|
35
|
-
|
|
36
|
-
if (majorYarnVersion < 1 || minorYarnVersion < 10) {
|
|
37
|
-
console.error('\033[1;31m*** Please use yarn >=1.10.1.\033[0;0m');
|
|
38
|
-
err = true;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (FORCE_YARN_INSTALL) {
|
|
43
|
-
// eslint-disable-next-line dot-notation
|
|
44
|
-
if (!/yarn[\w-.]*\.js$|yarnpkg$/.test(process.env['npm_execpath'])) {
|
|
45
|
-
console.error(
|
|
46
|
-
'\033[1;31m*** Please use yarn to install dependencies.\033[0;0m'
|
|
47
|
-
);
|
|
48
|
-
err = true;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
err && process.exit(1);
|