gitdeploy/html/scripts/watch

36 lines
579 B
JavaScript
Executable File

#!/usr/bin/env node
"use strict";
var fs = require("fs");
var { exec } = require("child_process");
fs.watch(
"src",
{
recursive: true,
},
function (eventType, filename) {
if (filename.includes(".html")) {
copy().then(function () {
console.log("copied html");
});
}
}
);
async function copy() {
return new Promise(function (resolve) {
exec(
"scripts/copy",
{
path: process.env.PATH,
cwd: process.cwd(),
},
function (err, stdout, stderr) {
resolve();
}
);
});
}
copy();