-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.ls
66 lines (56 loc) · 1.44 KB
/
index.ls
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
require! {
'mz/fs'
'./lib/util': {log, now}
'./lib/download-fonts'
'./lib/load-codepoints'
'./lib/generate-svg'
'./lib/convert-to-png'
'./lib/convert-to-pdf'
'./lib/compose-poster'
'./configs'
'bluebird': Promise
}
now ->
log 'Downloading fonts...'
download-fonts!
.then ->
log 'Loading codepionts...'
load-codepoints!
.then (codepoints) ->
Promise.map-series configs, (config) ->
chart-svg = "#{config.name}-chart.svg"
poster-svg = "#{config.name}-poster.svg"
poster-png = "#{config.name}-poster.png"
poster-pdf = "#{config.name}-poster.pdf"
now ->
log "Generating #{config.name} SVG..."
generate-svg codepoints, config
.then (svg) ->
Promise.all [
* now ->
log "Writing #chart-svg..."
fs.write-file chart-svg, svg
* now ->
log "Composing #poster-svg..."
compose-poster svg, config
]
.then ([_, poster]) ->
Promise.all [
* now ->
log "Writing #poster-svg..."
fs.write-file poster-svg, poster
* now ->
log "Generating #poster-png..."
convert-to-png poster
.then (png) ->
log "Writing #poster-png..."
fs.write-file poster-png, png
]
.then ->
log "Generating #poster-pdf..."
convert-to-pdf poster-svg, poster-pdf
.then ->
log 'Done.'
.catch (error) ->
console.error error
process.exit 1