forked from electerm/electerm-locales
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (47 loc) · 1.37 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
const gulp = require('gulp')
const syncy = require('syncy')
const {syncTo} = require('./config.default')
const mkdirp = require('mkdirp')
const fs = require('fs')
const watch = require('gulp-watch')
const run = require('run-sequence')
console.log('syncTo', syncTo)
gulp.task('sync', function() {
try {
let state = fs.statSync(syncTo)
if (!state.isDirectory()) {
mkdirp(syncTo)
}
} catch (e) {
console.log(e)
mkdirp(syncTo)
}
syncy([
'./locales/*',
'./package.js*'
], syncTo, {
// // Display log messages when copying and removing files
verbose: true
// // Or create your own function.
// verbose: (stamp) => {
// // action - `copy` or `remove`
// // to - only for `copy` action
// console.log(stamp.action + ' | ' + stamp.from + ' | ' + stamp.to);
// },
// The base path to be removed from the path. Default: none
//base: 'base_path',
// Remove all files from dest that are not found in src. Default: true
//updateAndDelete: true,
// Never remove js files from destination. Default: false
//ignoreInDest: './src/**/*'
})
.then(() => console.log('sync ok'))
.catch(e => console.log(e))
})
gulp.task('watch-extend', function() {
watch(['./locales/*', './package.js*'], function() {
run('sync')
})
})
gulp.task('watch', ['watch-extend'])
gulp.task('default', ['sync', 'watch'])