Shaun Luttin
Shaun Luttin

Reputation: 141652

Where do we save demo app dependencies when buiding a module?

I am building my first node module. Inside the module there is a demo application. The demo is only useful during development. Where do we put the demo's dependencies?

The first answer that comes to mind, is to put them into devDependencies, because they are only useful during development. That being said, usually I reserve devDependencies for build tools not for modules that run the (demo) app.

So the question is, when developing a module that contains its own demo app, where does one put the demo app's dependencies?

This is the module: https://github.com/shaunluttin/aurelia-open-id-connect

Here is a high-level graph of the dependencies in my module. The locations in () are based on the answer from Pranesh.

demo
  third-party-modules (optionalDependencies)
  my-module
    third-party-modules (dependencies)

When someone installs our module, we want them only to pull down my-module/third-party-modules. When someone clones our repo, we want them top be able to also pull down demo/third-party-modules.

Upvotes: 1

Views: 30

Answers (1)

Pranesh Ravi
Pranesh Ravi

Reputation: 19123

In most cases, demo apps will be dependent on the module you build, aurelia-open-id-connect in your case. If you have any other dependencies for the demo app other than your module, it should come under optionalDependencies.

Refer this

These modules should be installed with -O option. Example, npm i express -O

Upvotes: 1

Related Questions