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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashes on bad directory/malformed package.json #79

Open
Allow2CEO opened this issue Feb 14, 2021 · 4 comments
Open

Crashes on bad directory/malformed package.json #79

Allow2CEO opened this issue Feb 14, 2021 · 4 comments

Comments

@Allow2CEO
Copy link

Probably need some extra checks in the code.

I had a .idea folder in the plugins directory and also had a test plugin in there that had a syntax error in the package.json (missing key quotes, duh!)

Anyway, the epm.list function (and maybe others) should probably just reject (or log) any non-compliant plugin folders.
Such as if package.json is missing or cannot be JSON parsed.

@pksunkara
Copy link
Owner

What was the error message/stacktrace you were getting?

IIRC, the plugin uses pacote (used by npm) underneath to load the packages. I guess it assumes that everything is valid.

@Allow2CEO
Copy link
Author

Allow2CEO commented Feb 14, 2021

Ah, maybe a couple of basic pre-checks then.
npm is more a developer-side tool, the end user won't know that a spurious folder or corrupted package.json is causing your app to crash.

The error is easy to reproduce, put a blank folder in plugins folder, or modify a package.json to be invalid.

Nice library by the way. Using it to make our parental freedom automation app extensible.

@pksunkara
Copy link
Owner

I think I can do something to improve here. But can you please help me with what other functions fail?

@Allow2CEO
Copy link
Author

Sure, simple improvement here and I'll post other issues as I come across them. Thanks!

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

No branches or pull requests

2 participants