@sebspark/openapi-typegen 0.2.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@ of this file will be used to generate Server and Client names.
10
10
  This example can be found in [@sebspark/openapi-e2e](../packages/openapi-e2e)
11
11
 
12
12
  ```zsh
13
- yarn openapi-typegen -i ./src/schemas/marketdata.json -o ./src/schemas/
13
+ yarn openapi-typegen -i ./src/schemas/ -o ./src/schemas/
14
14
  ```
15
15
 
16
16
  The schema will export all types defined in the OpenAPI spec as well as:
package/cli.mjs CHANGED
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { generate } from '@sebspark/openapi-typegen'
4
- import yargs from 'yargs'
5
- import chalk from 'chalk'
6
4
  import boxen from 'boxen'
5
+ import chalk from 'chalk'
6
+ import yargs from 'yargs'
7
+
8
+ const usage = chalk.magenta(`
9
+ Usage: @sebspark/typegen --input ./schemas --output ./dist
7
10
 
8
- const usage = chalk.magenta(
9
- '\nUsage: @sebspark/typegen --input ./schemas --output ./dist \n' +
10
- boxen(
11
- chalk.green('\n' + 'Generates Typescript from OpenAPI schemas' + '\n'),
12
- {
13
- padding: 1,
14
- borderColor: 'green',
15
- dimBorder: true,
16
- },
17
- ) +
18
- '\n',
19
- )
11
+ ${boxen(
12
+ chalk.green('\n' + 'Generates Typescript from OpenAPI schemas' + '\n'),
13
+ {
14
+ padding: 1,
15
+ borderColor: 'green',
16
+ dimBorder: true,
17
+ }
18
+ )}
19
+ `)
20
20
 
21
21
  const argv = yargs(process.argv.slice(2))
22
22
  .usage(usage)
@@ -27,4 +27,4 @@ const argv = yargs(process.argv.slice(2))
27
27
  .help()
28
28
  .parseSync()
29
29
 
30
- generate({ input: argv.input, output: argv.output })
30
+ generate(argv.input, argv.output)
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- type Options = {
2
- input: string;
3
- output?: string;
4
- };
5
- declare const generate: ({ input, output, }: Options) => Promise<string | string[] | void>;
1
+ import { OpenApiDocument } from '@sebspark/openapi-core';
6
2
 
7
- export { Options, generate };
3
+ declare const generateTypescript: (name: string, doc: OpenApiDocument) => Promise<string>;
4
+ declare const generate: (input: string, output?: string) => Promise<string | undefined>;
5
+
6
+ export { generate, generateTypescript };