Dryrun flag checking causes the app not to run.
jamesliu4c opened this issue · comments
Description
I get this error when I run it:
$ .../node_modules/.bin/openapi-ts
.../node_modules/@hey-api/openapi-ts/bin/index.cjs:84
if (!userConfig.dryRun) {
^
TypeError: Cannot read properties of undefined (reading 'dryRun')
at start (.../node_modules/@hey-api/openapi-ts/bin/index.cjs:84:21)
at Object.<anonymous> (.../node_modules/@hey-api/openapi-ts/bin/index.cjs:95:1)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49
When I add a
if (!config?.dryRun) {
at this line
https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/index.ts#L336
it works.
The config loads. It reads the correct input and creates the correct output.
OpenAPI specification (optional)
No response
Configuration
import { defineConfig } from '@hey-api/openapi-ts';
export default defineConfig({
input: './vf2/combined.json',
output: './vf2/generated',
client: 'fetch',
dryRun: false,
});
System information (optional)
Node 20. Mac 14.2.1. Apple Silicon
@jamesliu4c i believe this will be fixed in the next release. Do you have typescript globally installed or in your package.json?
Hey @jamesliu4c, can you try with v0.43.0?
@mrlubos same issue in 0.43.0
@mtford-carewell just to confirm. Do you have typescript installed. If so which version.
@jordanshatford this was happening in the context of either npx
or yarn dlx
with or without ts installed globally.
No problems when openapi-ts is installed locally and run from .bin
folder.
Thanks @mtford-carewell. Are you able to share the command you're running + config?
@jamesliu4c I don't see how changing that line you mention would fix this issue, the error message specifies which line it breaks on, I will fix that. That being said, it seems there's another error being raised. Once the next release is up, can you try it and see what the actual message is? It will be saved into a log file. cc @mtford-carewell
@jamesliu4c @mtford-carewell Please try with v0.43.1 and open a new issue if you get a different error (or reopen this one if it still doesn't work)