update release scripts

This commit is contained in:
afc163 2015-07-21 12:02:15 +08:00
parent 113da093d2
commit 68a6b221c5
4 changed files with 34 additions and 3 deletions

View File

@ -59,8 +59,8 @@ $ npm start
$ npm run deploy
```
#### 构建
#### 发布
```bash
$ npm run build
$ npm run release
```

View File

@ -77,8 +77,9 @@
"babel": "babel components --out-dir lib",
"build": "npm run clean && webpack && nico build",
"pack": "npm run clean && webpack --optimize-minimize && nico build",
"release": "npm run clean && webpack --config webpack.config.production.js && webpack --config webpack.config.min.js && zip dist/${npm_package_name}-${npm_package_version}.zip -j dist dist/*",
"start": "npm run clean && nico server --watch",
"clean": "rm -rf _site",
"clean": "rm -rf _site dist",
"deploy": "rm -rf node_modules && node scripts/install.js && npm run pack && node scripts/deploy.js",
"lint": "eslint components index.js --ext '.js,.jsx'",
"test": "webpack && npm run lint",

16
webpack.config.min.js vendored Normal file
View File

@ -0,0 +1,16 @@
// webpack.config.min.js
// release min dist files
var pkg = require('./package');
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var config = require("./webpack.config.js");
config.plugins = [
new ExtractTextPlugin('[name].min.css'),
new webpack.optimize.UglifyJsPlugin()
];
config.output.filename = config.output.filename.replace(/\.js$/, ".min.js");
delete config.entry.demo;
delete config.entry[pkg.name];
module.exports = config;

View File

@ -0,0 +1,14 @@
// webpack.config.production.js
// release full dist files
var pkg = require('./package');
var webpack = require("webpack");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var config = require("./webpack.config.js");
config.plugins = [
new ExtractTextPlugin('[name].css')
];
delete config.entry.demo;
delete config.entry[pkg.name];
module.exports = config;