Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const run = (options) => {
const dir = options.directory;
// validates the project.
validator.hasPackageJson(dir, true);
validator.hasAnyDependencies(dir, true);
validator.hasNodeModules(dir, true);
// ignores test directory by default.
if (!options.dev) {
options.ignore.push('test');
}
// all the require() found.
const requireSet = new Set();
// lists JS files.
listJS(dir, options.ignore)
.then((files) => {
// searches the require() for each file.
files.forEach((f) => {
const src = fs.readFileSync(f);