-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (52 loc) · 1.38 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
import os from 'os'
import path from 'path'
import gulp from 'gulp'
import shell from 'gulp-shell'
import watch from 'gulp-watch'
import replace from 'gulp-replace'
import { deleteAsync } from 'del'
const repoPath = 'rxrc/tmuxrc'
const homePath = os.homedir()
const pluginPath = `${homePath}/.config/tmux/plugins/tmuxrc`
const tpm = (task) => {
return `${homePath}/.config/tmux/plugins/tpm/bin/${task} &>/dev/null`
}
const tpmUpdate = [tpm('install_plugins'), tpm('install_plugins')]
gulp.task('default', watch)
gulp.task('nodev', () => {
deleteAsync(pluginPath, {
force: true,
})
return gulp.src('.').pipe(shell(tpmUpdate))
})
gulp.task('dev', () => {
deleteAsync(pluginPath, {
force: true,
})
gulp.src('*.tmux').pipe(gulp.dest(pluginPath))
gulp.src('plugin/**/*.conf').pipe(gulp.dest(`${pluginPath}/plugin`))
gulp
.src('plugins.conf')
.pipe(replace(repoPath, pluginPath))
.pipe(gulp.dest(pluginPath))
return gulp.src('.').pipe(
shell(tpmUpdate, {
ignoreErrors: true,
})
)
})
gulp.task(
'watch',
gulp.series('dev', () => {
return watch(['./*.tmux', './*.conf', './plugin/**/*.conf'], (file) => {
if (file.event === 'unlink') {
return deleteAsync(file.path, {
force: true,
})
}
})
.pipe(replace(repoPath, pluginPath))
.pipe(gulp.dest(pluginPath))
.pipe(shell([tpmUpdate]))
})
)