Skip to content

Request NX plugin #1910

@seriouslag

Description

@seriouslag

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

PR of NX plugin


Example repo

# 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions