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

avoid parsing argv when using as a lib #8

Open
missinglink opened this issue Nov 18, 2021 · 0 comments
Open

avoid parsing argv when using as a lib #8

missinglink opened this issue Nov 18, 2021 · 0 comments

Comments

@missinglink
Copy link

missinglink commented Nov 18, 2021

when requiring this lib for use in an external codebase the lib/oa.js file calls minimist from the module scope to process process.argv.

this in turn leads to requiring minimist as a runtime dep when not using the CLI interface.

https://github.com/openaddresses/lib/blob/master/oa.js#L11-L18

one potential solution is to use something like this if (require.main === module) { to distinguish between execution and inclusion.

alternatively this functionality could be moved to lib/src/cli.js and only run when the CLI interface is executed.

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

1 participant