nwb icon indicating copy to clipboard operation
nwb copied to clipboard

How do install dependencies ONLY for demo?

Open RavenHursT opened this issue 5 years ago • 3 comments

How can I set up a component project created w/ nwb to automatically install npm/yarn dependencies for only the demo?

I'd like to get the material-ui dependency out of this: https://www.npmjs.com/package/react-flex-rating

Don't want to have people have to manually install the package in order to run the demo...

RavenHursT avatar Aug 13 '18 22:08 RavenHursT

Put it in your devDependencies instead.

insin avatar Aug 13 '18 23:08 insin

That could possibly work... Will that work if I decide to make my demo into a hosted GitHub-page?

RavenHursT avatar Aug 14 '18 01:08 RavenHursT

I think this is what you need...

  • Create your app repository using nwb new ....
  • Install dependencies. For example: yarn add material-ui
  • Install devDependencies for non-production: yarn add --dev nwb
  • Build your app
  • Bundle your app in a deployable manner: yarn build -- your files will be inside the dist/ folder.

If anyone wants just the files and dependencies (no nwb) just do yarn install --production. If someone uses your package as a module, this will work as well. On the other hand, if someone is going to use your repo to improve the source and testing and re-building, a regular yarn install will install everything you need (nwb included).

Hope that helps.

lsmoura avatar Dec 10 '18 17:12 lsmoura