How to use/build oclif (CLI node app) with nx?

729 Views Asked by At

I'm playing with a small app that fetch data from Jira, generates metrics and serves it to a React front-end (https://github.com/fgerthoffert/jira-agile-velocity).

It currently contains:

  • a CLI, built with oclif (https://oclif.io/docs/introduction) to fetch and compute data
  • an API, built with Nest.js, to the data to the front-end
  • a UI, built with React + Typescript

For now, it grew organically to a point where I need to refactor and do an overall clean-up of the codebase.

I looked at NX (https://nx.dev/web) for the monorepo framework, it's super interesting as it would allow to share code between the apps (in particular type definitions and small utility functions).

I was able to get the API and UI set-up, it builds and runs properly, I can build docker images without any issues.

The challenge I'm having is around building the CLI app.

I suspect most of the customization should happen in the architect/build section of workspace.json, but I'm having some trouble understanding exactly how to configure this, in particular how to use the typescript builder (tsc -b).

I'd appreciate any pointers on how to call tsc -b.

The CLI codebase (without NX) is located here: https://github.com/Fgerthoffert/jira-agile-velocity/tree/master/cli

The NX portion is still standard, I generated the CLI folder using:

nx generate @nrwl/node:application jav-cli

Thanks a lot.

0

There are 0 best solutions below