Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// It might make sense to throw an exception in this case
return false
}
const pkgs = Object.values(opts.selectedWsPkgsGraph).map((wsPkg) => wsPkg.package)
const allPackagesAreSelected = pkgs.length === allWsPkgs.length
if (pkgs.length === 0) {
return false
}
const manifestsByPath: { [dir: string]: { manifest: ImporterManifest, writeImporterManifest: (manifest: ImporterManifest) => Promise } } = {}
for (const { dir, manifest, writeImporterManifest } of pkgs) {
manifestsByPath[dir] = { manifest, writeImporterManifest }
}
scopeLogger.debug({
selected: pkgs.length,
total: allWsPkgs.length,
workspacePrefix: opts.workspaceDir,
})
const throwOnFail = throwOnCommandFail.bind(null, `pnpm recursive ${cmd}`)
switch (cmdFullName) {
case 'why':
case 'list':
return list(pkgs, input, cmd, opts as any) // tslint:disable-line:no-any
case 'outdated':
return outdated(pkgs, input, cmd, opts as any) // tslint:disable-line:no-any
case 'add':
if (!input || !input.length) {
throw new PnpmError('MISSING_PACKAGE_NAME', '`pnpm recursive add` requires the package name')
if (allWsPkgs.length === 0) {
// It might make sense to throw an exception in this case
return false
}
const pkgs = Object.values(opts.selectedWsPkgsGraph).map((wsPkg) => wsPkg.package)
if (pkgs.length === 0) {
return false
}
const manifestsByPath: { [dir: string]: Omit } = {}
for (const { dir, manifest, writeImporterManifest } of pkgs) {
manifestsByPath[dir] = { manifest, writeImporterManifest }
}
scopeLogger.debug({
selected: pkgs.length,
total: allWsPkgs.length,
workspacePrefix: opts.workspaceDir,
})
const throwOnFail = throwOnCommandFail.bind(null, `pnpm recursive ${cmdFullName}`)
const chunks = opts.sort !== false
? sortPackages(opts.selectedWsPkgsGraph)
: [Object.keys(opts.selectedWsPkgsGraph).sort()]
const store = await createOrConnectStoreController(opts)
// It is enough to save the store.json file once,
// once all installations are done.
// That's why saveState that is passed to the install engine
if (allWsPkgs.length === 0) {
// It might make sense to throw an exception in this case
return
}
const pkgs = Object.values(opts.selectedWsPkgsGraph).map((wsPkg) => wsPkg.package)
if (pkgs.length === 0) {
return
}
const manifestsByPath: { [dir: string]: Omit } = {}
for (const { dir, manifest, writeImporterManifest } of pkgs) {
manifestsByPath[dir] = { manifest, writeImporterManifest }
}
scopeLogger.debug({
selected: pkgs.length,
total: allWsPkgs.length,
workspacePrefix: opts.workspaceDir,
})
const throwOnFail = throwOnCommandFail.bind(null, `pnpm recursive rebuild`)
const chunks = opts.sort !== false
? sortPackages(opts.selectedWsPkgsGraph)
: [Object.keys(opts.selectedWsPkgsGraph).sort()]
const store = await createOrConnectStoreController(opts)
const workspacePackages = arrayOfWorkspacePackagesToMap(allWsPkgs)
const rebuildOpts = Object.assign(opts, {
ownLifecycleHooksStdio: 'pipe',
setTimeout(() => {
if (config.force === true) {
logger.warn({
message: 'using --force I sure hope you know what you are doing',
prefix: config.dir,
})
}
if (cmd !== 'recursive') {
scopeLogger.debug(workspaceDir
? { selected: 1, workspacePrefix: workspaceDir }
: { selected: 1 })
}
try {
const result = pnpmCmds[cmd](
cliArgs,
// TypeScript doesn't currently infer that the type of config
// is `Omit` after the `delete config.reporter` statement
config as Omit,
argv.remain[0]
)
if (result instanceof Promise) {
result
.then((output) => {
if (typeof output === 'string') {