Skip to content

Commit ef897e7

Browse files
committed
Merge remote-tracking branch 'origin/develop' into components/mdDatepicker
* origin/develop: include docs on lint process simplify build process and add support for tree shaking
2 parents 9c8ed80 + bec42aa commit ef897e7

File tree

10 files changed

+82
-58
lines changed

10 files changed

+82
-58
lines changed

.babelrc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
{
22
"presets": [
3-
"es2015",
4-
"es2017",
5-
"stage-0",
63
[
74
"env",
85
{
6+
"modules": false,
97
"targets": {
108
"browsers": ["last 3 versions", "not IE < 10"]
119
}
1210
}
1311
]
1412
],
1513
"plugins": [
16-
"transform-runtime",
17-
"add-module-exports"
14+
"add-module-exports",
15+
"transform-object-rest-spread"
1816
]
1917
}

build/server/build-docs.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1+
import ora from 'ora';
2+
import chalk from 'chalk';
13
import webpack from 'webpack';
2-
import build from './build';
34
import webpackConfig from '../webpack/prod-docs';
45

5-
webpack(webpackConfig, build);
6+
const spinner = ora(chalk.cyan('Building website'));
7+
8+
process.stdout.write('\n');
9+
spinner.start();
10+
11+
webpack(webpackConfig, (error, stats) => {
12+
if (error) {
13+
spinner.fail(chalk.red('Something wrong happened:\n'));
14+
15+
throw error;
16+
}
17+
18+
process.stdout.write('\n\n' + stats.toString({
19+
colors: true,
20+
modules: false,
21+
children: false,
22+
chunks: false,
23+
chunkModules: false
24+
}) + '\n\n');
25+
26+
spinner.succeed(chalk.green('Documentation builded with success!\n'));
27+
});

build/server/build-lib.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
1+
import ora from 'ora';
2+
import chalk from 'chalk';
13
import webpack from 'webpack';
2-
import build from './build';
34
import webpackConfig from '../webpack/prod-lib';
45
import webpackDebugConfig from '../webpack/debug-lib';
56

6-
webpack([webpackConfig, webpackDebugConfig], build);
7+
const spinner = ora(chalk.cyan('Building library'));
8+
9+
process.stdout.write('\n');
10+
spinner.start();
11+
12+
webpack([webpackConfig, webpackDebugConfig], (error, stats) => {
13+
if (error) {
14+
spinner.fail(chalk.red('Something wrong happened:\n'));
15+
16+
throw error;
17+
}
18+
19+
process.stdout.write('\n\n' + stats.toString({
20+
colors: true,
21+
modules: false,
22+
children: false,
23+
chunks: false,
24+
chunkModules: false
25+
}) + '\n\n');
26+
27+
spinner.succeed(chalk.green('Build finished with success!\n'));
28+
});

build/server/build.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

build/server/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import historyApiFallback from 'connect-history-api-fallback';
88
import config from '../config';
99
import webpackConfig from '../webpack/dev';
1010

11-
1211
const app = express();
1312
const compiler = webpack(webpackConfig);
1413
const rootPath = path.join(__dirname, '..', '..');

build/webpack/dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Object.keys(baseWebpackConfig.entry).forEach((name) => {
1010
});
1111

1212
export default merge(baseWebpackConfig, {
13-
devtool: 'cheap-module-eval-source-map',
13+
devtool: '#cheap-module-eval-source-map',
1414
module: {
1515
rules: [
1616
{

build/webpack/prod-docs.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,16 @@ const conf = merge(baseConfig, {
6767
}),
6868
new webpack.optimize.UglifyJsPlugin({
6969
compress: {
70-
warnings: false
70+
warnings: false,
71+
screw_ie8: true,
72+
conditionals: true,
73+
unused: true,
74+
comparisons: true,
75+
sequences: true,
76+
dead_code: true,
77+
evaluate: true,
78+
join_vars: true,
79+
if_return: true
7180
},
7281
output: {
7382
comments: false
@@ -134,7 +143,9 @@ const conf = merge(baseConfig, {
134143
name: 'manifest',
135144
chunks: ['vendor']
136145
}),
137-
new OptimizeCssAssetsPlugin()
146+
new OptimizeCssAssetsPlugin({
147+
canPrint: false
148+
})
138149
]
139150
});
140151

build/webpack/prod-lib.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,16 @@ export default merge(baseConfig, {
9393
}),
9494
new webpack.optimize.UglifyJsPlugin({
9595
compress: {
96-
warnings: false
96+
warnings: false,
97+
screw_ie8: true,
98+
conditionals: true,
99+
unused: true,
100+
comparisons: true,
101+
sequences: true,
102+
dead_code: true,
103+
evaluate: true,
104+
join_vars: true,
105+
if_return: true
97106
},
98107
output: {
99108
comments: false
@@ -113,6 +122,8 @@ export default merge(baseConfig, {
113122
entryOnly: true
114123
}),
115124
new ExtractTextPlugin('[name].css'),
116-
new OptimizeCssAssetsPlugin()
125+
new OptimizeCssAssetsPlugin({
126+
canPrint: false
127+
})
117128
]
118129
});

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"dev": "babel-node build/server/index.js --presets es2015,stage-0",
3636
"build:docs": "babel-node build/server/build-docs.js --presets es2015,stage-0",
3737
"build:lib": "babel-node build/server/build-lib.js --presets es2015,stage-0",
38-
"build": "rm -rf dist && npm run build:docs && npm run build:lib",
39-
"lint": "eslint --ext .js,.vue --fix src",
38+
"build": "rm -rf dist && yarn run build:docs && yarn run build:lib",
39+
"lint": "eslint --ext .js,.vue --fix src docs",
4040
"release": "bash build/release.sh"
4141
},
4242
"dependencies": {
@@ -50,10 +50,9 @@
5050
"babel-eslint": "^7.1.1",
5151
"babel-loader": "^6.3.2",
5252
"babel-plugin-add-module-exports": "^0.2.1",
53-
"babel-plugin-transform-runtime": "^6.23.0",
53+
"babel-plugin-transform-object-rest-spread": "^6.23.0",
5454
"babel-preset-env": "^1.1.11",
5555
"babel-preset-es2015": "^6.22.0",
56-
"babel-preset-es2017": "^6.22.0",
5756
"babel-preset-stage-0": "^6.22.0",
5857
"chalk": "^1.1.3",
5958
"chokidar": "^1.6.1",

yarn.lock

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ babel-plugin-transform-function-bind@^6.22.0:
722722
babel-plugin-syntax-function-bind "^6.8.0"
723723
babel-runtime "^6.22.0"
724724

725-
babel-plugin-transform-object-rest-spread@^6.22.0:
725+
babel-plugin-transform-object-rest-spread@^6.22.0, babel-plugin-transform-object-rest-spread@^6.23.0:
726726
version "6.23.0"
727727
resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz#875d6bc9be761c58a2ae3feee5dc4895d8c7f921"
728728
dependencies:
@@ -735,12 +735,6 @@ babel-plugin-transform-regenerator@^6.22.0, babel-plugin-transform-regenerator@^
735735
dependencies:
736736
regenerator-transform "0.9.8"
737737

738-
babel-plugin-transform-runtime@^6.23.0:
739-
version "6.23.0"
740-
resolved "https://registry.yarnpkg.com/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz#88490d446502ea9b8e7efb0fe09ec4d99479b1ee"
741-
dependencies:
742-
babel-runtime "^6.22.0"
743-
744738
babel-plugin-transform-strict-mode@^6.22.0:
745739
version "6.22.0"
746740
resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.22.0.tgz#e008df01340fdc87e959da65991b7e05970c8c7c"
@@ -820,13 +814,6 @@ babel-preset-es2015@^6.22.0:
820814
babel-plugin-transform-es2015-unicode-regex "^6.22.0"
821815
babel-plugin-transform-regenerator "^6.22.0"
822816

823-
babel-preset-es2017@^6.22.0:
824-
version "6.22.0"
825-
resolved "https://registry.yarnpkg.com/babel-preset-es2017/-/babel-preset-es2017-6.22.0.tgz#de2f9da5a30c50d293fb54a0ba15d6ddc573f0f2"
826-
dependencies:
827-
babel-plugin-syntax-trailing-function-commas "^6.22.0"
828-
babel-plugin-transform-async-to-generator "^6.22.0"
829-
830817
babel-preset-stage-0@^6.22.0:
831818
version "6.22.0"
832819
resolved "https://registry.yarnpkg.com/babel-preset-stage-0/-/babel-preset-stage-0-6.22.0.tgz#707eeb5b415da769eff9c42f4547f644f9296ef9"

0 commit comments

Comments
 (0)