I am trying to stage dependencies from the NPM registry in a Nexus NPM proxy repository for any arbitrary JavaScript project. I can perform an npm install
or yarn install
which will cause all the dependencies to be staged, but I'd like to avoid that. The main reason is I want to avoid needing the necessary C/C++ libraries installed to compile the dependencies that are NodeJS C/C++ add-ons.
The only solution I can think of is by parsing the package-lock.json/yarn.lock file and running npm pack <dependency>
for each dependency, which will cause npm to fetch the needed dependency and copy the tarball of the dependency to the current directory. I could then delete each downloaded tarball.
Is there a more elegant solution for either npm or yarn?