0x80 / isolate-package

Isolate a monorepo package with its internal dependencies to form a self-contained directory with a pruned lockfile
MIT License
121 stars 13 forks source link

Add support for passing CLI arguments #54

Open hugocxl opened 7 months ago

hugocxl commented 7 months ago

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!

0x80 commented 7 months ago

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.

hugocxl commented 7 months ago

@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:

0x80 commented 7 months ago

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.

hugocxl commented 7 months ago

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

matthewaptaylor commented 5 months ago

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 ?

0x80 commented 5 months ago

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.