-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathMakefile
91 lines (76 loc) · 3.17 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
.PHONY: babel typescript closure rollup traceur size rollup-plugin-babel webpack babelify jspm webpack-2 typescript-webpack brotli
# local binary paths
browserify = node ./node_modules/browserify/bin/cmd.js
uglifyjs = node ./node_modules/uglify-js/bin/uglifyjs
babel = node ./node_modules/babel-cli/bin/babel.js
traceur = node node_modules/traceur/bin/traceur.js
tsc = node node_modules/typescript/bin/tsc
rollup = node node_modules/rollup/bin/rollup
jspm = node node_modules/jspm/jspm.js
webpack = node node_modules/webpack/bin/webpack.js
bro = brotli-0.3.0/tools/bro
all:
make typescript
make size
make babel
make size
make babelify
make size
make rollup-plugin-babel
make size
make rollup
make size
make closure
make size
make traceur
make size
make webpack
make size
make jspm
make size
make webpack-2
make size
make typescript-webpack
make size
typescript:
cd typescript; npm i;
cd typescript; time $(tsc) && $(browserify) -p bundle-collapser/plugin ./dist/*.js | $(uglifyjs) --compress --mangle --screw-ie8 - > ../src/dist/bundle.js
babel:
cd babel; npm i;
cd babel; time $(babel) ../src/src --presets ./node_modules/babel-preset-es2015 --out-dir dist && $(browserify) -p bundle-collapser/plugin dist/app.js | $(uglifyjs) --compress --mangle --screw-ie8 - > ../src/dist/bundle.js
babelify:
cd babelify; npm i;
cd babelify; time $(browserify) ../src/src/app.js -t [ babelify --presets [ ./node_modules/babel-preset-es2015 ] ] -p bundle-collapser/plugin | $(uglifyjs) --compress --mangle --screw-ie8 - > ../src/dist/bundle.js
rollup:
cd rollup; npm i;
cd rollup; time $(rollup) --format iife -- ../src/src/app.js | $(babel) --presets ./node_modules/babel-preset-es2015 | $(uglifyjs) --compress --mangle --screw-ie8 - > ../src/dist/bundle.js
rollup-plugin-babel:
cd rollup-plugin-babel; npm i;
cd rollup-plugin-babel; time $(rollup) -c | $(uglifyjs) --compress --mangle --screw-ie8 - > ../src/dist/bundle.js
closure:
cd closure; time java -jar compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS --language_in=ECMASCRIPT6_STRICT --js_output_file='../src/dist/bundle.js' '../src/src/**.js'
traceur:
cd traceur; npm i;
cd traceur; time $(traceur) --modules=commonjs --dir ../src/src/ tmp/ && (cat node_modules/traceur/bin/traceur-runtime.js; $(browserify) -p bundle-collapser/plugin tmp/app.js;) | $(uglifyjs) --compress --mangle --screw-ie8 - > ../src/dist/bundle.js
webpack:
cd webpack; npm i;
cd webpack; time $(webpack) ../src/src/app.js ../src/dist/bundle.js
jspm:
cd jspm; npm i;
cd jspm; time $(jspm) build src/app.js ../src/dist/bundle.js --skip-source-maps --minify --format global --global-name app
webpack-2:
cd webpack-2; npm i;
cd webpack-2; time $(webpack) ../src/src/app.js ../src/dist/bundle.js
typescript-webpack:
cd typescript-webpack; npm i;
cd typescript-webpack; time $(tsc) && $(webpack) ./dist/app.js ../src/dist/bundle.js -p
brotli:
wget https://github.com/google/brotli/archive/v0.3.0.tar.gz
tar -xf v0.3.0.tar.gz
make -C brotli-0.3.0/tools/
size:
@echo -----------------------------------------
cat src/dist/bundle.js | wc -c
gzip -c src/dist/bundle.js | wc -c
$(bro) --input src/dist/bundle.js | wc -c
@echo -----------------------------------------