Reputation: 23563
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?
Upvotes: 1
Views: 7761
Reputation: 46
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
Upvotes: 3