cacti
cacti copied to clipboard
ci(github): add check to validate exported types being correct
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.
@ruzell22
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 │ 🟢 │
└───────────────────┴────────────────────────────────────────────────────┘
@ruzell22
- 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-checksarea) - Capture a list of the file paths for all the
*.tgzfiles and then run a shell command for each individually
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)