Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: silent programmatic usage #151

Merged
merged 6 commits into from Jun 7, 2023

Conversation

millsp
Copy link
Contributor

@millsp millsp commented Apr 5, 2023

Description

At Prisma, we were looking for a robust and nice abstraction to handle multiple package manager installs/commands. We've found you 馃槃 ! We plan to use some of ni's internals in order to reliably run package manager commands via our own CLI. We are currently using getCommand for that. However, we don't want ni's output to leak warnings as we would like to handle that ourselves.

For this reason, I implemented a silent/programmatic mode which, right now, would be available for programmatic usages. Maybe later on it would be the base to bring a --silent for instance, but for now is limited to our own use-case. It prevents most console logging except for --help and debug, while also preventing prompts, and throwing errors instead of process.exit.

Linked Issues

Additional context

@millsp millsp changed the title feat: silent mode for programmatic usage feat: silent programmatic usage Apr 6, 2023
src/fs.ts Outdated Show resolved Hide resolved
src/commands/nr.ts Outdated Show resolved Hide resolved
@millsp millsp marked this pull request as draft April 6, 2023 21:45
@millsp millsp marked this pull request as ready for review April 6, 2023 23:24
@millsp millsp requested a review from antfu April 6, 2023 23:44
@millsp
Copy link
Contributor Author

millsp commented Apr 11, 2023

I fixed the linting errors and cleaned up some other things along the way while also adding two functional test suites to be able to test and snapshot what happens when a lockfile is found or when packageManager is set. I could not test all the commands, as it would need a small refactor, that is currently out of scope, but happy to contribute on that later :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants