javascript - NPM Package - How to use a custom config file? -


i'm writing npm package cli tool. tool requires custom config file developer has include in root directory of project. many plugins so. name few:

  • webpack -> webpack.config.js
  • karma -> karma.conf.js
  • postcss webpack plugin -> postcss.conf.js

so idea, want similar. let's name package have my-package now. developer install package via npm install my-package. folder structure this:

// projectroot my-package.config.js ... node_modules/   ↳ my-package/     ↳ dist/         index.js // main package file 

so index.js file in my-package, how require config file my-package.conf.js in root of developer's project? there conventions doing this? can use node.js fs.readfile or something, i'm looking best practices here.

anyone ideas?

thanks!


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

ios - Change Storyboard View using Seague -

verilog - Systemverilog dynamic casting issues -