Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const watchFilesAndExecute = async function ({ message, files, execute, executeOnStart = false }) {
if (!message) {
throw new Error('Message is missing.');
}
if (!files) {
throw new Error('Files are missing.');
}
if (!execute) {
throw new Error('Execute is missing.');
}
buntstift.line();
buntstift.info(message, { prefix: '▸' });
const handleChange = function () {
if (isCurrentlyExecuting) {
return;
}
isCurrentlyExecuting = true;
(async () => {
try {
await execute();
} catch (ex) {
// In watch mode, we ignore any errors (since we do not have an
// exit code anyway).
buntstift.verbose(ex.message);