Considering the Node.js package manager, namely npm - I was curious if the publish command performs the pack command prior to the publish or if it does something different altogether? So if I were to execute:
npm publish <folder>
Does it first perform the following:
npm pack <folder>
I was unable to find anything mentioned in the documentation.
npm publish
without the explicit npm pack
prior, but the package doesn't appear to have the expected contents. i.e.; the contents of the .tgz
differ when I perform a local npm pack
to that of the contents of the npm publish
.
Having a look at the NPM source you can see that it arrives in the publishFromDirectory function, and calls into the pack module.
https://github.com/npm/npm/blob/b80d650def417645d2525863e9f17af57a917b42/lib/publish.js#L79 and again at https://github.com/npm/npm/blob/b80d650def417645d2525863e9f17af57a917b42/lib/publish.js#L88
If you follow through into the pack module, you can see that the _pack
function performs the same 2 steps:
https://github.com/npm/npm/blob/114d518c75732c42acbef3acab36ba1d0fd724e2/lib/pack.js#L67
So, to answer your question, it doesn't do exactly pack <folder>
but does call into the same major code paths.
The code there is mostly well written and not difficult to follow, I would encourage you to dig into the source code of these projects for this type of question as your knowledge on the tools you are using will explode if you do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With