forked from geelen/Snap.svg-cjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
44 lines (40 loc) · 1.07 KB
/
gulpfile.babel.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
import gulp from 'gulp'
import concat from 'gulp-concat'
import fs from 'fs'
import assert from 'assert'
const srcPath = __dirname + '/node_modules/snapsvg/src';
/* Extracted from snapsvg's gruntfile. */
const expectedSourceFiles = [
"mina.js",
"svg.js",
"element.js",
"matrix.js",
"attr.js",
"class.js",
"attradd.js",
"paper.js",
"path.js",
"set.js",
"equal.js",
"mouse.js",
"filter.js",
"align.js",
"animation.js",
"colors.js",
]
const excludedSourceFiles = [
"amd-banner.js",
"amd-footer.js",
"copy.js"
]
gulp.task('default', _ => {
/* Start by confirming the upstream source files haven't changed */
const sourceFiles = fs.readdirSync(srcPath);
assert.deepEqual(sourceFiles.sort(), [...expectedSourceFiles, ...excludedSourceFiles].sort(), "SnapSVG upstream has different files to what we expect. They must have updated it! This will need to be resolved manually.")
gulp.src([
'cjs-head.js',
...expectedSourceFiles.map(f => `${srcPath}/${f}`),
'cjs-foot.js'
]).pipe(concat('snap.svg-cjs.js'))
.pipe(gulp.dest('dist'))
})