Comments (6)
@mdonnalley Thanks for the help! This isn't a super-high priority for us either, but it's good to have this issue for reference for when it inevitably comes up again.
from core.
@nferch This is where we're handling the MODULE_NOT_FOUND
error: https://github.com/oclif/core/blob/3.16.0/src/config/plugin.ts#L136
Can you help me better understand what you'd like to see changed? Is it that you want the option to always throw on that error? If so, we could make that configurable either through the oclif
section in the package.json or through an environment variable
from core.
@mdonnalley yeah, I came across that when debugging and thought that might be the place. Out of curiosity, under what condition is it useful to swallow that error? Is this the same codepath when a command doesn't actually exist?
I've been seeing the behavior when there's some bad code introduced or some other build error. What has been happening for us is that all commands fail to import so it appears that our CLI has no commands at all. Which is a confusing failure mode for both us and our users, as well as a bit awkward to detect in smoketests.
So I'd prefer to see it handled as a fatal error rather than a command not existing. Having an option to throw the error would probably be fine, but I also wonder if there'd be some way to distinguish the error being thrown on import rather than the import missing altogether. Does that make sense?
from core.
Out of curiosity, under what condition is it useful to swallow that error?
Off the top of my head, I think the idea was that you don't want one bad actor to bring down the entire CLI. So imagine a scenario where someone has installed a plugin that has a faulty init
hook. In that scenario every single command in your CLI will fail because of that one plugin.
Is this the same codepath when a command doesn't actually exist?
That code path is here.
I've been seeing the behavior when there's some bad code introduced or some other build error. What has been happening for us is that all commands fail to import so it appears that our CLI has no commands at all.
Are you able to share a repo that replicates this? Thanks!
from core.
Out of curiosity, under what condition is it useful to swallow that error?
Off the top of my head, I think the idea was that you don't want one bad actor to bring down the entire CLI. So imagine a scenario where someone has installed a plugin that has a faulty
init
hook. In that scenario every single command in your CLI will fail because of that one plugin.
That makes sense. In our case these are all commands in our own CLI, so we'd prefer for the CLI to fail fatally.
Is this the same codepath when a command doesn't actually exist?
That code path is here.
I've been seeing the behavior when there's some bad code introduced or some other build error. What has been happening for us is that all commands fail to import so it appears that our CLI has no commands at all.
Are you able to share a repo that replicates this? Thanks!
The CLI in question is located at https://github.com/dxos/dxos/tree/main/packages/devtools/cli . It's currently in a non-broken state, but you can simulate the failure by adding an invalid import to any of the commands.
from core.
@nferch Sounds like we might just want to make your desired behavior configurable. Is this something you only need for your tests and build processes? If that's the case, then I'd say that it should be an environment variable. But if it's something that you want in production, then it should be a setting in the package.json
We don't have the bandwidth to prioritize this at the moment so I'd recommend making the PR yourself if it's something you need soon. If you do decide to do that, I'm happy to help with any questions you might have.
from core.
Related Issues (20)
- topicSeparator space generates wrong message when used alongside usage HOT 1
- Upgrading to a version after 3.20.0 causes issues with hooks HOT 3
- (help): show arg/flag options if user didn't provide any HOT 1
- Command summary displays as topic summary when nested below topic without summary. HOT 1
- Unable to run dev.js outside of the project folder
- BaseCommand Documentation HOT 3
- Native support for .env files HOT 1
- SimpleAction does not write newline for status change HOT 7
- [BUG]The issue of ux.prompt handling special characters. HOT 3
- Can't run development mode with bun HOT 2
- RangeError on ux.table when column starts with emoji HOT 1
- ux.Table: Incorrect parsing of double quotes when exporting to CSV HOT 3
- ux.table `maxWidth` column option HOT 2
- CliUx.ux.prompt text truncation HOT 3
- Build failure with `exactOptionalPropertyTypes` enabled HOT 5
- [Feature request] Alias a single flag to a set of multiple flags HOT 1
- Getting MaxListenersExceededWarning: Possible EventEmitter memory leak detected. after updating to latest version of oclif HOT 2
- Error bundling @oclif/core into my project HOT 15
- UX tables get displayed along with json output on usage of --json flag HOT 2
- Specify different oclif options for dev and run HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.