I'm sure this is a very specific use-case and one that might not be easily achievable with the current way npm works, but I thought I might ask anyways.
Basically, I'm working on a React component library and was hoping to use npx to run a script defined in the root directory's package.json.
Here's the thing that currently makes me struggle though:
Every component of mine consists of a .js, a .css, a README.md and, yes, a package.json file (which contains one single field. main).
The way npm/npx seem to work is that they consider the folder with the package.json in it the root directory. Which means scripts defined in the actual root package.json aren't found and attempting to call an installed node_modules binary actually downloads the particular node module (since the node module doesn't exist in the component directory AKA the directory npx then erroneously considers the root project directory).
Question: Is there a way to ignore those package.json files inside projectName/src/components/componentName and always fall pack to the package.json inside projectName/?
I'm sure this is a very specific use-case and one that might not be easily achievable with the current way npm works, but I thought I might ask anyways.
Basically, I'm working on a React component library and was hoping to use npx to run a script defined in the root directory's
package.json
.Here's the thing that currently makes me struggle though:
Every component of mine consists of a
.js
, a.css
, aREADME.md
and, yes, apackage.json
file (which contains one single field.main
).The way npm/npx seem to work is that they consider the folder with the
package.json
in it the root directory. Which means scripts defined in the actual rootpackage.json
aren't found and attempting to call an installednode_modules
binary actually downloads the particular node module (since the node module doesn't exist in the component directory AKA the directory npx then erroneously considers the root project directory).Question: Is there a way to ignore those
package.json
files insideprojectName/src/components/componentName
and always fall pack to thepackage.json
insideprojectName/
?