-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
51 lines (43 loc) · 1.42 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
const Path = require('./gulp/path');
const rollupBundle = require('./gulp/rollup-bundle');
const gulp = require('gulp');
const bundleUglify = require('./gulp/gulp-uglify');
const fs = require('fs');
const gutil = require('gulp-util');
const gulpJsdoc2md = require('gulp-jsdoc-to-markdown');
const rename = require('gulp-rename');
const concat = require('gulp-concat');
gulp.task('build-lib', () => {
return rollupBundle('./src/index.js', 'model-persistence.js', 'modelPersist', {
externalHelpers: false,
exclude: ['node_modules/**'],
}, {
objectmodel: 'Model',
axios: 'axios'
});
});
gulp.task('build-fake-local-storage', () => {
return rollupBundle('./src/fakeLocalStorage.js', 'fakeLocalStorage.js', 'fakeLocalStorage', {
externalHelpers: false,
});
});
gulp.task('dist-lib', ['build-lib'], () => {
return bundleUglify(Path.bundle('/model-persistence.js'), Path.bundle());
});
gulp.task('docs', () => {
return gulp.src('src/**/*.js')
.pipe(gulpJsdoc2md())
.on('error', function (err) {
gutil.log(gutil.colors.red('jsdoc2md failed'), err.message)
})
.pipe(rename(function (path) {
path.extname = '.md'
}))
.pipe(gulp.dest('api'))
});
gulp.task('dist', ['dist-lib']);
// Watchers
gulp.task('watch:lib', () => {
return gulp.watch('./src/**/*.js', ['dist-lib']);
});
gulp.task('watch', ['watch:lib']);