Closed gonzofish closed 7 years ago
Ok, I believe I've figured this out--it involved changes to the build process. The use of np
was not added by me and I didn't know enough about it. So I did a little research and, instead of running the build
step as part of preTagVersion
step, we're doing it at prepublish
. By doing this, np
will go about business as usual and build the package into dist
right before publishing. We then change into the dist
directory before np
runs npm publish
and it should work.
This also required another change: the package.json
's peerDependencies
need to go back to dependencies
so that we can effectively test. At build time we change it to peerDependencies
so consumers will have a better dev experience.
Still working it out: https://github.com/sindresorhus/np/issues/175
I believe I've "solved" it, until I get an answer back from the np
team/community.
Instead of letting np
do the npm publish
, we pass it a --no-publish
flag and then do npm run build && npm publish dist
as a posttagVersion
script.
The np
team isn't going to provide a way of doing this, so for now we'll keep using np --no-publish
+ npm run build && npm publish dist
to accomplish this
Noticed in my testes that my project's
package.json
version isn't getting publish. I also noticed that no Git tags were being created either.This is because we're using np, which is a great library. However, because of the way it works, as part of
tagVersion
, wecd
intodist
. When we do this, thedist
version ofpackage.json
does get bumped, but the realpackage.json
does not.Also, because we're in
dist
, no tags are being created or pushed.