Skip to content

Instantly share code, notes, and snippets.

@jrc03c
Last active June 13, 2023 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrc03c/fcc76fa9219fd86310a4acd99689b14e to your computer and use it in GitHub Desktop.
Save jrc03c/fcc76fa9219fd86310a4acd99689b14e to your computer and use it in GitHub Desktop.
generic build script
const process = require("process")
const watch = require("@jrc03c/watch")
function rebuild() {
console.log("-----")
console.log(`Rebuilding... (${new Date().toLocaleString()})`)
try {
// do stuff...
console.log("Done! 🎉")
} catch (e) {
console.error(e)
}
}
if (process.argv.indexOf("-w") > -1 || process.argv.indexOf("--watch") > -1) {
watch({
target: ".",
exclude: ["node_modules"],
created: rebuild,
modified: rebuild,
deleted: rebuild,
})
}
rebuild()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment