Skip to content

Build dist on prepack so the wctools CLI isn't published broken - #164

Open
binlabs wants to merge 3 commits into
wc-toolkit:mainfrom
binlabs:main
Open

binlabs wants to merge 3 commits into
wc-toolkit:mainfrom
binlabs:main

Conversation

@binlabs

@binlabs binlabs commented Oct 7, 2026

Copy link
Copy Markdown

I hit this as a consumer: @wc-toolkit/wctools 0.0.17–0.0.19 ship src/ but no dist/, so the bin (dist/cli.js) is missing and the CLI won't install. 0.0.16 was the last good one. Figured I'd try my hand at it.

The cause is in the publish workflow. The build step got moved to after changeset publish (in #79). Since dist/ is gitignored and changeset publish doesn't build each package, the tarballs go out with /src, /test, etc but no dist.

@wc-toolkit/language-server had the same issue.

Instead of relying on workflow ordering, I added a prepack hook to both published packages so dist/ (and bin/) is always built when the package is packed, plus an explicit files list for wctools. Verified with npm pack --dry-run that dist/cli.js now lands in the tarball.

While I was here I also fixed the repo metadata. The root package.json still pointed at the volarjs/starter template, and wctools had no repository field at all (which is why it took me a while to find where to file issue #163 😆). Added repository/bugs/homepage across the packages.

Changesets included (patch bumps for wctools + language-server).

Any feedback appreciated.

The publish workflow (3887c74, PR wc-toolkit#79) moved the `pnpm build` step to
after `changeset publish`, so npm packages were packed before their
build output existed. Since `dist/` is gitignored and `changeset
publish` doesn't run each package's build, wctools and language-server
shipped from 0.0.17 / 0.0.7 onward with no `dist/` (and no `bin/`),
leaving their `bin` entries pointing at missing files and the CLIs
unusable.

Add a `prepack` build hook to both published packages so build output
is regenerated whenever the package is packed, independent of workflow
step ordering. Also add an explicit `files: ["dist"]` allowlist to
wctools (language-server already has one).
The root package.json still referenced the volarjs/starter template, and
several packages (notably the published @wc-toolkit/wctools) had no
repository/bugs/homepage fields at all, making it hard to find the repo
from npm to file an issue.

Set repository (with per-package `directory`), bugs, and homepage on the
root and all workspace packages, matching the shape language-server
already used. demos/npm left untouched (throwaway consumer demo).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant