forked from mapillary/traffico
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
120 lines (102 loc) · 3.56 KB
/
gulpfile.js
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
var gulp = require('gulp')
var shell = require('gulp-shell')
var concat = require('gulp-concat')
var cson = require('gulp-cson')
var es = require('event-stream')
var resolveTransformations = require('./scripts/plugins/resolve-transformations.js')
var sass = require('gulp-sass')
var watch = require('gulp-watch')
var zip = require('gulp-zip')
gulp.task('clean', shell.task(['rm -f .fontcustom-manifest.json', 'rm -rf ./build/']))
gulp.task('compile-font', shell.task('fontcustom compile'))
gulp.task('pngs', function () {
return gulp.src('./scripts/scrape-pngs.js')
.pipe(shell(['phantomjs <%= file.path %>']))
.pipe(gulp.dest('build'))
})
gulp.task('buildReleaseResources', function () {
return es.merge(
gulp.src('releaseResources/bower.cson')
.pipe(cson())
.pipe(es.map(function (file, cb) {
var bowerInfo = JSON.parse(file.contents.toString('utf8'))
bowerInfo.version = require('./package.json').version
file.contents = new Buffer(JSON.stringify(bowerInfo), 'utf8')
cb(null, file)
})),
gulp.src(['LICENSE', 'releaseResources/*.md'])
).pipe(gulp.dest('build/releaseResources'))
})
gulp.task('cson-mapillary-mappings', function () {
return gulp.src('mapillary-mappings/*.cson')
.pipe(cson())
.pipe(gulp.dest('build/mapillary-mappings'))
})
gulp.task('cson-signs', ['cson-transformations'], function () {
return gulp.src('dev/*.cson')
.pipe(cson())
.pipe(resolveTransformations())
.pipe(gulp.dest('build/signs'))
})
gulp.task('cson-transformations', function () {
return gulp.src('stylesheets/transformations.cson')
.pipe(cson())
.pipe(gulp.dest('build'))
})
gulp.task('concat-traffico-css', ['compile-font'], function () {
return gulp.src(['build/stylesheets/traffico.css', 'stylesheets/extend.css'])
.pipe(concat('traffico.css'))
.pipe(gulp.dest('build/stylesheets'))
})
gulp.task('gen-overview-css', function () {
return gulp.src('stylesheets/examples.scss').pipe(gulp.dest('build/gh-pages')).pipe(sass()).pipe(gulp.dest('build/stylesheets'))
})
gulp.task('gen-overview', ['cson-signs', 'cson-transformations'], function () {
return gulp.src('scripts/generate-overview.js').pipe(shell(['mkdir -p build/gh-pages && node <%= file.path %>']))
})
gulp.task('gen-html-map', ['cson-signs'], function () {
return gulp.src('scripts/generate-html-string-dict.js').pipe(shell(['mkdir -p build/string-maps && node <%= file.path %>']))
})
gulp.task('generate_gh-pages_config', function () {
return gulp.src('scripts/generate_gh-pages_config.js').pipe(shell(['mkdir -p build/gh-pages && node <%= file.path %>']))
})
gulp.task(
'build',
[
'buildReleaseResources',
'concat-traffico-css',
'cson-mapillary-mappings',
'gen-overview',
'gen-overview-css',
'generate_gh-pages_config',
'gen-html-map'
],
function () {
return es.merge(
gulp.src('build/releaseResources/*'),
gulp.src(['fonts/*', 'mapillary-mappings/*', 'signs/*', 'string-maps/*', 'stylesheets/*', '*.json'], {base: 'build', cwd: 'build'})
)
.pipe(zip('traffico.zip'))
.pipe(gulp.dest('build/dist'))
}
)
gulp.task('lint', shell.task('node node_modules/standard/bin/cmd.js gulpfile.js scripts/*.js'))
gulp.task('check-for-duplicate-signs', ['build'], function () {
return gulp.src('scripts/check-for-duplicate-signs.js').pipe(shell(['node <%= file.path %>']))
})
gulp.task(
'check',
[
'check-for-duplicate-signs',
'lint'
]
)
gulp.task(
'default',
['check']
)
gulp.task('watch', function (cb) {
watch(['dev/*', 'icons/*'], function (events, done) {
gulp.start('check')
})
})