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

Split CLI.js and move getConfig to its own file #36

Closed
joemaller opened this issue Sep 12, 2022 · 0 comments
Closed

Split CLI.js and move getConfig to its own file #36

joemaller opened this issue Sep 12, 2022 · 0 comments
Assignees

Comments

@joemaller
Copy link
Owner

Apparently the old Python-style require.main === module has no equivalent in ESM node modules:

How can I detect whether my node.js file was called directly from console (windows and unix systems) or loaded using the ESM module import ( import {foo} from 'bar.js')

Such functionality is not exposed. For the moment you should separate your cli and library logic into separate files.

Split the getConfig code out of cli.js so this is both testable and usable from the command line

@joemaller joemaller self-assigned this Sep 12, 2022
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