Skip to content

Commit

Permalink
feat: support update patterns separated by commas (#7881)
Browse files Browse the repository at this point in the history
## Proposed Changes

- Patterns passed to the update command may be splitted with commas. For
example, `bit update "@babel/types,@mdx-js/mdx"`
  • Loading branch information
zkochan authored Sep 6, 2023
1 parent 244c336 commit 04d0bce
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scopes/workspace/install/update.cmd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class UpdateCmd implements Command {
{
name: 'package-patterns...',
description:
'a string list of package names, or patterns (separated by space), e.g. "@teambit/** @my-org/ui/**". The patterns should be in glob format. By default, all packages are selected.',
'a string list of package names, or patterns (separated by spaces or commas), e.g. "@teambit/**,@my-org/ui/**". The patterns should be in glob format. By default, all packages are selected.',
},
];
options = [
Expand All @@ -47,9 +47,17 @@ export default class UpdateCmd implements Command {
}
await this.install.updateDependencies({
all: options.yes === true,
patterns,
patterns: splitPatterns(patterns),
forceVersionBump,
});
return '';
}
}

function splitPatterns(patterns: string[]): string[] {
const splittedPatterns: string[] = [];
for (const pattern of patterns) {
splittedPatterns.push(...pattern.split(/[, ]/));
}
return splittedPatterns;
}

0 comments on commit 04d0bce

Please sign in to comment.