cacti icon indicating copy to clipboard operation
cacti copied to clipboard

ci(github): add check to validate exported types being correct

Open petermetz opened this issue 1 year ago • 3 comments

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

  1. Does not duplicate the entire build process needlessly.
  2. Evaluate if we should do it for every commit or just prior to release issuance.
  3. Be mindful of CI resources consumed by this in general.

petermetz avatar Mar 23 '24 17:03 petermetz

@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           │ 🟢                                                 │
└───────────────────┴────────────────────────────────────────────────────┘

petermetz avatar Sep 05 '24 00:09 petermetz

@ruzell22

  1. The above example works for a single .tgz file
  2. You can write a globby pattern in one of the nodejs tooling scripts (the ones that are within the custom-checks area)
  3. Capture a list of the file paths for all the *.tgz files and then run a shell command for each individually

petermetz avatar Sep 05 '24 00:09 petermetz

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)

petermetz avatar Sep 05 '24 00:09 petermetz