Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function closeWatcher() {
// Wait for one second before closing, giving time for file changes to propagate
await delay(1000);
if (changedFilesOutsideScope.length > 0) {
logger.warn(sideEffectWarningString);
changedFilesOutsideScope.forEach(file => logger.warn(`- ${file}`));
logger.warn(sideEffectCallToActionString);
} else {
logger.info(noSideEffectString);
}
watcher.close();
}
export function initializeWatcher(
packageRoot: string,
internalCacheFolder: string,
logFolder: string,
outputFolder: string | string[],
hashGlobs: string[]
) {
// Trying to find the git root and using it as an approximation of code boundary
const repositoryRoot = getGitRepositoryRoot(packageRoot);
// Empty the arrays
changedFilesOutsideScope = [];
changedFilesInsideScope = [];
logger.info("Running in AUDIT mode");
logger.info(`[audit] Watching file changes in: ${repositoryRoot}`);
logger.info(`[audit] Backfill will cache folder: ${outputFolder}`);
// Define globs
const ignoreGlobs = addGlobstars([
".git",
".cache",
logFolder,
internalCacheFolder
]);
const cacheFolderGlob = outputFolderAsArray(outputFolder).map(folder =>
path.posix.join("**", folder, "**")
);
watcher = chokidar
export function initializeWatcher(
packageRoot: string,
internalCacheFolder: string,
logFolder: string,
outputFolder: string | string[],
hashGlobs: string[]
) {
// Trying to find the git root and using it as an approximation of code boundary
const repositoryRoot = getGitRepositoryRoot(packageRoot);
// Empty the arrays
changedFilesOutsideScope = [];
changedFilesInsideScope = [];
logger.info("Running in AUDIT mode");
logger.info(`[audit] Watching file changes in: ${repositoryRoot}`);
logger.info(`[audit] Backfill will cache folder: ${outputFolder}`);
// Define globs
const ignoreGlobs = addGlobstars([
".git",
".cache",
logFolder,
internalCacheFolder
]);
const cacheFolderGlob = outputFolderAsArray(outputFolder).map(folder =>
path.posix.join("**", folder, "**")
);
watcher = chokidar
.watch(hashGlobs, {