cli icon indicating copy to clipboard operation
cli copied to clipboard

nx plugin - `cli` executor for the code pushup CLI

Open BioPhoton opened this issue 2 years ago • 0 comments

User story

As a user of Nx I want to have convenient configuration of my code-pushup related target. A custom executor for the code-pushup CLI would reduce configuration and setup cost.

Acceptance criteria

  • [x] #737
  • [ ] forward stdout and stderr from CLI process in executor
  • #740
    • [x] create a zod schema envSchema to parse environment variables
  • [x] ~bundle package in multiple formats - https://nx.dev/recipes/tips-n-tricks/compile-multiple-formats~
    • https://github.com/nrwl/nx/issues/15682#issuecomment-1700298264
    • (possible alternative) https://joyeecheung.github.io/blog/2024/03/18/require-esm-in-node-js/ 👀
  • generate a schema.json from a zod schema in schema.ts (optional)

Dual Build

Problems regarding the dual build:

  • @poppinss/cliui also doesn't support CJS for some time. Possible workaround for @poppinss/cliui would be a dynamic import
  • non-CJS-compatible runtime dependencies are lighthouse and lighthouse-logger
  • big refactoring as turning all functions async that touch one of the incompatible tools

Conclusion use the CLI in a separate process instead and duplicate some of the logic.

Implementation details

https://github.com/code-pushup/cli/tree/add-executor-to-nx-plugin

BioPhoton avatar Sep 22 '23 18:09 BioPhoton