Skip to content

Commit

Permalink
[optimize] support Custom Request implements (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
TechQuery authored Oct 28, 2024
1 parent 53ea34d commit 963fbab
Show file tree
Hide file tree
Showing 7 changed files with 904 additions and 692 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
jobs:
Build-and-Publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4

Expand All @@ -21,7 +24,7 @@ jobs:
run: pnpm i --frozen-lockfile

- name: Build & Publish
run: npm publish
run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down
20 changes: 17 additions & 3 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ Automatic Parsed type:

### Browser

```Shell
#### Installation

```shell
npm install koajax
```

`index.html`
#### `index.html`

```html
<head>
Expand All @@ -51,11 +53,13 @@ npm install koajax

### Node.js

#### Installation

```shell
npm install koajax jsdom
```

`index.js`
#### `index.ts`

```javascript
import { HTTPClient } from 'koajax';
Expand All @@ -74,6 +78,16 @@ polyfill(origin).then(() => {
});
```

#### Execution

```shell
npx tsx index.ts
```

### Non-polyfillable runtimes

1. https://github.com/idea2app/KoAJAX-Taro-adapter

## Example

### RESTful API with Token-based Authorization
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "koajax",
"version": "3.0.2",
"version": "3.0.3",
"license": "LGPL-3.0",
"author": "shiy2008@gmail.com",
"description": "HTTP Client based on Koa-like middlewares",
Expand Down Expand Up @@ -29,7 +29,7 @@
"core-js": "^3.38.1",
"regenerator-runtime": "^0.14.1",
"web-streams-polyfill": "^4.0.0",
"web-utility": "^4.4.0"
"web-utility": "^4.4.1"
},
"peerDependencies": {
"jsdom": ">=21"
Expand All @@ -38,23 +38,23 @@
"@parcel/packager-ts": "~2.12.0",
"@parcel/transformer-typescript-types": "~2.12.0",
"@types/core-js": "^2.5.8",
"@types/jest": "^29.5.12",
"@types/jest": "^29.5.14",
"@types/jsdom": "^21.1.7",
"@types/node": "^20.16.5",
"@types/node": "^20.17.1",
"cross-env": "^7.0.3",
"husky": "^9.1.5",
"husky": "^9.1.6",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^25.0.0",
"jsdom": "^25.0.1",
"lint-staged": "^15.2.10",
"open-cli": "^8.0.0",
"parcel": "~2.12.0",
"prettier": "^3.3.3",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typedoc": "^0.26.6",
"typedoc-plugin-mdn-links": "^3.2.11",
"typescript": "~5.5.4"
"typedoc": "^0.26.10",
"typedoc-plugin-mdn-links": "^3.3.5",
"typescript": "~5.6.3"
},
"prettier": {
"singleQuote": true,
Expand Down
Loading

0 comments on commit 963fbab

Please sign in to comment.