Validate dist package exports and typings#180
Open
damyanpetev wants to merge 2 commits into
Open
Conversation
Add a check that guards each published package against a broken dist layout — e.g. build output like .d.ts files moved from where the package exports point. scripts/validate-dist.ts, per manifest, copies it to dist/package.json (as the release pipeline does) and, against the real npm pack output (so the `files` allowlist is honored): - runs `attw --pack --profile esm-only` and relies on its exit code; - confirms every JS entrypoint actually ships (attw is types-first and won't flag a missing runtime file when the .d.ts still resolves)
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.
Addition to #179
Will migrate the CI pipeline separately.
What
Adds a dist validation script that verifies every published package's export contract actually resolves in the built
dist/output, and wires it into CI.How it works
scripts/validate-dist.tsiterates over each package manifest (components/dock-manager/grids), copies it todist/package.json(exactly as the release pipeline does), and validates against the real packed output (npm pack/attw --pack), so thefilesallowlist is respected just like a real publish:@arethetypeswrong/cliresolves the types (and their JS) for everyexportsentrypoint.--profile esm-onlyignores the legacynode10/CJS resolution modes these ESM-only packages intentionally don't support, so a non-zero exit means a real problem. attw's own report is printed for visibility in CI and locally..jsis missing while its.d.tsresolves, so the script also confirms every JS entry point is actually in the published file set.Changes
scripts/validate-dist.ts— new validator (attw exit code + JS-entry check; reusesPackageJsonTypesfromscripts/types.ts).package.json— added@arethetypeswrong/clidevDependency and avalidate:distscript..azure-pipelines/setup-build-test-steps.yml— newValidate dist packagesstep after build (runs in both CI and release pipelines).scripts/grids.package.json— added an explicitexportsmap to match the other packages, with a"./grids/*"wildcard to preserve theme CSS and the deprecatedgrids/combinedsubpath imports; legacymain/module/typingsretained for back-compat.Verification
dist/package.json)..d.tsis caught by attw, and a missing.jsis caught by the backstop (both exit 1).biome lint.Usage
Additional information (check all that apply):
Checklist:
README.MDCHANGELOG.MDupdates for newly added functionality