chore: update publish scripts

This commit is contained in:
Benjy Cui 2016-04-06 18:07:54 +08:00
parent fd850b9607
commit 61f93ed521
2 changed files with 20 additions and 2 deletions

View File

@ -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",

View File

@ -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;