Commit | Line | Data |
---|---|---|
6a1aa64f DV |
1 | #!/bin/bash |
2 | # Generates a single JS file that's easier to include. | |
43f15770 | 3 | |
1beeb310 KW |
4 | GetSources () { |
5 | # This list needs to be kept in sync w/ the one in dygraph-dev.js | |
6 | # and the one in jsTestDriver.conf. Order matters, except for the plugins. | |
7 | for F in \ | |
a14ed8aa | 8 | polyfills/console.js \ |
1beeb310 KW |
9 | dashed-canvas.js \ |
10 | dygraph-options.js \ | |
11 | dygraph-layout.js \ | |
12 | dygraph-canvas.js \ | |
13 | dygraph.js \ | |
14 | dygraph-utils.js \ | |
15 | dygraph-gviz.js \ | |
16 | dygraph-interaction-model.js \ | |
17 | dygraph-tickers.js \ | |
18 | dygraph-plugin-base.js \ | |
19 | plugins/*.js \ | |
a49c164a DE |
20 | dygraph-plugin-install.js \ |
21 | datahandler/datahandler.js \ | |
22 | datahandler/default.js \ | |
23 | datahandler/default-fractions.js \ | |
24 | datahandler/bars.js \ | |
25 | datahandler/bars-custom.js \ | |
26 | datahandler/bars-error.js \ | |
27 | datahandler/bars-fractions.js | |
1beeb310 KW |
28 | do |
29 | echo "$F" | |
30 | done | |
31 | } | |
32 | ||
74a5af31 | 33 | # Pack all the JS together. |
1beeb310 KW |
34 | CatSources () { |
35 | GetSources \ | |
36 | | xargs cat \ | |
37 | | perl -ne 'print unless m,REMOVE_FOR_COMBINED,..m,/REMOVE_FOR_COMBINED,' | |
38 | } | |
74a5af31 | 39 | |
1beeb310 | 40 | Copyright () { |
d218710c | 41 | echo '/*! @license Copyright 2014 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT) */' |
1beeb310 | 42 | } |
b2a516b8 | 43 | |
1beeb310 KW |
44 | CatCompressed () { |
45 | Copyright | |
46 | CatSources \ | |
d218710c | 47 | | grep -v '"use strict";' \ |
170b6547 | 48 | | node_modules/uglify-js/bin/uglifyjs -c warnings=false -m |
1beeb310 | 49 | } |
b2a516b8 | 50 | |
1beeb310 KW |
51 | ACTION="${1:-update}" |
52 | case "$ACTION" in | |
53 | ls) | |
54 | GetSources | |
55 | ;; | |
56 | cat) | |
57 | Copyright | |
58 | CatSources | |
59 | ;; | |
60 | compress*|cat_compress*) | |
61 | CatCompressed | |
62 | ;; | |
63 | update) | |
806e1ea5 DV |
64 | CatCompressed > dygraph-combined.js |
65 | chmod a+r dygraph-combined.js | |
1beeb310 KW |
66 | ;; |
67 | *) | |
68 | echo >&2 "Unknown action '$ACTION'" | |
69 | exit 1 | |
70 | ;; | |
71 | esac |