Skip to content

Commit

Permalink
WIP: gulp 4.x compat
Browse files Browse the repository at this point in the history
AssertionError [ERR_ASSERTION]: Task function must be specified
AssertionError [ERR_ASSERTION]: Task never defined: readme
  gulpjs/gulp#802
[10:31:47] The following tasks did not complete: check-priv
[10:31:47] Did you forget to signal async completion?
[10:53:00] Error: watching conf.priv.js,completions.js,conf.js,actions.js,help.js,keys.js,util.js,gulpfile.js: watch task has to be a function (optionally generated by using gulp.parallel or gulp.series)
  • Loading branch information
jeebak committed Dec 28, 2018
1 parent 18badf8 commit 71d08ef
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ gulp.task("gulp-autoreload", () => {
let p
const spawnChildren = function spawnChildren() {
if (p) p.kill()
p = spawn("gulp", ["lint-gulpfile", "install", "watch-nogulpfile"], { stdio: "inherit" })
p = spawn("./node_modules/.bin/gulp", ["lint-gulpfile", "install", "watch-nogulpfile"], { stdio: "inherit" })
}
gulp.watch("gulpfile.js", spawnChildren)
spawnChildren()
Expand All @@ -57,32 +57,16 @@ gulp.task("lint", () =>
.pipe(eslint())
.pipe(eslint.format()))

gulp.task("check-priv", () => {
gulp.task("check-priv", (done) => {
try {
fs.statSync("./conf.priv.js")
} catch (e) {
// eslint-disable-next-line no-console
console.log("Creating ./conf.priv.js based on ./conf.priv.example.js")
fs.copyFileSync("./conf.priv.example.js", "./conf.priv.js", fs.constants.COPYFILE_EXCL)
}
})

gulp.task("build", ["check-priv", "clean", "lint", "readme"], () => gulp.src(paths.entry, { read: false })
.pipe(parcel())
.pipe(rename(".surfingkeys"))
.pipe(gulp.dest("build")))

gulp.task("install", ["build"], () => gulp.src("build/.surfingkeys")
.pipe(gulp.dest(os.homedir())))

gulp.task("watch", () => {
gulp.watch([].concat(paths.scripts, paths.gulpfile), ["readme", "install"])
gulp.watch(paths.readme, ["readme"])
})

gulp.task("watch-nogulpfile", () => {
gulp.watch([].concat(paths.scripts), ["readme", "install"])
gulp.watch(paths.readme, ["readme"])
done()
})

gulp.task("readme", () => {
Expand Down Expand Up @@ -154,4 +138,26 @@ gulp.task("readme", () => {
.pipe(gulp.dest("."))
})

gulp.task("default", ["build"])
gulp.task("build", gulp.series("check-priv", "clean", "lint", "readme"), (done) => {
gulp.src(paths.entry, { read: false })
.pipe(parcel())
.pipe(rename(".surfingkeys"))
.pipe(gulp.dest("build"))

done()
})

gulp.task("install", gulp.series("build"), () => gulp.src("build/.surfingkeys")
.pipe(gulp.dest(os.homedir())))

gulp.task("watch", () => {
gulp.watch([].concat(paths.scripts, paths.gulpfile), gulp.series("readme", "install"))
gulp.watch(paths.readme, gulp.series("readme"))
})

gulp.task("watch-nogulpfile", () => {
gulp.watch([].concat(paths.scripts), gulp.series("readme", "install"))
gulp.watch(paths.readme, gulp.series("readme"))
})

gulp.task("default", gulp.series("build"))

0 comments on commit 71d08ef

Please sign in to comment.