Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
divyam234 committed Feb 14, 2024
1 parent ca4a512 commit 0c2e31e
Show file tree
Hide file tree
Showing 13 changed files with 3,444 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{*.json,*.md,.*rc,*.yml,*.txt}]
indent_style = space
indent_size = 2
24 changes: 24 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8

- name: pnpm install, build, and test
run: |
pnpm install
pnpm test
pnpm run build
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
package-lock.json
dist
coverage
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# feaxios

`feaxios` is a lightweight alternative to [Axios], providing the same familiar API with a significantly reduced footprint of **800 bytes**. It leverages the native `fetch()` API supported in all modern browsers, delivering a performant and minimalistic solution. This makes it an ideal choice for projects where minimizing bundle size is a priority.

### Key Features

- **Lightweight:** With a size of less than 1/5th of Axios, `feaxios` is an efficient choice for projects with strict size constraints.

- **Native Fetch API:** Utilizes the browser's native [Fetch API][fetch], ensuring broad compatibility and seamless integration with modern web development tools.

- **Interceptor Support:** `feaxios` supports interceptors, allowing you to customize and augment the request and response handling process.

- **Timeouts:** Easily configure timeouts for requests, ensuring your application remains responsive and resilient.

### When to Use feaxios

While [Axios] remains an excellent module, `feaxios` provides a compelling option in scenarios where minimizing dependencies is crucial. By offering a similar API to Axios, `feaxios` bridges the gap between Axios and the native `fetch()` API.

### Usage

```js
import axios from 'feaxios';

// Use 'feaxios' just like you would with Axios
axios.get('https://api.example.com/data')
.then(response => {
// Handle the response
console.log(response.data);
})
.catch(error => {
// Handle errors
console.error(error);
});
68 changes: 68 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "feaxios",
"version": "0.0.1",
"description": "Tiny Fetch wrapper that provides a similar API to Axios",
"main": "dist/index.js",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"scripts": {
"build": "tsup",
"typecheck": "tsc --noEmit",
"test": "vitest",
"test-ui": "vitest --ui",
"format": "prettier --write './**/*.{ts,md}'",
"format:check": "prettier --check './**/*.{ts,md}'"
},
"files": [
"dist"
],
"tsup": {
"entry": [
"src/index.ts"
],
"clean": true,
"treeshake": true,
"minify": true,
"splitting": false,
"format": [
"cjs",
"esm"
],
"dts": true
},
"eslintConfig": {
"extends": [
"prettier"
]
},
"repository": "divyam234/feaxios",
"keywords": [
"axios",
"fetch"
],
"license": "MIT",
"homepage": "https://github.com/divyam234/feaxios",
"devDependencies": {
"@vitest/ui": "^1.2.2",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0 ",
"msw": "^2.2.0",
"prettier": "^3.2.5",
"typescript": "^5.3.3",
"vitest": "^1.2.2"
},
"dependencies": {
"@types/node": "^20.11.17",
"tsup": "^8.0.2"
}
}
Loading

0 comments on commit 0c2e31e

Please sign in to comment.