Skip to content

Commit

Permalink
fix: remove .cmd extension for pnpm and npm invocations (#13133)
Browse files Browse the repository at this point in the history
Co-authored-by: 0.618 <[email protected]>
Co-authored-by: Roshane Pascual <[email protected]>
  • Loading branch information
3 people authored Sep 27, 2023
1 parent ef1c43f commit ea81e43
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/amplify-cli-core/src/utils/packageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ export interface PackageManager {
getInstallArgs: (buildType: BuildType) => string[];
}

const isWindows = process.platform === 'win32';

class NpmPackageManager implements PackageManager {
readonly packageManager = 'npm';
readonly displayValue = 'NPM';
readonly executable = isWindows ? 'npm.cmd' : 'npm';
readonly executable = 'npm';
readonly lockFile = 'package-lock.json';

getRunScriptArgs = (scriptName: string) => ['run-script', scriptName];
Expand All @@ -40,7 +38,7 @@ class NpmPackageManager implements PackageManager {
class YarnPackageManager implements PackageManager {
readonly packageManager: PackageManagerType = 'yarn';
readonly displayValue = 'Yarn';
readonly executable = 'yarn'; // Windows does not require `.cmd` extension to invoke yarn
readonly executable = 'yarn';
readonly lockFile = 'yarn.lock';
version?: SemVer;

Expand All @@ -54,7 +52,7 @@ class YarnPackageManager implements PackageManager {
class PnpmPackageManager implements PackageManager {
readonly packageManager: PackageManagerType = 'pnpm';
readonly displayValue = 'PNPM';
readonly executable = isWindows ? 'pnpm.cmd' : 'pnpm';
readonly executable = 'pnpm';
readonly lockFile = 'pnpm-lock.yaml';

getRunScriptArgs = (scriptName: string) => [scriptName];
Expand Down

0 comments on commit ea81e43

Please sign in to comment.