Browse Source

chore: update publish scripts

pull/1344/head
Benjy Cui 9 years ago
parent
commit
61f93ed521
  1. 4
      package.json
  2. 18
      webpack.config.js

4
package.json

@ -27,6 +27,8 @@
},
"main": "lib/index",
"files": [
"dist",
"!dist/common.js",
"lib",
"style"
],
@ -125,7 +127,7 @@
"dora": "ANTD=WEBSITE dora -p 8001 --plugins webpack?disableNpmInstall,hmr",
"start": "npm run clean-build && npm run dora",
"copy-html": "cp ./index.html ./_site/index.html && mkdir ./_site/_site && mv ./_site/demo-* ./_site/_site",
"site": "npm run clean-build && ANTD=WEBSITE atool-build -o ./_site && npm run copy-html && ANTD=PRODUCTION atool-build && cp -R dist _site/dist",
"site": "npm run clean-build && ANTD=WEBSITE atool-build -o ./_site && npm run copy-html",
"deploy": "rm -rf node_modules && node scripts/install.js && npm run just-deploy",
"just-deploy": "npm run site && node scripts/deploy.js",
"lint": "npm run srclint && npm run demolint && npm run lesshint",

18
webpack.config.js

@ -1,3 +1,5 @@
const webpack = require('atool-build/lib/webpack');
module.exports = function(webpackConfig) {
if (process.env.ANTD === 'WEBSITE') {
webpackConfig.entry = {
@ -11,8 +13,9 @@ module.exports = function(webpackConfig) {
}
if (process.env.ANTD === 'PRODUCTION') {
const entry = ['./style/index.less', './index.js'];
webpackConfig.entry = {
'antd': ['./style/index.less', './index.js']
'antd.min': entry,
};
webpackConfig.externals = {
'react': {
@ -30,6 +33,19 @@ module.exports = function(webpackConfig) {
};
webpackConfig.output.library = 'antd';
webpackConfig.output.libraryTarget = 'umd';
const uncompressedWebpackConfig = Object.assign({}, webpackConfig);
uncompressedWebpackConfig.entry = {
antd: entry,
};
uncompressedWebpackConfig.plugins = webpackConfig.plugins.filter((plugin) => {
return !(plugin instanceof webpack.optimize.UglifyJsPlugin);
});
return [
webpackConfig,
uncompressedWebpackConfig,
];
}
return webpackConfig;

Loading…
Cancel
Save