Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'workspaceDir'
> & Partial>,
) {
const cwd = opts?.dir ?? process.cwd()
const storeControllerCache = new Map>()
let workspacePackagesArr
let workspacePackages!: WorkspacePackages
if (opts.workspaceDir) {
workspacePackagesArr = await findWorkspacePackages(opts.workspaceDir, opts)
workspacePackages = arrayOfWorkspacePackagesToMap(workspacePackagesArr)
} else {
workspacePackages = {}
}
const store = await createOrConnectStoreControllerCached(storeControllerCache, opts)
const linkOpts = Object.assign(opts, {
storeController: store.ctrl,
storeDir: store.dir,
targetDependenciesField: getSaveType(opts),
workspacePackages,
})
// pnpm link
if (!input || !input.length) {
const { manifest, writeImporterManifest } = await tryReadImporterManifest(opts.globalDir!, opts)
const newManifest = await linkToGlobal(cwd, {
...linkOpts,
// A temporary workaround. global bin/prefix are always defined when --global is set
globalBin: linkOpts.globalBin!,
globalDir: linkOpts.globalDir!,
manifest: manifest || {},
pkgPaths.map((dir) => installLimit(async () => {
const s = await createOrConnectStoreControllerCached(storeControllerCache, opts)
await install(
await readImporterManifestOnly(dir, opts), {
...await getConfig(
{ ...opts.cliOptions, 'dir': dir },
{
command: ['link'],
excludeReporter: true,
rcOptionsTypes: installCommand.rcOptionsTypes(),
workspaceDir: await findWorkspaceDir(dir),
},
),
storeController: s.ctrl,
storeDir: s.dir,
workspacePackages,
} as InstallOptions,
)