Skip to content

deps: add remark #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rich-bears-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cuppachino/openapi-fetch": patch
---

deps: add remark
42 changes: 23 additions & 19 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
{
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/lib": true,
"**/node_modules": true,
"**/coverage": true,
"**/dist": false,
"**/tsconfig.tsbuildinfo": true,
"**/yarn-error.log": true
}
}
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/lib": true,
"**/node_modules": true,
"**/coverage": true,
"**/dist": false,
"**/tsconfig.tsbuildinfo": true,
"**/yarn-error.log": true
},
"[markdown]": {
"editor.defaultFormatter": "unifiedjs.vscode-remark",
"editor.formatOnSave": true
}
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

### Patch Changes

- f0cab17: change package name
* f0cab17: change package name
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,30 @@

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

### Install
## Installation

```bash
npm install @cuppachino/openapi-fetch
```ps1
pnpm add @cuppachino/openapi-fetch
```

Or
```ps1
npm i @cuppachino/openapi-fetch
```

```bash
```ps1
yarn add @cuppachino/openapi-fetch
```

**Features**
### Features

Supports JSON request and responses

- ✅ [OpenAPI 3.0](https://swagger.io/specification)
- ✅ [Swagger 2.0](https://swagger.io/specification/v2/)
* ✅ [OpenAPI 3.0](https://swagger.io/specification)
* ✅ [Swagger 2.0](https://swagger.io/specification/v2/)

### Usage
## Usage

**Generate typescript definition from schema**
### Generate typescript definition from schema

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

**Typed fetch client**
### Typed fetch client

```ts
import 'whatwg-fetch'
Expand Down Expand Up @@ -153,13 +155,13 @@ import './fetch-polyfill'

### Utility Types

- `OpArgType` - Infer argument type of an operation
- `OpReturnType` - Infer return type of an operation
- `OpErrorType` - Infer error type of an operation
- `FetchArgType` - Argument type of a typed fetch operation
- `FetchReturnType` - Return type of a typed fetch operation
- `FetchErrorType` - Error type of a typed fetch operation
- `TypedFetch` - Fetch operation type
* `OpArgType` - Infer argument type of an operation
* `OpReturnType` - Infer return type of an operation
* `OpErrorType` - Infer error type of an operation
* `FetchArgType` - Argument type of a typed fetch operation
* `FetchReturnType` - Return type of a typed fetch operation
* `FetchErrorType` - Error type of a typed fetch operation
* `TypedFetch` - Fetch operation type

```ts
import { paths, operations } from './petstore'
Expand All @@ -183,7 +185,7 @@ type Err = FetchErrorType<typeof findPetsByStatus>

### Utility Methods

- `arrayRequestBody` - Helper to merge params when request body is an array [see issue](https://github.com/ajaishankar/openapi-typescript-fetch/issues/3#issuecomment-952963986)
* `arrayRequestBody` - Helper to merge params when request body is an array [see issue](https://github.com/ajaishankar/openapi-typescript-fetch/issues/3#issuecomment-952963986)

```ts

Expand Down
27 changes: 26 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
"jest-environment-jsdom": "^29.5.0",
"msw": "^0.35.0",
"prettier": "^2.8.6",
"remark": "^14.0.2",
"remark-cli": "^11.0.0",
"remark-lint-emphasis-marker": "^3.1.1",
"remark-lint-list-item-indent": "^3.1.1",
"remark-lint-strong-marker": "^3.1.1",
"remark-preset-lint-consistent": "^5.1.1",
"remark-preset-lint-recommended": "^6.1.2",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
Expand All @@ -68,10 +75,28 @@
"singleQuote": true,
"semi": false
},
"remarkConfig": {
"settings": {
"emphasis": "*",
"strong": "*"
},
"plugins": [
"remark-preset-lint-consistent",
"remark-preset-lint-recommended",
[
"remark-lint-emphasis-marker",
"*"
],
[
"remark-lint-strong-marker",
"*"
]
]
},
"scripts": {
"clean": "rimraf ./dist",
"build": "npm run clean && tsc --project tsconfig.json && tsc --project tsconfig.cjs.json && node ./scripts/os.js",
"lint": "eslint .",
"lint": "eslint . --fix && remark . --quiet --frail --output",
"test": "tsc --noEmit --project tsconfig.json && jest",
"version-package": "changeset version && pnpm lint",
"release": "pnpm build && pnpm test && changeset publish",
Expand Down
Loading