Skip to content
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

Axios to fetch #1269

Open
wants to merge 57 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
ebce30a
test(berry): organize files and structures
Gabb-c Apr 8, 2024
9ea9fc0
chore: update biome
Gabb-c Apr 16, 2024
8249ca8
test: add vitest globals
Gabb-c Apr 19, 2024
30f074e
test: add missing vitest globals
Gabb-c Apr 19, 2024
e7a8613
docs: update docs config
Gabb-c Apr 19, 2024
4a37129
docs: update vitepress config
Gabb-c Apr 19, 2024
9079c33
test: update berry tests
Gabb-c Apr 22, 2024
c3481fb
build(deps): update axios-cache-adapter
Gabb-c Apr 23, 2024
79fb23c
chore(docs): update vitepress
Gabb-c Apr 27, 2024
187ac8a
chore(deps): update vitest deps
Gabb-c Apr 30, 2024
6924a33
chore(deps): update vitest and vite
Gabb-c May 3, 2024
13a71ae
test: add folder structure
Gabb-c May 4, 2024
21f43dd
build(deps): update @swc/core
Gabb-c May 6, 2024
5dcba65
build(deps): bump pnpm/action-setup from 3.0.0 to 4.0.0
dependabot[bot] May 7, 2024
86e2e5e
ci(test): add typecheck testing step
Gabb-c May 8, 2024
83dbbe0
chore(tests): update msw
Gabb-c May 9, 2024
410dfbf
test: add server unhandledException event handler
Gabb-c May 9, 2024
3f76686
chore(deps-dev): update vitepress
Gabb-c May 18, 2024
afccf05
chore(husky): update commit-msg hook
May 19, 2024
512be7b
build(deps): update axios
Gabb-c May 21, 2024
2c40318
Merge pull request #1136 from Gabb-c/feat/tests-refactor
Gabb-c Jun 23, 2024
f119a3b
chore: add husky script to skip install in ci env
Gabb-c Jun 23, 2024
9edf89b
build: update prod deps
Gabb-c Jun 23, 2024
6dfaf44
build(deps-dev): bump braces from 3.0.2 to 3.0.3
dependabot[bot] Jun 23, 2024
673b5ba
chore: remove husky install script
Gabb-c Jun 23, 2024
67412f0
docs: update styles
Gabb-c Jun 23, 2024
857da65
docs: update styles
Gabb-c Jun 23, 2024
61eed12
Merge pull request #1129 from Gabb-c/dependabot/npm_and_yarn/braces-3…
Gabb-c Jun 23, 2024
8d233b9
Merge pull request #1108 from Gabb-c/dependabot/github_actions/pnpm/a…
Gabb-c Jun 23, 2024
9c189e3
chore: remove code duplications
Gabb-c Jun 23, 2024
581c54d
chore(dev-deps): update dependencies and project settings
Gabb-c Jun 27, 2024
fc0f054
chore: update dev deps
Gabb-c Jul 1, 2024
2ce1f10
docs: update base client documentation
Gabb-c Jul 3, 2024
499581c
chore: update dev deps
Gabb-c Jul 6, 2024
b74341a
feat(models): update pokemon typings
Gabb-c Jul 7, 2024
7efb9f1
docs(postman): create postman collection
Gabb-c Jul 7, 2024
3e42fdc
chore(deps-dev): update vitest to 2.0.0
Gabb-c Jul 8, 2024
903efb5
build(deps): bump actions/setup-node from 4.0.2 to 4.0.3
dependabot[bot] Jul 9, 2024
8cf54c8
chore(deps-dev): update vitest
Gabb-c Jul 10, 2024
2b448f1
chore(deps-dev): update vitest
Gabb-c Jul 13, 2024
e2aa37c
feat(models): change from interface to type
Jul 17, 2024
1ccfff1
chore(deps): update dependencies
Gabb-c Jul 22, 2024
8c9d111
build: update dependencies
Aug 5, 2024
4a2cc1b
Merge pull request #1148 from Gabb-c/dependabot/github_actions/action…
Gabb-c Aug 5, 2024
f016da7
build(deps): update axios
Gabb-c Aug 15, 2024
d4db7b8
build: update deps
Gabb-c Aug 25, 2024
3fee70c
build(deps): update axios to 1.7.7
Gabb-c Sep 1, 2024
24d9060
docs: update readme
Gabb-c Sep 16, 2024
4e2a456
build(deps): upadte axios and cache interceptor
Gabb-c Nov 17, 2024
dddb507
build(deps): update axios
Gabb-c Dec 6, 2024
743af4c
build(deps): update dependencies
Gabb-c Jan 12, 2025
cb35985
chore: sync lockfile
Gabb-c Jan 12, 2025
38bb78a
chore: add sonar properties
Gabb-c Jan 13, 2025
8a65740
test(utils): refactor nested template literals
Gabb-c Jan 13, 2025
dba280e
build(deps): update dependencies
Gabb-c Jan 17, 2025
41f0c24
feat: migrate from axios to fetch api gabb-c/pokenode-ts#1264
ElCapitanSponge Feb 1, 2025
0b512e0
fix: flag request cache as readonly, clarify request error return type
ElCapitanSponge Feb 2, 2025
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
12 changes: 0 additions & 12 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,5 @@ insert_final_newline = true
curly_bracket_next_line = false
spaces_around_operators = true

[*.bat]
end_of_line = crlf

[*.cs]
curly_bracket_next_line = true

[*.{cpp,cs,gradle,java,kt,py,rs}]
indent_size = 4

[*.md]
trim_trailing_whitespace = false

[*.tsv]
indent_style = tab
93 changes: 7 additions & 86 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,90 +1,11 @@
# Automatically detect text files and handle line endings appropriately
* text=auto

# DOCUMENTS
*.bibtex text diff=bibtex
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.md text diff=markdown
*.tex text diff=tex
*.adoc text
*.textile text
*.mustache text
*.csv text
*.tab text
*.tsv text
*.txt text eol=lf
*.sql text
*.ps1 text eol=crlf

# CUSTOM
# Use LF as EOL for these files
.editorconfig text eol=lf
.gitignore text eol=lf
*.css text eol=lf
*.df text eol=lf
*.htm text eol=lf
*.html text eol=lf
*.java text eol=lf
*.js text eol=lf
*.json text eol=lf
*.ts text eol=lf
*.jsp text eol=lf
*.jspf text eol=lf
*.properties text eol=lf
*.scss text eol=lf
*.tld text eol=lf
*.ts text eol=lf
*.xml text eol=lf

# GRAPHICS
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.tif binary
*.tiff binary
*.ico binary
# SVG treated as an asset (binary) by default.
*.svg text
# If you want to treat it as binary,
# use the following line instead.
# *.svg binary
*.eps binary

# SCRIPTS
*.bash text eol=lf
*.fish text eol=lf
*.sh text eol=lf
# These are explicitly windows files and should use CRLF
*.bat text eol=crlf
*.cmd text eol=crlf

# SERIALIZATION
*.json text
*.toml text
*.xml text
*.yaml text
*.yml text

# ARCHIVES
*.7z binary
*.gz binary
*.tar binary
*.tgz binary
*.zip binary
# Ignore the .gitattributes file itself when exporting or archiving the repository
.gitattributes export-ignore

# TEXT FILES WHERE LINE ENDINGS SHOULD BE PRESERVED
*.patch -text
# Ignore the .gitignore file when exporting or archiving the repository
.gitignore export-ignore

# EXCLUDE FILES FROM EXPORTING
.gitattributes export-ignore
.gitignore export-ignore
.gitkeep export-ignore
# Ignore the .gitkeep file when exporting or archiving the repository
.gitkeep export-ignore
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: pnpm/action-setup@v3.0.0
- uses: pnpm/action-setup@v4.0.0
name: Install pnpm
id: pnpm-install
with:
version: latest
run_install: false

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/[email protected].2
uses: actions/[email protected].3
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v3.0.0
uses: pnpm/action-setup@v4.0.0
id: pnpm-install
with:
version: latest
run_install: false

- name: Setup Node.js lts/iron
uses: actions/[email protected].2
uses: actions/[email protected].3
with:
node-version: lts/iron
cache: pnpm
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: pnpm/action-setup@v3.0.0
- uses: pnpm/action-setup@v4.0.0
name: Install pnpm
id: pnpm-install
with:
version: latest
run_install: false

- name: Setup Node.js lts/iron
uses: actions/[email protected].2
uses: actions/[email protected].3
with:
node-version: lts/iron
cache: pnpm
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: pnpm/action-setup@v3.0.0
- uses: pnpm/action-setup@v4.0.0
name: Install pnpm
id: pnpm-install
with:
version: latest
run_install: false

- name: Setup Node.js lts/iron
uses: actions/[email protected].2
uses: actions/[email protected].3
with:
node-version: lts/iron
cache: pnpm
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v3.0.0
- uses: pnpm/action-setup@v4.0.0
name: Install pnpm
id: pnpm-install
with:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@ jobs:
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v3.0.0
uses: pnpm/action-setup@v4.0.0
id: pnpm-install
with:
version: latest
run_install: false

- name: Setup Node.js lts/iron
uses: actions/[email protected].2
uses: actions/[email protected].3
with:
node-version: lts/iron
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests
- name: Run tests (Unit)
run: pnpm test

- name: Run tests (Typecheck)
run: pnpm test:types
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ lib

# VitePress
**/.vitepress/cache
tsconfig.vitest-temp.json

# SWC
.swc
3 changes: 2 additions & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
npx --no -- commitlint --edit $1
echo 'Linting commit message...'
pnpm commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npx lint-staged
pnpm lint-staged
5 changes: 3 additions & 2 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
"biome check --apply-unsafe --no-errors-on-unmatched"
]
"biome check --staged --apply-unsafe --no-errors-on-unmatched"
],
"src/**/*.ts": ["tsc --noEmit"]
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/iron
lts/jod
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"workbench.iconTheme": "catppuccin-mocha",
"workbench.colorTheme": "Catppuccin Mocha",
"typescript.updateImportsOnFileMove.enabled": "always",
"githubPullRequests.pullBranch": "never",
"git.confirmSync": false,
"explorer.confirmDragAndDrop": false,
"[markdown]": {
Expand Down
8 changes: 4 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
"tasks": [
{
"type": "npm",
"script": "size",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"label": "Build",
"detail": "pnpm size"
"detail": "pnpm build"
},
{
"type": "npm",
"script": "test:dev",
"script": "test",
"problemMatcher": [],
"label": "Test (development)",
"detail": "pnpm test:dev",
"detail": "pnpm test",
"group": {
"kind": "test",
"isDefault": true
Expand Down
34 changes: 4 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,13 @@ pnpm add axios axios-cache-interceptor pokenode-ts

## Basic Example

Using a client, like PokemonClient:

```ts
import { PokemonClient } from 'pokenode-ts';

(async () => {
const api = new PokemonClient();

try {
const pokemonData = await api.getPokemonByName('luxray');
console.log(pokemonData.name); // Outputs "Luxray"
} catch (error) {
console.error(error);
}
})();
import { PokemonClient } from 'pokenode-ts'; // Import the Client

```

Or, using the MainClient:
const pokemon = await api.getPokemonByName('luxray') // Make the request
.catch(() => console.log("Oops!"));

```ts
import { MainClient } from 'pokenode-ts';

(async () => {
const api = new MainClient();

try {
const pokemonData = await api.pokemon.getPokemonByName('luxray');
console.log(pokemonData.name); // Outputs "Luxray"
} catch (error) {
console.error(error);
}
})();
console.log(pokemon.name); // Typesafe response ✨ (Outputs "Luxray")
```

## Documentation
Expand Down
12 changes: 9 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.4/schema.json",
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"organizeImports": {
"enabled": true
},
Expand All @@ -8,14 +13,15 @@
"rules": {
"recommended": true
},
"ignore": ["lib"]
"ignore": ["node_modules", "lib"]
},
"formatter": {
"enabled": true,
"formatWithErrors": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100,
"ignore": ["lib"]
"lineEnding": "lf",
"ignore": ["node_modules", "lib"]
}
}
1 change: 0 additions & 1 deletion commitlint.config.cjs

This file was deleted.

3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
extends: ["@commitlint/config-conventional"],
};
Loading