Skip to content

Commit

Permalink
Merge pull request #546 from hey-api/feat/output-config
Browse files Browse the repository at this point in the history
feat: move format and lint config options to output object
  • Loading branch information
mrlubos authored May 13, 2024
2 parents 5408bd1 + 77c378a commit 4608131
Show file tree
Hide file tree
Showing 21 changed files with 222 additions and 160 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-sheep-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hey-api/docs": patch
---

docs: add format and lint migration for 0.44.0
5 changes: 5 additions & 0 deletions .changeset/grumpy-bikes-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hey-api/openapi-ts": minor
---

feat: move format and lint config options to output object
52 changes: 32 additions & 20 deletions docs/openapi-ts/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,31 +103,37 @@ You might not need a `node` client. Fetch API is [experimental](https://nodejs.o

## Formatting

By default, `openapi-ts` will not automatically format your client. To enable this feature, set `format` to a valid formatter.
By default, `openapi-ts` will not automatically format your client. To enable this feature, set `output.format` to a valid formatter.

::: code-group

```js{2} [disabled]
```js{4} [disabled]
export default {
format: false,
input: 'path/to/openapi.json',
output: 'src/client',
output: {
format: false,
path: 'src/client',
},
}
```

```js{2} [prettier]
```js{4} [prettier]
export default {
format: 'prettier',
input: 'path/to/openapi.json',
output: 'src/client',
output: {
format: 'prettier',
path: 'src/client',
},
}
```

```js{2} [biome]
```js{4} [biome]
export default {
format: 'biome',
input: 'path/to/openapi.json',
output: 'src/client',
output: {
format: 'biome',
path: 'src/client',
},
}
```

Expand All @@ -137,31 +143,37 @@ You can also prevent your client from being processed by formatters by adding yo

## Linting

For performance reasons, `openapi-ts` does not automatically lint your client. To enable this feature, set `lint` to a valid linter.
For performance reasons, `openapi-ts` does not automatically lint your client. To enable this feature, set `output.lint` to a valid linter.

::: code-group

```js{3} [disabled]
```js{4} [disabled]
export default {
input: 'path/to/openapi.json',
lint: false,
output: 'src/client',
output: {
lint: false,
path: 'src/client',
},
}
```

```js{3} [eslint]
```js{4} [eslint]
export default {
input: 'path/to/openapi.json',
lint: 'eslint',
output: 'src/client',
output: {
lint: 'eslint',
path: 'src/client',
},
}
```

```js{3} [biome]
```js{4} [biome]
export default {
input: 'path/to/openapi.json',
lint: 'biome',
output: 'src/client',
output: {
lint: 'biome',
path: 'src/client',
},
}
```

Expand Down
30 changes: 30 additions & 0 deletions docs/openapi-ts/migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,36 @@ This config option is deprecated and will be removed in favor of [clients](./cli

This config option is deprecated and will be removed in favor of [clients](./clients).

## v0.44.0

### Moved `format`

This config option has been moved. You can now configure formatter using the `output.format` option.

```js{4}
export default {
input: 'path/to/openapi.json',
output: {
format: 'prettier',
path: 'src/client',
},
}
```

### Moved `lint`

This config option has been moved. You can now configure linter using the `output.lint` option.

```js{4}
export default {
input: 'path/to/openapi.json',
output: {
lint: 'eslint',
path: 'src/client',
},
}
```

## v0.43.0

### Removed `enums.gen.ts`
Expand Down
4 changes: 0 additions & 4 deletions packages/openapi-ts/bin/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ const params = program
.option('-d, --debug', 'Run in debug mode?')
.option('--dry-run [value]', 'Skip writing files to disk?')
.option('--exportCore [value]', 'Write core files to disk')
.option('--format [value]', 'Process output folder with formatter?')
.option(
'-i, --input <value>',
'OpenAPI specification (path, url, or string content)',
)
.option('--lint [value]', 'Process output folder with linter?')
.option('--name <value>', 'Custom client class name')
.option('-o, --output <value>', 'Output directory')
.option('--request <value>', 'Path to custom request file')
Expand Down Expand Up @@ -70,8 +68,6 @@ async function start() {
userConfig = processParams(params, [
'dryRun',
'exportCore',
'format',
'lint',
'schemas',
'services',
'types',
Expand Down
Loading

0 comments on commit 4608131

Please sign in to comment.