diff --git a/src/applyPatches.ts b/src/applyPatches.ts index 4d3d2798..37b3c189 100644 --- a/src/applyPatches.ts +++ b/src/applyPatches.ts @@ -51,11 +51,15 @@ function getInstalledPackageVersion({ return semver.valid(version) } -export function applyPatchesForApp( - appPath: string, - reverse: boolean, - patchDir: string, -): void { +export function applyPatchesForApp({ + appPath, + reverse, + patchDir, +}: { + appPath: string + reverse: boolean + patchDir: string +}): void { const patchesDirectory = join(appPath, patchDir) const files = findPatchFiles(patchesDirectory) diff --git a/src/index.ts b/src/index.ts index fd4f67ed..ae7bb733 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,10 +35,6 @@ if (argv.version || argv.v) { } else if (argv.help || argv.h) { printHelp() } else { - const packageManager = detectPackageManager( - appPath, - argv["use-yarn"] ? "yarn" : null, - ) const patchDir = slash(normalize((argv["patch-dir"] || "patches") + sep)) if (patchDir.startsWith("/")) { throw new Error("--patch-dir must be a relative path") @@ -56,7 +52,10 @@ if (argv.version || argv.v) { /package\.json$/, argv["case-sensitive-path-filtering"], ) - + const packageManager = detectPackageManager( + appPath, + argv["use-yarn"] ? "yarn" : null, + ) packageNames.forEach((packagePathSpecifier: string) => { makePatch({ packagePathSpecifier, @@ -70,7 +69,7 @@ if (argv.version || argv.v) { } else { console.log("Applying patches...") const reverse = !!argv["reverse"] - applyPatchesForApp(appPath, reverse, patchDir) + applyPatchesForApp({ appPath, reverse, patchDir }) } }