I’m building an internal application that will use npm to resolve modules, then perform some transforms. Given a package name,
"@my/module", and a version string,
"^3.2.0", what’s the best programmatic way to fetch
@my/module@^3.2.0? I need the actual contents on disk somewhere, though I don’t necessarily want to install them to
./node_modules since that might interfere with the modules that run the app.
This StackOverflow question suggests that the only officially supported API is the CLI, so I should shell out to that. But both the question and the answer are from 2013. Is that still the correct answer?