Skip to content

Commit

Permalink
Update watcher rules
Browse files Browse the repository at this point in the history
  • Loading branch information
DZakh committed Sep 30, 2023
1 parent c799ba1 commit 609905a
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions rescript
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ process.env.BSB_PROJECT_ROOT = cwd;
const isTtyError = process.stderr.isTTY;
const isTtyStd = process.stdout.isTTY;

// If the project uses gentype and uses custom file extension
// via generatedFileExtension, ignore them in watch mode
var bsConfigFile = path.join(cwd, bsconfig);
var genTypeFileExtension = ".gen.tsx";
if (fs.existsSync(bsConfigFile)) {
var genTypeConfig = require(bsConfigFile).gentypeconfig;
if (genTypeConfig) {
genTypeFileExtension = genTypeConfig.generatedFileExtension;
}
}

let verbose = false;

/**
Expand Down Expand Up @@ -358,14 +347,13 @@ Please pick a different one using the \`-ws [host:]port\` flag from bsb.`);
// This could cause problems if source builds (generating js files in the same directory) are supported.
if (!fileName) return true;

return !(
fileName === ".merlin" ||
fileName.endsWith(".js") ||
fileName.endsWith(".mjs") ||
fileName.endsWith(".cjs") ||
fileName.endsWith(genTypeFileExtension) ||
watchGenerated.indexOf(fileName) >= 0 ||
fileName.endsWith(".swp")
return (
((fileName.endsWith(".res") ||
fileName.endsWith(".resi") ||
fileName.endsWith(".ml") ||
fileName.endsWith(".mli")) &&
!watchGenerated.includes(fileName)) ||
fileName === bsconfig
);
}

Expand Down

0 comments on commit 609905a

Please sign in to comment.