My goal is to automate publishing to NPM within my CI/build system. I came across libnpmpublish, which appears to be the right tool for the job. However, it clearly states that it does not package code into a tarball, even though the publish
API requires a tarball input instead of a folder or path.
The suggested workaround is:
Since
libnpmpublish
doesn't create tarballs on its own, one solution is to generate your own tarball for publishing by running npm pack in the desired directory. You can then useand provide that along withfs.createReadStream('my-proj-1.0.0.tgz')
require('./package.json')
tolibnpmpublish
.
I'm wondering if there's a way to script this process programmatically in Node. I searched through NPM repositories but couldn't find a dedicated packaging tool. Although I did come across this code that seems to handle packing, it's part of an archived repository and not under libnpm
.