Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(() => {
const strictOutOfSync = _.get(options, 'strictOutOfSync') !== 'false';
return lockFileParser
.buildDepTree(manifestFile, lockFile, options.dev, lockFileType, strictOutOfSync);
})
// clear spinner in case of success or failure
if (!fileSystem.existsSync(manifestFileFullPath)) {
throw new Error('Manifest file package.json not found at location: ' +
manifestFileFullPath);
}
if (!manifestFileFullPath && lockFileFullPath) {
throw new Error('Detected a lockfile at location: '
+ lockFileFullPath + '\n However the package.json is missing!');
}
const manifestFile = await fs.readFile(manifestFileFullPath, 'utf-8');
const lockFile = await fs.readFile(lockFileFullPath, 'utf-8');
const defaultManifestFileName = path.relative(root, manifestFileFullPath);
const strictOutOfSync = _.get(options, 'strictOutOfSync', true);
return lockFileParser.buildDepTree(manifestFile, lockFile, options.dev,
lockFileParser.LockfileType.npm, strictOutOfSync, defaultManifestFileName);
}
throw new Error(`Manifest file yarn.lock not found at location: ${manifestFileFullPath}`);
}
if (!manifestFileFullPath && lockFileFullPath) {
throw new Error(`Detected a lockfile at location: ${lockFileFullPath}\nHowever the yarn.lock is missing!`);
}
const [manifestFile, lockFile] = await Promise.all([
await fs.readFile(manifestFileFullPath, 'utf-8'),
await fs.readFile(lockFileFullPath, 'utf-8'),
]);
const defaultManifestFileName = path.relative(root, manifestFileFullPath);
const strictOutOfSync = _.get(options, 'strictOutOfSync') !== 'false';
return buildDepTree(
manifestFile,
lockFile,
options.dev,
LockfileType.yarn,
strictOutOfSync,
defaultManifestFileName,
);
}
throw new Error(`Manifest file package.json not found at location: ${manifestFileFullPath}`);
}
if (!manifestFileFullPath && lockFileFullPath) {
throw new Error(`Detected a lockfile at location: ${lockFileFullPath}\nHowever the package.json is missing!`);
}
const [manifestFile, lockFile] = await Promise.all([
await fs.readFile(manifestFileFullPath, 'utf-8'),
await fs.readFile(lockFileFullPath, 'utf-8'),
]);
const defaultManifestFileName = path.relative(root, manifestFileFullPath);
const strictOutOfSync = _.get(options, 'strictOutOfSync') !== 'false';
return await buildDepTree(
manifestFile,
lockFile,
options.dev,
LockfileType.npm,
strictOutOfSync,
defaultManifestFileName,
);
}
if (!fileSystem.existsSync(manifestFileFullPath)) {
throw new Error('Manifest file yarn.lock not found at location: ' +
manifestFileFullPath);
}
if (!manifestFileFullPath && lockFileFullPath) {
throw new Error('Detected a lockfile at location: '
+ lockFileFullPath + '\n However the yarn.lock is missing!');
}
const manifestFile = await fs.readFile(manifestFileFullPath, 'utf-8');
const lockFile = await fs.readFile(lockFileFullPath, 'utf-8');
const defaultManifestFileName = path.relative(root, manifestFileFullPath);
const strictOutOfSync = _.get(options, 'strictOutOfSync', true);
return lockFileParser.buildDepTree(manifestFile, lockFile, options.dev,
lockFileParser.LockfileType.yarn, strictOutOfSync, defaultManifestFileName);
}
analytics.add('local', true);
analytics.add('generating-node-dependency-tree', {
lockFile: true,
targetFile,
});
const lockFileType = targetFile.endsWith('yarn.lock')
? lockFileParser.LockfileType.yarn
: lockFileParser.LockfileType.npm;
const resolveModuleSpinnerLabel = `Analyzing npm dependencies for ${lockFileFullPath}`;
debug(resolveModuleSpinnerLabel);
try {
await spinner(resolveModuleSpinnerLabel);
const strictOutOfSync = options.strictOutOfSync !== false;
return lockFileParser.buildDepTree(
manifestFile,
lockFile,
options.dev,
lockFileType,
strictOutOfSync,
);
} finally {
await spinner.clear(resolveModuleSpinnerLabel);
}
}