Skip to content

Commit 4e8b69c

Browse files
committed
feat(genreator/cli): expose importFormat option
1 parent 5b936db commit 4e8b69c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/generator/cli/generate.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { z } from 'zod'
66
import { toAbsolutePath } from '../../lib/fsp.js'
77
import { isError, urlParseSafe } from '../../lib/prelude.js'
88
import { Generator } from '../__.js'
9-
import { type ConfigInit, OutputCase } from '../config/configInit.js'
9+
import { type ConfigInit, ImportFormat, OutputCase } from '../config/configInit.js'
1010

1111
const args = Command.create().description(`Generate a type safe GraphQL client.`)
1212
.parameter(
@@ -57,6 +57,12 @@ const args = Command.create().description(`Generate a type safe GraphQL client.`
5757
)
5858
.optional(),
5959
)
60+
.parameter(
61+
`importFormat`,
62+
z.nativeEnum(ImportFormat).default(`jsExtension`).describe(
63+
`How should import identifiers be generated? For example "tsExtension" would yield modules that import like "import ... from './foo.ts'".`,
64+
),
65+
)
6066
.settings({
6167
parameters: {
6268
environment: false,
@@ -119,6 +125,8 @@ if (args.format !== undefined) input.format = args.format
119125
if (args.name !== undefined) input.name = args.name
120126
if (args.output !== undefined) input.outputDirPath = toAbsolutePath(process.cwd(), args.output)
121127

128+
input.importFormat = args.importFormat
129+
122130
// --- Generate ---
123131

124132
await Generator.generate(input)

0 commit comments

Comments
 (0)