Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async function link (
linkFromPkgs: Array<{alias: string, path: string} | string>,
destModules: string,
maybeOpts: LinkOptions & {
linkToBin?: string,
dir: string,
},
) {
const reporter = maybeOpts?.reporter
if (reporter) {
streamParser.on('data', reporter)
}
const opts = await extendOptions(maybeOpts)
const ctx = await getContextForSingleImporter(opts.manifest, {
...opts,
extraBinPaths: [], // ctx.extraBinPaths is not needed, so this is fine
})
const importerId = getLockfileImporterId(ctx.lockfileDir, opts.dir)
const currentLockfile = R.clone(ctx.currentLockfile)
const linkedPkgs: Array<{path: string, manifest: DependencyManifest, alias: string}> = []
const specsToUpsert = [] as PackageSpecObject[]
for (const linkFrom of linkFromPkgs) {
let linkFromPath: string
let linkFromAlias: string | undefined
if (typeof linkFrom === 'string') {
linkFromPath = linkFrom
} else {
linkFromPath = linkFrom.path