Skip to content

Commit 6373100

Browse files
committed
chore: update dist script
1 parent 2bafbb1 commit 6373100

File tree

8 files changed

+51
-55
lines changed

8 files changed

+51
-55
lines changed

.antd-tools.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function finalizeDist() {
9696
`
9797
function getThemeVariables(options = {}) {
9898
let themeVar = {
99-
'hack': \`true;@import "\${require.resolve('antd/lib/style/color/colorPalette.less')}";\`,
99+
'hack': \`true;@import "\${require.resolve('ant-design-vue/lib/style/color/colorPalette.less')}";\`,
100100
...defaultTheme
101101
};
102102
if(options.dark) {

antd-tools/getWebpackConfig.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
88
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
99
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
1010
const CleanUpStatsPlugin = require('./utils/CleanUpStatsPlugin');
11+
const FilterWarningsPlugin = require('webpack-filter-warnings-plugin');
1112
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
1213

1314
const distFileBaseName = 'antd';
@@ -75,7 +76,7 @@ function getWebpackConfig(modules) {
7576
'readline',
7677
'repl',
7778
'tls',
78-
].reduce((acc, name) => Object.assign({}, acc, { [name]: false }), {}),
79+
].reduce((acc, name) => Object.assign({}, acc, { [name]: 'empty' }), {}),
7980
},
8081

8182
module: {
@@ -173,9 +174,9 @@ function getWebpackConfig(modules) {
173174
loader: 'less-loader',
174175
options: {
175176
lessOptions: {
176-
sourceMap: true,
177177
javascriptEnabled: true,
178178
},
179+
sourceMap: true,
179180
},
180181
},
181182
],
@@ -208,6 +209,12 @@ All rights reserved.
208209
color: '#2f54eb',
209210
}),
210211
new CleanUpStatsPlugin(),
212+
new FilterWarningsPlugin({
213+
// suppress conflicting order warnings from mini-css-extract-plugin.
214+
// ref: https://github.com/ant-design/ant-design/issues/14895
215+
// see https://github.com/webpack-contrib/mini-css-extract-plugin/issues/250
216+
exclude: /mini-css-extract-plugin[^]*Conflicting order between:/,
217+
}),
211218
],
212219
performance: {
213220
hints: false,
@@ -274,7 +281,7 @@ All rights reserved.
274281
return [prodConfig, uncompressedConfig];
275282
}
276283

277-
return config;
284+
return [config];
278285
}
279286

280287
getWebpackConfig.webpack = webpack;

components/progress/Line.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
2+
import { presetPrimaryColors } from '@ant-design/colors';
23
import { computed, defineComponent } from 'vue';
34
import type { Direction } from '../config-provider';
45
import PropTypes from '../_util/vue-types';
@@ -55,8 +56,8 @@ export const sortGradient = (gradients: StringGradients) => {
5556
*/
5657
export const handleGradient = (strokeColor: ProgressGradient, directionConfig: Direction) => {
5758
const {
58-
from = '#1890ff',
59-
to = '#1890ff',
59+
from = presetPrimaryColors.blue,
60+
to = presetPrimaryColors.blue,
6061
direction = directionConfig === 'rtl' ? 'to left' : 'to right',
6162
...rest
6263
} = strokeColor;

index-style-only.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
function pascalCase(name) {
2+
return name.charAt(0).toUpperCase() + name.slice(1).replace(/-(\w)/g, (m, n) => n.toUpperCase());
3+
}
4+
5+
// Just import style for https://github.com/ant-design/ant-design/issues/3745
6+
const req = require.context('./components', true, /^\.\/[^_][\w-]+\/style\/index\.tsx?$/);
7+
8+
req.keys().forEach(mod => {
9+
let v = req(mod);
10+
if (v && v.default) {
11+
v = v.default;
12+
}
13+
const match = mod.match(/^\.\/([^_][\w-]+)\/index\.tsx?$/);
14+
if (match && match[1]) {
15+
if (match[1] === 'message' || match[1] === 'notification') {
16+
// message & notification should not be capitalized
17+
exports[match[1]] = v;
18+
} else {
19+
exports[pascalCase(match[1])] = v;
20+
}
21+
}
22+
});
23+
24+
module.exports = exports;

index-with-locales.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
const antd = require('./components');
2-
const req = require.context('./components', true, /^\.\/locale-provider\/(?!__tests__).+_.+\.ts$/);
2+
3+
const req = require.context('./components', true, /^\.\/locale\/.+_.+\.tsx$/);
34

45
antd.locales = {};
56

67
req.keys().forEach(mod => {
7-
const match = mod.match(/\/([^/]+).ts$/);
8-
antd.locales[match[1]] = req(mod).default;
8+
const matches = mod.match(/\/([^/]+).tsx$/);
9+
antd.locales[matches[1]] = req(mod).default;
910
});
1011

1112
module.exports = antd;

index.js

+1-28
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,3 @@
1-
/* eslint no-console:0 */
2-
function camelCase(name) {
3-
return (
4-
name.charAt(0).toUpperCase() +
5-
name.slice(1).replace(/-(\w)/g, (m, n) => {
6-
return n.toUpperCase();
7-
})
8-
);
9-
}
10-
11-
// Just import style for https://github.com/ant-design/ant-design/issues/3745
12-
const req = require.context('./components', true, /^\.\/[^_][\w-]+\/style\/index\.tsx?$/);
13-
14-
req.keys().forEach(mod => {
15-
let v = req(mod);
16-
if (v && v.default) {
17-
v = v.default;
18-
}
19-
const match = mod.match(/^\.\/([^_][\w-]+)\/index\.tsx?$/);
20-
if (match && match[1]) {
21-
if (match[1] === 'message' || match[1] === 'notification') {
22-
// message & notification should not be capitalized
23-
exports[match[1]] = v;
24-
} else {
25-
exports[camelCase(match[1])] = v;
26-
}
27-
}
28-
});
1+
require('./index-style-only');
292

303
module.exports = require('./components');

package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@
151151
"date-fns": "^2.24.0",
152152
"diacritics": "^1.3.0",
153153
"docsearch.js": "^2.6.3",
154+
"duplicate-package-checker-webpack-plugin": "^3.0.0",
154155
"enquire-js": "^0.2.1",
155156
"esbuild": "~0.12.29",
157+
"esbuild-loader": "^2.18.0",
156158
"escape-html": "^1.0.3",
157159
"eslint": "^8.3.0",
158160
"eslint-config-prettier": "^8.0.0",
@@ -196,7 +198,7 @@
196198
"markdown-it-table-of-contents": "^0.5.2",
197199
"marked": "0.3.18",
198200
"merge2": "^1.2.1",
199-
"mini-css-extract-plugin": "^1.5.0",
201+
"mini-css-extract-plugin": "^2.4.5",
200202
"minimist": "^1.2.0",
201203
"mkdirp": "^0.5.1",
202204
"mockdate": "^2.0.2",
@@ -216,12 +218,14 @@
216218
"remark-parse": "^8.0.0",
217219
"remark-stringify": "^8.0.0",
218220
"remark-yaml-config": "^4.1.0",
221+
"remove-files-webpack-plugin": "^1.5.0",
219222
"reqwest": "^2.0.5",
220223
"rimraf": "^3.0.0",
221224
"rucksack-css": "^1.0.2",
222225
"selenium-server": "^3.0.1",
223226
"semver": "^7.0.0",
224227
"slash": "^3.0.0",
228+
"string-replace-loader": "^3.1.0",
225229
"style-loader": "^3.0.0",
226230
"stylelint": "^13.0.0",
227231
"stylelint-config-prettier": "^8.0.0",
@@ -257,12 +261,13 @@
257261
"webpack-bundle-analyzer": "^4.4.2",
258262
"webpack-cli": "^4.6.0",
259263
"webpack-dev-server": "^4.0.0",
264+
"webpack-filter-warnings-plugin": "^1.2.1",
260265
"webpack-merge": "^5.0.0",
261-
"webpackbar": "^5.0.0-3",
266+
"webpackbar": "^5.0.2",
262267
"xhr-mock": "^2.5.1"
263268
},
264269
"dependencies": {
265-
"@ant-design/colors": "^6.0.0",
270+
"@ant-design/colors": "^5.0.0",
266271
"@ant-design/icons-vue": "^6.0.0",
267272
"@babel/runtime": "^7.10.5",
268273
"@simonwep/pickr": "~1.8.0",

webpack.build.conf.js

-15
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack
77
const getWebpackConfig = require('./antd-tools/getWebpackConfig');
88
const darkVars = require('./scripts/dark-vars');
99
const compactVars = require('./scripts/compact-vars');
10-
1110
function injectLessVariables(config, variables) {
1211
(Array.isArray(config) ? config : [config]).forEach(conf => {
1312
conf.module.rules.forEach(rule => {
@@ -89,22 +88,8 @@ function processWebpackThemeConfig(themeConfig, theme, vars) {
8988
delete config.entry[entryName];
9089
});
9190

92-
// apply ${theme} less variables
93-
config.module.rules.forEach(rule => {
94-
// filter less rule
95-
if (rule.test instanceof RegExp && rule.test.test('.less')) {
96-
const lessRule = rule.use[rule.use.length - 1];
97-
if (lessRule.options.lessOptions) {
98-
lessRule.options.lessOptions.modifyVars = vars;
99-
} else {
100-
lessRule.options.modifyVars = vars;
101-
}
102-
}
103-
});
104-
10591
// apply ${theme} less variables
10692
injectLessVariables(config, vars);
107-
10893
// ignore emit ${theme} entry js & js.map file
10994
config.plugins.push(
11095
new RemovePlugin({

0 commit comments

Comments
 (0)