Skip to content

Commit f11fcaa

Browse files
alan-agius4clydin
authored andcommitted
refactor(@angular/cli): remove coercion from packages positional configuration
Configure the `packages` positional argument to be an array instead of using `coerce` method.
1 parent 689c827 commit f11fcaa

File tree

1 file changed

+4
-6
lines changed
  • packages/angular/cli/src/commands/update

1 file changed

+4
-6
lines changed

packages/angular/cli/src/commands/update/cli.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ export class UpdateCommandModule extends CommandModule<UpdateCommandArgs> {
7070
return localYargs
7171
.positional('packages', {
7272
description: 'The names of package(s) to update.',
73-
coerce: (value) => (typeof value === 'string' ? [value] : value) as string[] | undefined,
73+
type: 'string',
74+
array: true,
7475
})
7576
.option('force', {
7677
description:
@@ -872,15 +873,12 @@ export class UpdateCommandModule extends CommandModule<UpdateCommandArgs> {
872873
* @returns the version to install or null when there is no update to install.
873874
*/
874875
private async checkCLIVersion(
875-
packagesToUpdate: string[] | string | undefined,
876+
packagesToUpdate: string[] | undefined,
876877
verbose = false,
877878
next = false,
878879
): Promise<string | null> {
879880
const { version } = await fetchPackageManifest(
880-
`@angular/cli@${this.getCLIUpdateRunnerVersion(
881-
typeof packagesToUpdate === 'string' ? [packagesToUpdate] : packagesToUpdate,
882-
next,
883-
)}`,
881+
`@angular/cli@${this.getCLIUpdateRunnerVersion(packagesToUpdate, next)}`,
884882
this.context.logger,
885883
{
886884
verbose,

0 commit comments

Comments
 (0)