Repository navigation
build(assets): copy contractErrors and schemas into dist on build (closes #932) - #936
Open
mopxam-art wants to merge 1 commit into
Open
mopxam-art wants to merge 1 commit into
mopxam-art wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Why
TypeScript (
tsc) compiles.tsfiles to.jsindistbut does not copy static JSON assets (src/data/contractErrors.json,src/schemas/creator-application.schema.json). In Docker production builds where onlydist/is copied into the runtime stage, importingsrc/lib/contractErrorsthrowsMODULE_NOT_FOUNDat boot time.What
scripts/copy-assets.cjsthat copiessrc/data/,src/schemas/, andsrc/config/JSON files intodist/.package.jsonbuild script to chain asset copying:"build": "tsc && node scripts/copy-assets.cjs".COPY scripts ./scriptsinDockerfilebuilder stage so assets are populated during container image builds.src/__tests__/buildAssets.test.tsverifying asset presence, schema validation, and error decoding against compileddistoutput.Verified
npx jest src/__tests__/buildAssets.test.ts --forceExit, 102 tests pass).npm run typecheck) and linter (npm run lint).node -e "require('./dist/lib/contractErrors')"succeeds cleanly.Closes #932