isolate-package icon indicating copy to clipboard operation
isolate-package copied to clipboard

Add support for passing CLI arguments

Open hugocxl opened this issue 1 year ago • 6 comments

Hi @0x80, I wonder if that could be a possibility, I am currently using isolate through cli, but I am not able to pass down any arg.

In case it makes sense, I am willing to help.

Thanks!

hugocxl avatar Feb 29 '24 17:02 hugocxl

I'm open to it. It might make sense for some parameters. It was no priority for me because I didn't run into a situation myself where I felt like it would want to use them.

Most of the configurations are kind of set-and-forget I think, but I agree that it's unusual to not accept any arguments via CLI.

What would you suggest to use for arguments parsing? I am familiar with minimist and meow.

0x80 avatar Feb 29 '24 21:02 0x80

@0x80 Thanks for your reply. To provide more ctx: in our case, we are using it as part of the build script:

It'd be useful for us to be able to pass down options here.

About your question: I've used cac before. It's pretty common to see it in action in well-established projects, but I really has no preference.

Leaving some refs:

  • https://github.com/chakra-ui/panda/blob/main/packages/cli/src/cli-main.ts
  • https://github.com/egoist/tsup/blob/dev/src/cli-main.ts
  • https://github.com/terai-labs/terai/blob/master/packages/dev/src/cli.ts

hugocxl avatar Mar 01 '24 13:03 hugocxl

Could you give an example of the arguments you would like to pass during build?

I understand that arguments are useful if they differ between use-cases within the same repository, but I haven't been in a situation where I needed to change the configuration between build scripts or deployment targets.

If I understand more about your needs, then I can prioritize that maybe.

0x80 avatar Mar 01 '24 18:03 0x80

Sure, configuring "isolateDirName" and "logLevel" would be useful for me in that case

hugocxl avatar Mar 02 '24 07:03 hugocxl

I'd like to isolate multiple packages from the root of a monorepo because of limitations with my build pipeline, and would also find passing CLI arguments useful. I'm willing to open a PR for this @0x80 ?

matthewaptaylor avatar May 12 '24 22:05 matthewaptaylor

Hi @matthewaptaylor I can probably start working on this soon. I don't want to promise anything but it might be this week...

That being said, if you want to go for it, I'm open to PRs too. I briefly looked into some option (command.js, cac, minimist, yargs, oclif, meow) and I think I prefer to use meow, because it's simple, modern, and sufficient. Also, I already use it in other projects, and it has no dependencies.

0x80 avatar May 13 '24 10:05 0x80