Skip to content

build: restore #33's build script and define __filename in the ESM bundles - #35

Merged
lex00 merged 1 commit into
mainfrom
cli-bundle-filename
Sep 12, 2026
Merged

build: restore #33's build script and define __filename in the ESM bundles#35
lex00 merged 1 commit into
mainfrom
cli-bundle-filename

Conversation

@lex00

@lex00 lex00 commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

The merge of main into #33 kept main's package.json and re-added only the dependency, so the merged build bundled @intentius/tsad-reference (and through it typescript) into cli.js, and dist/index.js plus dist/types were never built. typescript reads __filename at load, which an ES module lacks, so node bin/forgejo-warden.js reconcile --config governance.ts in any folding mode died with __filename is not defined. The tests run the sources and stayed green; typescript-as-data's tutorial job caught it.

Verified: the built CLI folds examples/governance.ts in check mode; 113 tests green.

…) and define __filename in the ESM bundles

The merge of main into #33 kept main's package.json and re-added only the
dependency, so the merged build script bundled @intentius/tsad-reference
and, through it, typescript into cli.js, and the library entry and its
types were never built. typescript reads __filename at load, which an ES
module does not have, so every --config-mode that folds died with
"__filename is not defined" while the tests, which run the sources,
stayed green; the typescript-as-data tutorial job caught it.

Back to #33's build: the reference external in both bundles, chant
external in the library one, dist/index.js and dist/types built, exports
and types fields. The banner also defines __filename and __dirname from
import.meta.url beside the require it already defined.
@lex00
lex00 merged commit 3e20374 into main Sep 12, 2026
5 checks passed
@lex00
lex00 deleted the cli-bundle-filename branch September 12, 2026 19:15
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