ci(github): add check to validate exported types being correct
petermetz opened this issue ยท 3 comments
petermetz commented
Description
As a maintainer/reviewer I want to have automation that checks if our exports are correct for both CJS/ESM so that we are less likely to accidentally merge something that would make the exports mess up and cause import issues for the downstream libraries/applications.
https://www.npmjs.com/package/@arethetypeswrong/cli
Acceptance Criteria
- Does not duplicate the entire build process needlessly.
- Evaluate if we should do it for every commit or just prior to release issuance.
- Be mindful of CI resources consumed by this in general.
petermetz commented
yarn lerna exec 'npm pack'
$ attw ./packages/cactus-plugin-ledger-connector-besu/hyperledger-cactus-plugin-ledger-connector-besu-2.0.0-rc.3.tgz
@hyperledger/cactus-plugin-ledger-connector-besu v2.0.0-rc.3
No problems found ๐
โโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ "@hyperledger/cactus-plugin-ledger-connector-besu" โ
โโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ node10 โ ๐ข โ
โโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ node16 (from CJS) โ ๐ข (CJS) โ
โโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ node16 (from ESM) โ ๐ข (CJS) โ
โโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ bundler โ ๐ข โ
โโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
petermetz commented
- The above example works for a single .tgz file
- You can write a globby pattern in one of the nodejs tooling scripts (the ones that are within the
custom-checks
area) - Capture a list of the file paths for all the
*.tgz
files and then run a shell command for each individually
petermetz commented
https://github.com/arethetypeswrong/arethetypeswrong.github.io/tree/main/packages/core
@ruzell22 If possible use the library not the CLI (which would force you to run shell commands from the NodeJS script)