Skip to content

fix(env): align package.json exports with emitted build output and document it - #357

Merged
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
benzy018:fix/env-build-output-docs
Aug 22, 2026
Merged

fix(env): align package.json exports with emitted build output and document it#357
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
benzy018:fix/env-build-output-docs

Conversation

@benzy018

Copy link
Copy Markdown
Contributor

Summary

Verifies and documents the TypeScript build output expectations for @guildpass/env (issue #336), and fixes the one real mismatch found between package.json and what tsc actually emits.

Findings

  • packages/env/tsconfig.json is correct: outDir: "dist", rootDir: "src", declaration: true, emitDeclarationOnly: false, sourceMap: true. Building (pnpm --filter @guildpass/env build) emits .js, .d.ts, and .js.map files for every source file — no emitDeclarationOnly problem.
  • packages/env/package.json was out of sync: the exports map declared require conditions pointing at ./dist/index.cjs and ./dist/cli/index.cjs, but the package is ESM-only ("type": "module") and tsc never emits .cjs files. Those entry points resolved to nothing for any CJS consumer. Removed them (matching the sibling @guildpass/webhook-utils), and prefixed main/types with ./ for consistency with the exports paths.
  • dist/ is gitignored and rebuilt automatically by pnpm install via the prepare script, which is what fixed the downstream "Module not found" errors.

Changes

  • packages/env/package.json: entry points now map to real emitted files.
  • packages/env/README.md: added a Build Output section documenting the emitted artifacts, the tsconfig contract, how consumers should import, and how to recover from a stale dist/.

Verification

  • pnpm --filter @guildpass/env builddist/ contains index.js, index.d.ts, index.js.map, plus cli/ and schemas/ equivalents.
  • ESM resolution works: import('@guildpass/env') resolves all exports; the guildpass-env-check CLI runs successfully.
  • pnpm --filter @guildpass/env test → 7/7 pass.
  • pnpm --filter @guildpass/dashboard build (Next.js) succeeds with no "Module not found" for @guildpass/env.
  • Dashboard typecheck reports 0 errors mentioning @guildpass/env (a pre-existing, unrelated @guildpass/metrics resolution error exists on main).

Closes #336

…cument it

The exports map declared `require` conditions pointing at dist/index.cjs and
dist/cli/index.cjs, but the package is ESM-only ("type": "module") and tsc
never emits .cjs files, so those entry points resolved to nothing. Drop the
require conditions (matching @guildpass/webhook-utils) and prefix main/types
with ./ for consistency with the exports paths.

Also document the build output contract in README.md: tsc emits .js, .d.ts and
.js.map to dist/, dist is gitignored and rebuilt via the prepare script, and
downstream consumers resolve @guildpass/env through package.json#exports.

Closes Adamantine-guild#336
@Lakes41
Lakes41 merged commit f84b97e into Adamantine-guild:main Aug 22, 2026
1 check passed
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.

Verify and document TypeScript output expectations for @guildpass/env package

2 participants