Skip to content

Commit 1c2ef97

Browse files
authored
refactor: bun/biome switch, rm node-fetch, update configs, render service helpers
* bun/biome switch, rm node-fetch, update configs - Switch package manager to Bun - Switch to Biome for formatting/linting - Remove node-fetch - Modernize tsconfig - Update gitignore - README changes * update release workflow * project cleanup - Rename config.ts to urls.ts - Better error handling and typing - Split render url string builders from sdk - Private fields instead of private keyword - Region instead of Server - Updated README
1 parent 66b22c8 commit 1c2ef97

19 files changed

+279
-2237
lines changed

.eslintrc.cjs

-15
This file was deleted.

.github/workflows/cd.yml

+7-13
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,34 @@ name: Deployment
33
on:
44
push:
55
branches:
6-
- main
6+
- main
77

88
jobs:
99
release:
1010
name: Build and create release
1111
runs-on: ubuntu-latest
12-
permissions:
13-
contents: read
14-
packages: write
1512

1613
steps:
1714
- name: Checkout
1815
uses: actions/checkout@v4
1916

17+
- name: Install Bun
18+
uses: oven-sh/setup-bun@v1
19+
2020
- name: Install Node.js
2121
uses: actions/setup-node@v4
2222
with:
2323
node-version: 20.12.2
2424
registry-url: "https://registry.npmjs.org"
2525

26-
- uses: pnpm/action-setup@v2
27-
name: Install pnpm
28-
id: pnpm-install
29-
with:
30-
run_install: false
31-
3226
- name: Install dependencies
33-
run: pnpm install --no-frozen-lockfile
27+
run: bun install
3428

3529
- name: Build project
36-
run: pnpm run build
30+
run: bun run build
3731

3832
- name: Publish package on NPM
39-
run: pnpm publish --access public --no-git-checks
33+
run: npm publish
4034

4135
env:
4236
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.gitignore

+31-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
1+
# Created by https://www.toptal.com/developers/gitignore/api/node
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=node
23

3-
# dependencies
4-
node_modules
5-
.pnp
6-
.pnp.js
7-
8-
# testing
9-
coverage
10-
11-
# build directories
12-
dist/
13-
14-
# misc
4+
### macOS ###
5+
# General
156
.DS_Store
16-
*.pem
177

18-
# debug
8+
### Intellij ###
9+
# User-specific stuff
10+
.idea/
11+
12+
### Node ###
13+
# Logs
14+
logs
15+
*.log
1916
npm-debug.log*
2017
yarn-debug.log*
2118
yarn-error.log*
19+
lerna-debug.log*
2220
.pnpm-debug.log*
21+
22+
# Dependency directories
23+
node_modules/
24+
25+
# Build directories
26+
dist/
27+
28+
# TypeScript cache
29+
*.tsbuildinfo
30+
31+
# dotenv environment variable files
32+
.env
33+
.env.development.local
34+
.env.test.local
35+
.env.production.local
36+
.env.local
37+
38+
# End of https://www.toptal.com/developers/gitignore/api/node

.npmrc

-1
This file was deleted.

README.md

+20-6
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,30 @@ Designed with ❤️ for the Albion community.
2121
## Usage
2222

2323
```javascript
24-
import { AlbionSDK } from "albion-sdk"
24+
import { AlbionSDK } from "albion-sdk";
25+
/* OR */
26+
const { AlbionSDK } = require("albion-sdk");
2527

26-
const api = new AlbionSDK("Americas")
28+
const sdk = new AlbionSDK("Americas");
2729

28-
api
30+
sdk
2931
.search("man")
3032
.then((res) => {
31-
console.log(res)
33+
console.log(res);
3234
})
3335
.catch((e) => {
34-
console.log(e)
35-
})
36+
console.error(e);
37+
});
3638
```
39+
40+
## Render Service URL Builders
41+
42+
This package exposes several functions to generate URLs for the Albion Online Render Service, making it easy to integrate the Render Service into your application.
43+
44+
The following functions are available:
45+
46+
- itemIconUrl(item: string, params?: RenderItemParams): string
47+
- spellIconUrl(spell: string, params?: RenderSpellParams): string
48+
- wardrobeIconUrl(item: string): string
49+
- destinyBoardIconUrl(node: string, params?: RenderDestinyBoardParams): string
50+
- guildLogoUrl(params: RenderGuildLogoParams): string

biome.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.7.2/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"linter": {
7+
"enabled": true,
8+
"rules": {
9+
"recommended": true
10+
}
11+
},
12+
"files": {
13+
"ignore": ["node_modules", "dist"]
14+
}
15+
}

bun.lockb

60.4 KB
Binary file not shown.

package.json

+12-25
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
22
"name": "albion-sdk",
3-
"description": "Albion Online API SDK",
43
"version": "0.8.0",
5-
"license": "MIT",
64
"author": "Cody Tenney",
75
"repository": {
86
"type": "git",
97
"url": "https://github.com/c-wide/albion-sdk"
108
},
11-
"keywords": ["albion", "albion-online"],
12-
"type": "module",
139
"main": "./dist/index.js",
14-
"types": "./dist/index.d.ts",
10+
"devDependencies": {
11+
"@biomejs/biome": "1.7.2",
12+
"@types/node": "^20.5.1",
13+
"tsup": "^7.2.0",
14+
"typescript": "^5.1.6"
15+
},
1516
"exports": {
1617
".": {
1718
"import": {
@@ -24,28 +25,14 @@
2425
}
2526
}
2627
},
27-
"sideEffects": false,
28+
"description": "Albion Online API SDK",
2829
"files": ["dist"],
30+
"keywords": ["albion", "albion-online"],
31+
"license": "MIT",
2932
"scripts": {
30-
"lint": "eslint \"src/**/*.ts*\" && tsc --noEmit",
31-
"format": "prettier --write ./src",
32-
"format-check": "prettier --check ./src",
3333
"build": "tsup"
3434
},
35-
"devDependencies": {
36-
"@ianvs/prettier-plugin-sort-imports": "^4.1.0",
37-
"@types/node": "^20.5.1",
38-
"@types/node-fetch": "^2.6.4",
39-
"@typescript-eslint/eslint-plugin": "^6.4.1",
40-
"@typescript-eslint/parser": "^6.4.1",
41-
"eslint": "^8.47.0",
42-
"eslint-config-prettier": "^9.0.0",
43-
"prettier": "^3.0.2",
44-
"tsup": "^7.2.0",
45-
"typescript": "^5.1.6"
46-
},
47-
"packageManager": "pnpm@8.6.9",
48-
"dependencies": {
49-
"node-fetch": "^2.7.0"
50-
}
35+
"sideEffects": false,
36+
"type": "module",
37+
"types": "./dist/index.d.ts"
5138
}

0 commit comments

Comments
 (0)