refactor(link-bins): always return a result

This commit is contained in:
Zoltan Kochan
2020-10-03 02:35:03 +03:00
parent 9b43176cc4
commit 51311d3ba4
2 changed files with 10 additions and 5 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/link-bins": patch
---
Always return a result.

View File

@@ -29,10 +29,10 @@ export default async (
allowExoticManifests?: boolean
warn: WarnFunction
}
) => {
): Promise<string[]> => {
const allDeps = await readModulesDir(modulesDir)
// If the modules dir does not exist, do nothing
if (allDeps === null) return
if (allDeps === null) return []
const pkgBinOpts = {
allowExoticManifests: false,
...opts,
@@ -60,8 +60,8 @@ export async function linkBinsOfPackages (
opts: {
warn: WarnFunction
}
) {
if (!pkgs.length) return
): Promise<string[]> {
if (!pkgs.length) return []
const allCmds = R.unnest(
(await Promise.all(
@@ -83,7 +83,7 @@ async function linkBins (
opts: {
warn: WarnFunction
}
) {
): Promise<string[]> {
if (!allCmds.length) return [] as string[]
await fs.mkdir(binsDir, { recursive: true })