1

I have a main package.json for my project. I also have a component within my project which I'm publishing to NPM, so that requires its own package.json.

package.json
index.html
-folder
--component-folder
---package.json

Both package.json files define dependancies. At the moment I have to run npm install from both my project root and from component-folder. Is there a way of making it install dependancies for both when its only run from the project root?

Evanss
  • 23,390
  • 94
  • 282
  • 505
  • 1
    I think this is a similar enough issue? http://stackoverflow.com/questions/31773546/the-best-way-to-run-npm-install-for-nested-folders – julianljk Aug 09 '16 at 14:37
  • Similar: http://stackoverflow.com/questions/14381898/local-dependency-in-package-json – Evanss Aug 09 '16 at 15:19

1 Answers1

2

Try using subpackage:

{
    "name": "my-awesome-project",
    "version": "2.5.1",
    "subPackages": [
        "packages/sub-package-1",
        "packages/sub-package-2"
    ]
}

https://www.npmjs.com/package/subpackage

bfontaine
  • 18,169
  • 13
  • 73
  • 107