Skip to content

Commit

Permalink
chore: update publish scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
benjycui committed Apr 6, 2016
1 parent fd850b9 commit 61f93ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
},
"main": "lib/index",
"files": [
"dist",
"!dist/common.js",
"lib",
"style"
],
Expand Down Expand Up @@ -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",
Expand Down
18 changes: 17 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const webpack = require('atool-build/lib/webpack');

module.exports = function(webpackConfig) {
if (process.env.ANTD === 'WEBSITE') {
webpackConfig.entry = {
Expand All @@ -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': {
Expand All @@ -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;
Expand Down

0 comments on commit 61f93ed

Please sign in to comment.