Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@ionic/cli/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ export interface ITelemetry {
sendCommand(command: string, args: string[]): Promise<void>;
}

export type NpmClient = 'yarn' | 'npm' | 'pnpm';
export type NpmClient = 'yarn' | 'yarn-berry' | 'npm' | 'pnpm';

export type FeatureId = 'ssl-commands';

Expand Down
1 change: 1 addition & 0 deletions packages/@ionic/cli/src/lib/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export abstract class BuildRunner<T extends BuildOptions<any>> implements Runner
npm: NpmBuildCLI,
pnpm: PnpmBuildCLI,
yarn: YarnBuildCLI,
'yarn-berry': YarnBuildCLI,
};

const client = this.e.config.get('npmClient');
Expand Down
13 changes: 12 additions & 1 deletion packages/@ionic/cli/src/lib/utils/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,30 @@ export async function pkgManagerArgs(npmClient: NpmClient, options: PkgManagerOp
}
}

let installerExec: string = '';
const installerArgs: string[] = [];

switch (npmClient) {
case 'npm':
installerExec = 'npm';
vocab = { run: 'run', install: 'i', bareInstall: 'i', uninstall: 'uninstall', dedupe: 'dedupe', rebuild: 'rebuild', global: '-g', save: '--save', saveDev: '-D', saveExact: '-E', nonInteractive: '', lockFileOnly: '--package-lock-only' };
break;
case 'yarn':
installerExec = 'yarn';
vocab = { run: 'run', install: 'add', bareInstall: 'install', uninstall: 'remove', dedupe: '', rebuild: 'install', global: '', save: '', saveDev: '--dev', saveExact: '--exact', nonInteractive: '--non-interactive', lockFileOnly: '' };
if (options.global) { // yarn installs packages globally under the 'global' prefix, instead of having a flag
installerArgs.push('global');
}
break;
case 'yarn-berry':
installerExec = 'yarn';
vocab = { run: 'run', install: 'add', bareInstall: 'install', uninstall: 'remove', dedupe: '', rebuild: 'install', global: '', save: '', saveDev: '--dev', saveExact: '--exact', nonInteractive: '', lockFileOnly: '' };
if (options.global) { // yarn installs packages globally under the 'global' prefix, instead of having a flag
installerArgs.push('global');
}
break;
case 'pnpm':
installerExec = 'pnpm';
vocab = { run: 'run', install: 'add', bareInstall: 'install', uninstall: 'remove', dedupe: '', rebuild: 'rebuild', global: '--global', save: '', saveDev: '--save-dev', saveExact: '--save-exact', nonInteractive: '', lockFileOnly: '--lockfile-only' };
break;
default:
Expand Down Expand Up @@ -171,7 +182,7 @@ export async function pkgManagerArgs(npmClient: NpmClient, options: PkgManagerOp
installerArgs.push('--json');
}

return [npmClient, ...installerArgs];
return [installerExec, ...installerArgs];
}

/**
Expand Down