Before publishing a new version to npm, we must verify the full pipeline end-to-end:
Source code -> TypeScript build -> npm pack -> npm install (tarball) -> Consumer site build -> Live site verification
This ensures the package is correctly built, packaged, and consumable by real downstream projects. Unit tests alone cannot catch packaging issues (missing files, broken exports, module format mismatches, etc.).
cd packages/core
rm -rf dist tsconfig.tsbuildinfo
npx tscVerify: no errors, dist/ directory populated.
npm pack --dry-run # inspect contents first
npm pack # create the .tgzVerify:
- No warnings (especially about
binentries being removed) - All expected files present:
dist/,templates/,bin/,README.md,LICENSE - No unexpected files (no
src/, no internal planning docs)
cd /path/to/consumer-project
rm -rf node_modules/@hacktoolkit .next
npm install /path/to/hacktoolkit-nextjs-htk-X.Y.Z.tgz
make buildRepeat for each consumer project.
Verify: build completes successfully.
If you have a dev or staging environment that serves from the docs/ directory (Next.js static export), make build immediately updates the live site. Verify with curl or a browser.
To confirm the package is actually being used (not cached/stale):
- Break: Modify a function in the package source (e.g., prefix
buildFullAddressoutput withBROKEN-PKG-TEST) - Build + Pack:
npx tsc && npm pack - Install:
npm install /path/to/tarball.tgz - Rebuild consumer:
rm -rf .next && make build - Verify broken: Check the built output or dev site and confirm the broken output appears
- Fix: Revert the source change
- Repeat steps 2-4
- Verify fixed: Confirm the broken output is gone
Important: Always rm -rf .next before rebuilding - Next.js aggressively caches and may serve stale output.
tsconfig.tsbuildinfocache: Ifincremental: trueis set (inherited from root tsconfig), tsc may skip emitting files if it thinks nothing changed. Always deletetsconfig.tsbuildinfobefore a clean build.- Next.js
.nextcache: Mustrm -rf .nextwhen testing package changes, otherwise the consumer build may use cached modules. "type": "module"incompatibility: The compiled TypeScript output uses extensionless imports (export * from './address'). Node.js ESM requires explicit extensions, so"type": "module"must NOT be set. Bundlers (Next.js/webpack) handle extensionless imports fine.- npm tarball vs symlink: When installing from a tarball (
npm install ./file.tgz), npm copies files. When usingfile:protocol in package.json, npm creates a symlink. The tarball test is closer to what real consumers experience from npm.