openapi-ts
openapi-ts copied to clipboard
Request NX plugin
Description
An NX plugin with a generator to generate NX package and update spec/client code when a command is run. Running the NX generator would ask for the spec file and project name, then output a new NX project with client code generated from openapi-ts.
The generated project would have an executor that could update the spec file and generate new client code.
This would be helpful when integrating into NX monorepos.
NX plugin docs NX plugin getting started
# To run,
pnpm install
# Build the plugin, since the generator and executor use the dist files
npx nx run @test-plugin/nx-plugin:build
# Run the generator
npx nx g @test-plugin/nx-plugin:openapi-client pokemon-api --directory ./packages --scope @test-plugin --client @hey-api/client-fetch --spec https://raw.githubusercontent.com/seriouslag/pokemon-api-spec/refs/heads/main/spec.yaml --plugins @tanstack/react-query
# Run the update executor - this will download and compare the spec files
npx nx run @test-plugin/pokemon-api:updateApi