Skip to content

Instantly share code, notes, and snippets.

@jrc03c
Last active March 21, 2025 13:34
Show Gist options
  • 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
import { watch } from "@jrc03c/watch"
import process from "node:process"
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