Skip to content

Commit

Permalink
Add axios as a peer dependency. Fixes #5.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuibonobo committed Apr 2, 2023
1 parent 2d8b772 commit f3f1b0a
Show file tree
Hide file tree
Showing 19 changed files with 72 additions and 1,863 deletions.
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/lib
/src/axios
/node_modules
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

An Axios adapter that uses native `fetch`. Useful for Cloudflare Workers and ServiceWorker environments.

> **Note:** This adapter was designed for version `0.21.1` of Axios, which is still used in prominent e-commerce SDKs.
## Install
```sh
npm install @haverstack/axios-fetch-adapter
Expand Down Expand Up @@ -50,7 +52,7 @@ A [Miniflare](https://miniflare.dev) testing environment is used in order to sim
## Acknowledgements
The code in this repo draws heavily from the following projects:
- [vespaiach/axios-fetch-adapter](https://github.com/vespaiach/axios-fetch-adapter): Most of the initial code in this repo was copied from here. Licensed MIT.
- [axios/axios](https://github.com/axios/axios): Rather than import `axios` for this repo, the necessary types and utility functions were copied directly. Licensed MIT.
- [axios/axios](https://github.com/axios/axios): The `buildFullPath` function from `axios` has been copied here and modified to be more flexible. Licensed MIT.

## License
[MIT](LICENSE)
47 changes: 35 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@haverstack/axios-fetch-adapter",
"version": "0.6.0",
"version": "0.7.0",
"description": "An Axios adapter that uses native fetch. Useful for Cloudflare Workers and ServiceWorker environments.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"module": "lib/index.esm.js",
"scripts": {
"build:js": "node build.js",
"build:types": "tsc --project ./tsconfig.build.json && ncp ./src/axios/index.d.ts ./lib/axios/index.d.ts",
"build:types": "tsc --project ./tsconfig.build.json",
"build": "npm run clean:lib && run-s build:*",
"check": "npm run test && npm run lint && npm run format:check",
"clean": "run-p clean:*",
Expand Down Expand Up @@ -51,6 +51,7 @@
"@types/node": "^18.11.9",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"axios": "^0.21.1",
"cross-env": "^7.0.3",
"esbuild": "^0.17.11",
"eslint": "^8.28.0",
Expand All @@ -63,6 +64,9 @@
"ts-jest": "^29.0.3",
"typescript": "^4.9.3"
},
"peerDependencies": {
"axios": "^0.21.1"
},
"jest": {
"testEnvironment": "miniflare",
"transform": {
Expand All @@ -76,13 +80,11 @@
"node"
],
"testPathIgnorePatterns": [
"lib/",
"src/axios/"
"lib/"
],
"collectCoverage": true,
"collectCoverageFrom": [
"src/**",
"!src/axios/**"
"src/**"
],
"coveragePathIgnorePatterns": [
".d.ts"
Expand All @@ -106,9 +108,6 @@
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"ignorePatterns": [
"src/axios/*"
],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
Expand Down
7 changes: 0 additions & 7 deletions src/axios/LICENSE

This file was deleted.

7 changes: 0 additions & 7 deletions src/axios/README.md

This file was deleted.

105 changes: 0 additions & 105 deletions src/axios/core/AxiosError.js

This file was deleted.

0 comments on commit f3f1b0a

Please sign in to comment.