updateCommand method
Builds the argv to upgrade the project's dependencies.
- pnpm →
pnpm update [--latest] - yarn →
yarn upgrade [--latest] - npm →
npm update— npm has no cross-major update, solatestmakes no difference there
latest crosses major versions, mirroring dart pub upgrade --major-versions.
--no-save is deliberately not passed. It would keep package.json
untouched, but a --latest that cannot widen the declared range leaves
the lock file resolving outside it, and the next
pnpm install --frozen-lockfile in CI fails with
ERR_PNPM_OUTDATED_LOCKFILE.
Implementation
({String executable, List<String> args}) updateCommand({
required bool latest,
}) => switch (this) {
TypeScriptPackageManager.pnpm => (
executable: 'pnpm',
args: <String>['update', if (latest) '--latest'],
),
TypeScriptPackageManager.yarn => (
executable: 'yarn',
args: <String>['upgrade', if (latest) '--latest'],
),
TypeScriptPackageManager.npm => (
executable: 'npm',
args: const <String>['update'],
),
};