From e946a1fad8b83d1a88b37d6ad1784c0b0cc1b458 Mon Sep 17 00:00:00 2001 From: Kipras Melnikovas Date: Wed, 3 Nov 2021 18:20:40 +0200 Subject: [PATCH] feat: allow specifying multiple transforms maybe would be nicer if the interface would be `-t t1 -t t2 -t t3` instead of current `-t t1,t2,t3` (you could separate into multiple lines and keep it cleaner), but don't know how to do that so this works just fine. Signed-off-by: Kipras Melnikovas --- packages/cli/src/index.ts | 2 +- packages/cli/src/main.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index b5ee325f2..08fc7ea69 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -16,7 +16,7 @@ program .usage('[global options] ...') .option( '-t, --transform ', - 'The transform to run, will prompt for a transform if not provided and no module is passed', + 'The transform(s) to run, will prompt for a transform if not provided and no module is passed\nTo provide multiple transforms, separate them with commas (e.g. "-t t1,t2,t3")', ) .option( '--packages ', diff --git a/packages/cli/src/main.ts b/packages/cli/src/main.ts index 5ae27236b..4b17992b1 100644 --- a/packages/cli/src/main.ts +++ b/packages/cli/src/main.ts @@ -23,7 +23,11 @@ export default async function main(paths: string[], flags: Flags) { } if (flags.transform) { - transforms.push(flags.transform); + if (flags.transform.includes(',')) { + flags.transform.split(',').forEach(t => transforms.push(t.trim())); + } else { + transforms.push(flags.transform); + } } const packageManager = new PluginManager();