build: restore #33's build script and define __filename in the ESM bundles - #35
Merged
Conversation
…) 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The merge of main into #33 kept main's
package.jsonand re-added only the dependency, so the merged build bundled@intentius/tsad-reference(and through ittypescript) intocli.js, anddist/index.jsplusdist/typeswere never built.typescriptreads__filenameat load, which an ES module lacks, sonode bin/forgejo-warden.js reconcile --config governance.tsin 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.dist/index.js,build:types;typesandexportsfields restored.__filenameand__dirnamefromimport.meta.urlbeside therequireit already defined.Verified: the built CLI folds
examples/governance.tsincheckmode; 113 tests green.