Closed dapperdandev closed 3 years ago
Hey @djbreen7 thanks for taking the time to submit this report 🙏
I'm going to take a look at it and see if I can fix it.
We recently had to update the plugin to Nx 11+ and it wasn't as easy as expected so I was really hoping for someone to spot bugs we didn't spot ourselves :D
@djbreen7 Ok, I tried a couple times with the same values from your report but I couldn't reproduce the issue, and every time I was able to generate the sources.
Question time:
nx run test-lib:generate-sources
fails, can you please check if <YOUR_PROJECT>/node_modules/.bin/openapi-generator-cli
exists and if it's executable?
❯ node_modules/.bin/openapi-generator-cli help
Usage: openapi-generator-cli <command> [<args>]
Commands: version-manager Manage used / installed generator version author Utilities for authoring generators or customizing templates. batch Generate code in batch via external configs. config-help Config help for chosen lang generate Generate code with the specified generator. help Display help information about openapi-generator list Lists the available generators meta MetaGenerator. Generator for creating a new template set and configuration for Codegen. The output will be based on the language you specify, and includes default templates to include. validate Validate specification version Show version information used in tooling
❯ node_modules/.bin/openapi-generator-cli version 5.1.1
@trumbitta No problem!
Here's everything I can answer in Windows. I'll boot into mac and see what happens.
Can you create a repo here on GitHub with a Nx workspace where this error happens?
https://github.com/djbreen7/nx-openapi-test
Which node and npm version are you using?
Which version of Nx, and of the plugin, are you using?
Right after nx run test-lib:generate-sources fails, can you please check if
/node_modules/.bin/openapi-generator-cli exists and if it's executable?
Yes, this is executable
@trumbitta
I develop and test on a Mac. I see you are using Windows. Do you have access to a Mac or Linux machine to try again?
This worked fine for me on Mac.
I have this repo cloned. If I get some time, I'll try to Dx.
@trumbitta
The problem definitely happens here: const child = childProcess.spawn('node_modules/.bin/openapi-generator-cli', args);
https://github.com/trumbitta/nx-trumbitta/blob/main/packages/nx-plugin-openapi/src/executors/generate-api-lib-sources/executor.ts#L77
Opening a PR.
It's pretty small. Definitely double-check everything.
Thanks @djbreen7 , I'm trying to find the time to review your much welcomed contributions :)
I'm unable to get this to work on Windows, even using just the sample spec.
Environment
Output
Updated 5-26-2021: Include environment details