Skip to content

chore(core): commit built dist/ for git-dependency consumption#239

Open
sksizer wants to merge 1 commit into
mainfrom
chore/git-dep-dist
Open

chore(core): commit built dist/ for git-dependency consumption#239
sksizer wants to merge 1 commit into
mainfrom
chore/git-dep-dist

Conversation

@sksizer

@sksizer sksizer commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Problem

The package is private (no npm publish) and meant to be consumed as a git dependency (github:sksizer/markdown-contract#<ref>&path:packages/core). But exports/types/bin all point into dist/, which is gitignored — so every git install resolves to a package with no code. Downstream (sksizer/family) currently works around this by vendoring a hand-built tarball in-repo.

Why not a prepare script

Tried and verified it fails for real consumers:

  • A git-installed dependency never receives its own devDependencies, so tsc/@types aren't there to build with.
  • pnpm ≥10 refuses to run git-dep build scripts unless every consumer adds the package to onlyBuiltDependencies.
  • Even allowlisted, pnpm's prepare flow mis-detects the install tool for this repo and shells out to yarn install (ERR_PNPM_PREPARE_PACKAGE: spawn yarn ENOENT).
  • Bun blocks git-dep lifecycle scripts by default too.

Fix

Commit the built dist/ (39 modules + d.ts + maps) and carve packages/core/dist out of the root gitignore, with a comment explaining why. No lifecycle scripts added — consumers just pack what's in the tree (files: ["dist"]), which is deterministic across pnpm/bun/npm and needs zero consumer-side configuration.

Verified end to end with a fresh consumer:

pnpm add "git+<this repo>#chore/git-dep-dist&path:packages/core"
# → Done in 1.6s; node_modules/markdown-contract/dist/ present; imports resolve

Maintenance

dist/ must be rebuilt (bun run build in packages/core) whenever src/ changes — noted in the gitignore comment. A lefthook pre-push check (build + diff) could enforce freshness later if drift becomes a problem.

Supersedes the stale chore/add-prepare-script branch (cut ~1000 commits ago, pre-monorepo), which reached the same conclusion; that branch can be deleted.

Once merged, sksizer/family can drop vendor/markdown-contract-0.1.0-69c4e66.tgz and depend on a plain git ref.

The package is consumed as a private git dependency (no npm publish) and
exports/types/bin all point into dist/. A git install can't build it on the
consumer's machine: the dependency never receives its own devDependencies
(no tsc/@types), and pnpm/bun both block lifecycle scripts of git deps by
default — pnpm additionally mis-detects the install tool for the prepare
flow (tries yarn). So the committed dist/ is what git installs resolve
against. Rebuild with 'bun run build' in packages/core when src/ changes.
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