Hi everyone Does anyon…

2 minute read

Hi everyone!

Does anyone have any good tutorials about making a plugin? The plugin generator is cool, but I can’t seem to get past the finish line.


The idea is to take an openapi yaml file, and generate a typescript sdk from it.

I got it working with regard to generating the typescript, but when I go tot use it in an express app, I get ENOENT: no such file or directory, open '.../libs/email-sdk/package.json

None of the other packages have package.json files, do I need to add some other build step somewhere? maybe from ts->js? It’s pretty easy to add the command, but where to I put the compiled files? Should I generate some kind of stub package.json?

I’ve tried looking through some other packages, but they are pretty hard to parse ericwooley/openapi-sdk


for context, i’m trying to use it in an express app

I am pretty busy tonight, but I’ll take a look at this in the morning!

I actually discovered this from the <#CM4LG9SMR announcements> channel: https://www.youtube.com/watch?v=J0PxtUXoDz8

Hopefully that answers most my questions

I would highly recommend linking to that video in the plugin generator, it’s been super helpful so far

Reading the nx sources is great as an addition. I do that a lot to see how it’s done in the official packages

Agreed! That is how I learned up till now!

Yea, I spent some time reading the sources, but i’m 100% new to nx and the angular build tools (maybe i have no business building a plugin)

So the view from 30k feet was still eluding me.

The answer to the original question BTW: if you want to use your typescript library with nx serve don’t include a build step.

The good news is, i think i pretty much got it, just doing some testing and documenting

I’ve started writing some small articles on building Nx plugins at my blog (https://dev.to/devinshoemaker), but I think there’s a lot of room for more articles and documentation. The official Angular docs can also help you get started with schematics (https://angular.io/guide/schematics-authoring). One thing to keep in mind is the several different kinds of commands you can write with plugins. Generators, which are designed to generate or manipulate new code, and builders which are more meant to execute a series of steps in JavaScript or TypeScript. It sounds like you’d want to write a generator that takes that files path as an input and then generates code from it. It may be hard to find examples of something similar as none of the Nx code base does this, but it shouldn’t be impossible. It may be worth looking into this tool for creating TypeScript files (https://github.com/dsherret/ts-morph).

Thanks for the info , I think that’s what I ended up doing. That repo is pretty much ready, I’m just testing it myself before I try anything like getting it listed.