Closed mcmire closed 7 months ago
tsup
already clears thedist
directly, so in practice abuild:clean
script is not usually necessary, but there are occasions where we want to really be sure thatdist
does not exist, and publishing is one of them. Hence, this commit adds backbuild:clean
, which should fixyarn pack
and the publishing workflow.
Not sure I understand the reasoning here. If tsup
guarantees to clear the dist, isn't it easier to modify the prepack script to run yarn build
?
@Mrtenz I wanted to make sure that we completely remove dist
before publishing so that we can be absolutely certain that unwanted files don't slip into releases.
I checked the tsup
source code and it does seem that everything gets removed from dist
: https://github.com/egoist/tsup/blob/8c26e63c92711d60c05aedd3cdc358530ba266c5/src/index.ts#L303
So yes, you're right, we can just use yarn build
in the prepack script. I've done that here: d04b7e7
The
yarn pack
command is run by thenpm-publish
action prior to publishing the package. Unfortunately, this command does not work as theprepack
lifecycle script is overridden to runyarn build:clean
, which was removed when this repo was converted to usetsup
for building.tsup
already clears thedist
directly, so in practice abuild:clean
script is not usually necessary, but there are occasions where we want to really be sure thatdist
does not exist, and publishing is one of them. Hence, this commit adds backbuild:clean
, which should fixyarn pack
and the publishing workflow.Testing
Running
yarn pack
should not produce any errors.Examples
N/A, as this is a bugfix to this repo.