As requested in #59, this PR adds the ability to run electronegativity programmatically.
This is mainly achieved by replacing the main field in the package.json with dist/runner.js. Running the CLI still works as the bin field still references dist/index.js.
I think users of the programmatic interface will also appreciate not having the implement the preparation done in runner.js themselves, so I have opted to refactor the run() function to make it usable both as a CLI and programmatically by introducing an optional isCli parameter. This unfortunately requires quite a few new conditionals in that function, so let me know if you prefer a different implementation.
I have also included the add-module-exports Babel plugin, so users don't have to explicitly specify the default export (require('@doyensec/electronegativity').default). If you would prefer not to use this plugin, let me know.
Hey @baltpeter! Thank you for this awesome contribution :clap:
With this change even more developers will be able to easily integrate Electronegativity in their CI/CAS pipeline!
As requested in #59, this PR adds the ability to run electronegativity programmatically.
This is mainly achieved by replacing the
main
field in thepackage.json
withdist/runner.js
. Running the CLI still works as thebin
field still referencesdist/index.js
.I think users of the programmatic interface will also appreciate not having the implement the preparation done in
runner.js
themselves, so I have opted to refactor therun()
function to make it usable both as a CLI and programmatically by introducing an optionalisCli
parameter. This unfortunately requires quite a few new conditionals in that function, so let me know if you prefer a different implementation.I have also included the
add-module-exports
Babel plugin, so users don't have to explicitly specify the default export (require('@doyensec/electronegativity').default
). If you would prefer not to use this plugin, let me know.