Skip to content

Commit

Permalink
style: 🎨 fixed linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 13, 2020
1 parent cfbe921 commit 5cb2c40
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions src/pnp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { existsSync } from "fs"
import { readFileSync } from "fs"
import { existsSync, readFileSync } from "fs"
import path, { resolve } from "path"
import v8 from "v8"
import zlib from "zlib"
Expand All @@ -19,6 +18,10 @@ type InstallState = {
>
}

type PnpAPI = {
resolveRequest: (bin: string, dir: string) => string
}

export function getBinaries(workspaceRoot: string, packageName: string) {
const binaries = new Map<string, string>()

Expand Down Expand Up @@ -49,10 +52,12 @@ export function getBinaries(workspaceRoot: string, packageName: string) {
try {
const pkgName = p.scope ? `@${p.scope}/${p.name}` : p.name
const binPath = resolveRequest(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
path.join(pkgName, p.bin.get(b)!),
process.cwd()
)
binaries.set(b, binPath)
// eslint-disable-next-line no-empty
} catch {}
})
}
Expand All @@ -61,12 +66,8 @@ export function getBinaries(workspaceRoot: string, packageName: string) {
return binaries
}

function getPnpApi(workspaceRoot: string) {
function getPnpApi(workspaceRoot: string): PnpAPI {
const jsPath = path.resolve(workspaceRoot, ".pnp.js")
const cjsPath = path.resolve(workspaceRoot, ".pnp.cjs")
if (existsSync(jsPath)) {
return require(jsPath)
} else {
return require(cjsPath)
}
return (existsSync(jsPath) ? require(jsPath) : require(cjsPath)) as PnpAPI
}
2 changes: 1 addition & 1 deletion src/spawn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class Spawner {
FORCE_COLOR: `${chalk.level}`,
...this.env,
}

const child = spawn(this.cmd, this.args, {
env,
stdio: raw ? "inherit" : "pipe",
Expand Down

0 comments on commit 5cb2c40

Please sign in to comment.