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);
const requires = detective(src);
exports.handler = (argv) => {
npv.hasPackageJson(argv.cwd, true);
npv.hasDependencies(argv.cwd, true);
if (npv.hasNodeModules(argv.cwd, false)) {
let canonicalNameMapper;
if (fs.existsSync(argv.nm)) {
const mappings = canonicalName.loadNameMapperFile(argv.nm);
canonicalNameMapper = canonicalName.init(mappings);
} else {
console.error(`File not found: ${argv.nm}`);
process.exit(1);
}
if (fs.existsSync(argv.ul)) {
validator.validate(argv.ul);
unifiedList.load(argv.ul);
} else {
console.error(`File not found: ${argv.ul}`);
process.exit(1);
}
exports.handler = (argv) => {
npv.hasPackageJson(argv.cwd, true);
npv.hasDependencies(argv.cwd, true);
if (npv.hasNodeModules(argv.cwd, false)) {
let canonicalNameMapper;
if (fs.existsSync(argv.nm)) {
const mappings = canonicalName.loadNameMapperFile(argv.nm);
canonicalNameMapper = canonicalName.init(mappings);
} else {
console.error(`File not found: ${argv.nm}`);
process.exit(1);
}
if (fs.existsSync(argv.ul)) {
validator.validate(argv.ul);
unifiedList.load(argv.ul);
} else {
console.error(`File not found: ${argv.ul}`);
process.exit(1);
}
exports.handler = (argv) => {
npv.hasPackageJson(argv.cwd, true);
npv.hasDependencies(argv.cwd, true);
if (npv.hasNodeModules(argv.cwd, false)) {
let canonicalNameMapper;
if (fs.existsSync(argv.nm)) {
const mappings = canonicalName.loadNameMapperFile(argv.nm);
canonicalNameMapper = canonicalName.init(mappings);
} else {
console.error(`File not found: ${argv.nm}`);
process.exit(1);
}
if (fs.existsSync(argv.ul)) {
validator.validate(argv.ul);
unifiedList.load(argv.ul);
} else {
console.error(`File not found: ${argv.ul}`);
process.exit(1);
}