Skip to content

Commit 2ef6155

Browse files
authored
Merge pull request #1 from cuppachino/remark
deps: add remark
2 parents 4617f68 + 97048c2 commit 2ef6155

File tree

6 files changed

+1281
-40
lines changed

6 files changed

+1281
-40
lines changed

.changeset/rich-bears-kneel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cuppachino/openapi-fetch": patch
3+
---
4+
5+
deps: add remark

.vscode/settings.json

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
{
2-
"editor.formatOnSave": false,
3-
"editor.codeActionsOnSave": {
4-
"source.fixAll.eslint": true
5-
},
6-
"typescript.tsdk": "node_modules/typescript/lib",
7-
"files.exclude": {
8-
"**/.git": true,
9-
"**/.svn": true,
10-
"**/.hg": true,
11-
"**/CVS": true,
12-
"**/.DS_Store": true,
13-
"**/lib": true,
14-
"**/node_modules": true,
15-
"**/coverage": true,
16-
"**/dist": false,
17-
"**/tsconfig.tsbuildinfo": true,
18-
"**/yarn-error.log": true
19-
}
20-
}
2+
"editor.formatOnSave": false,
3+
"editor.codeActionsOnSave": {
4+
"source.fixAll.eslint": true
5+
},
6+
"typescript.tsdk": "node_modules/typescript/lib",
7+
"files.exclude": {
8+
"**/.git": true,
9+
"**/.svn": true,
10+
"**/.hg": true,
11+
"**/CVS": true,
12+
"**/.DS_Store": true,
13+
"**/lib": true,
14+
"**/node_modules": true,
15+
"**/coverage": true,
16+
"**/dist": false,
17+
"**/tsconfig.tsbuildinfo": true,
18+
"**/yarn-error.log": true
19+
},
20+
"[markdown]": {
21+
"editor.defaultFormatter": "unifiedjs.vscode-remark",
22+
"editor.formatOnSave": true
23+
}
24+
}

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
### Patch Changes
66

7-
- f0cab17: change package name
7+
* f0cab17: change package name

README.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,30 @@
44

55
A typed fetch client for [openapi-typescript](https://github.com/drwpow/openapi-typescript)
66

7-
### Install
7+
## Installation
88

9-
```bash
10-
npm install @cuppachino/openapi-fetch
9+
```ps1
10+
pnpm add @cuppachino/openapi-fetch
1111
```
1212

13-
Or
13+
```ps1
14+
npm i @cuppachino/openapi-fetch
15+
```
1416

15-
```bash
17+
```ps1
1618
yarn add @cuppachino/openapi-fetch
1719
```
1820

19-
**Features**
21+
### Features
2022

2123
Supports JSON request and responses
2224

23-
-[OpenAPI 3.0](https://swagger.io/specification)
24-
-[Swagger 2.0](https://swagger.io/specification/v2/)
25+
* [OpenAPI 3.0](https://swagger.io/specification)
26+
* [Swagger 2.0](https://swagger.io/specification/v2/)
2527

26-
### Usage
28+
## Usage
2729

28-
**Generate typescript definition from schema**
30+
### Generate typescript definition from schema
2931

3032
```bash
3133
npx openapi-typescript https://petstore.swagger.io/v2/swagger.json --output petstore.ts
@@ -34,7 +36,7 @@ npx openapi-typescript https://petstore.swagger.io/v2/swagger.json --output pets
3436
# 🚀 https://petstore.swagger.io/v2/swagger.json -> petstore.ts [650ms]
3537
```
3638

37-
**Typed fetch client**
39+
### Typed fetch client
3840

3941
```ts
4042
import 'whatwg-fetch'
@@ -153,13 +155,13 @@ import './fetch-polyfill'
153155

154156
### Utility Types
155157

156-
- `OpArgType` - Infer argument type of an operation
157-
- `OpReturnType` - Infer return type of an operation
158-
- `OpErrorType` - Infer error type of an operation
159-
- `FetchArgType` - Argument type of a typed fetch operation
160-
- `FetchReturnType` - Return type of a typed fetch operation
161-
- `FetchErrorType` - Error type of a typed fetch operation
162-
- `TypedFetch` - Fetch operation type
158+
* `OpArgType` - Infer argument type of an operation
159+
* `OpReturnType` - Infer return type of an operation
160+
* `OpErrorType` - Infer error type of an operation
161+
* `FetchArgType` - Argument type of a typed fetch operation
162+
* `FetchReturnType` - Return type of a typed fetch operation
163+
* `FetchErrorType` - Error type of a typed fetch operation
164+
* `TypedFetch` - Fetch operation type
163165

164166
```ts
165167
import { paths, operations } from './petstore'
@@ -183,7 +185,7 @@ type Err = FetchErrorType<typeof findPetsByStatus>
183185
184186
### Utility Methods
185187
186-
- `arrayRequestBody` - Helper to merge params when request body is an array [see issue](https://github.com/ajaishankar/openapi-typescript-fetch/issues/3#issuecomment-952963986)
188+
* `arrayRequestBody` - Helper to merge params when request body is an array [see issue](https://github.com/ajaishankar/openapi-typescript-fetch/issues/3#issuecomment-952963986)
187189
188190
```ts
189191

package.json

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@
5757
"jest-environment-jsdom": "^29.5.0",
5858
"msw": "^0.35.0",
5959
"prettier": "^2.8.6",
60+
"remark": "^14.0.2",
61+
"remark-cli": "^11.0.0",
62+
"remark-lint-emphasis-marker": "^3.1.1",
63+
"remark-lint-list-item-indent": "^3.1.1",
64+
"remark-lint-strong-marker": "^3.1.1",
65+
"remark-preset-lint-consistent": "^5.1.1",
66+
"remark-preset-lint-recommended": "^6.1.2",
6067
"rimraf": "^3.0.2",
6168
"ts-jest": "^29.0.5",
6269
"ts-node": "^10.9.1",
@@ -68,10 +75,28 @@
6875
"singleQuote": true,
6976
"semi": false
7077
},
78+
"remarkConfig": {
79+
"settings": {
80+
"emphasis": "*",
81+
"strong": "*"
82+
},
83+
"plugins": [
84+
"remark-preset-lint-consistent",
85+
"remark-preset-lint-recommended",
86+
[
87+
"remark-lint-emphasis-marker",
88+
"*"
89+
],
90+
[
91+
"remark-lint-strong-marker",
92+
"*"
93+
]
94+
]
95+
},
7196
"scripts": {
7297
"clean": "rimraf ./dist",
7398
"build": "npm run clean && tsc --project tsconfig.json && tsc --project tsconfig.cjs.json && node ./scripts/os.js",
74-
"lint": "eslint .",
99+
"lint": "eslint . --fix && remark . --quiet --frail --output",
75100
"test": "tsc --noEmit --project tsconfig.json && jest",
76101
"version-package": "changeset version && pnpm lint",
77102
"release": "pnpm build && pnpm test && changeset publish",

0 commit comments

Comments
 (0)