Skip to content

Commit

Permalink
Merge pull request #14 from tutkli/bun
Browse files Browse the repository at this point in the history
build: use bun as builder and test runner
  • Loading branch information
tutkli authored Jan 25, 2025
2 parents e12ac05 + 601c3b1 commit 605681a
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 69 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ biome.json
tsup.config.ts
vitest.config.ts
bun.lockb
bun.build.js
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"organizeImports": {
"enabled": true
},
Expand Down
13 changes: 13 additions & 0 deletions bun.build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import dts from 'bun-plugin-dts'

await Bun.build({
entrypoints: ['./src/index.ts'],
outdir: './dist',
splitting: true,
external: ['axios', 'axios-cache-interceptor'],
sourcemap: 'none',
format: 'esm',
target: 'node',
minify: true,
plugins: [dts()]
})
Binary file modified bun.lockb
Binary file not shown.
30 changes: 13 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
"type": "module",
"scripts": {
"prepare": "git config core.hookspath .githooks",
"build": "tsup --config tsup.config.ts",
"build": "bun bun.build.js",
"prepublishOnly": "bun run build",
"test:ci": "vitest --silent --run",
"test:coverage": "vitest run --coverage",
"test:dev": "vitest",
"test:ui": "vitest --ui --coverage",
"test:dev": "bun test",
"test:coverage": "bun test --coverage",
"version": "auto-changelog -p -l false && git add CHANGELOG.md",
"format": "biome format ./src",
"format:fix": "biome format --write ./src",
Expand All @@ -36,20 +34,18 @@
},
"homepage": "https://github.com/tutkli/jikan-ts#readme",
"peerDependencies": {
"axios": "^1.6.8",
"axios-cache-interceptor": "^1.5.2"
"axios": "^1.7.9",
"axios-cache-interceptor": "^1.6.2"
},
"devDependencies": {
"@biomejs/biome": "1.7.3",
"@types/node": "20.12.10",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/ui": "^1.6.0",
"@biomejs/biome": "1.9.4",
"@types/bun": "latest",
"@types/node": "22.10.2",
"auto-changelog": "^2.5.0",
"axios": "^1.7.7",
"axios-cache-interceptor": "^1.6.1",
"lint-staged": "^15.2.10",
"tsup": "^8.3.0",
"typescript": "5.4.5",
"vitest": "^1.6.0"
"axios": "^1.7.9",
"axios-cache-interceptor": "^1.6.2",
"bun-plugin-dts": "^0.3.0",
"lint-staged": "^15.2.11",
"typescript": "5.7.2"
}
}
3 changes: 1 addition & 2 deletions src/__tests__/anime-client.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertType, beforeAll, beforeEach, describe, expect, it } from 'vitest'
import { beforeAll, beforeEach, describe, expect, it } from 'bun:test'
import { AnimeClient } from '../clients'
import type { AnimeSearchParams } from '../models'

Expand All @@ -16,7 +16,6 @@ describe('test Anime Client', () => {

it('should be instantiated correctly', () => {
expect(client).toBeDefined()
assertType<AnimeClient>(client)
})

// Endpoints
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/genres-client.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeAll, beforeEach, describe, expect, it } from 'vitest'
import { beforeAll, beforeEach, describe, expect, it } from 'bun:test'
import { GenresClient } from '../clients'
import { type Genre, GenresFilter, type JikanResponse } from '../models'

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/manga-client.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeAll, beforeEach, describe, expect, it } from 'vitest'
import { beforeAll, beforeEach, describe, expect, it } from 'bun:test'
import { MangaClient } from '../clients'
import type {
CommonCharacter,
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/seasons-client.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeAll, beforeEach, describe, expect, it } from 'vitest'
import { beforeAll, beforeEach, describe, expect, it } from 'bun:test'
import { SeasonsClient } from '../clients'
import {
type Anime,
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/top-client.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeAll, beforeEach, describe, expect, it } from 'vitest'
import { beforeAll, beforeEach, describe, expect, it } from 'bun:test'
import { TopClient } from '../clients'
import {
type Anime,
Expand Down
38 changes: 19 additions & 19 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "esnext",
"skipLibCheck": false,
"strict": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"types": ["node"],
"resolveJsonModule": true,
"typeRoots": ["./node_modules/@types"],
"experimentalDecorators": true,
"inlineSourceMap": false,
"isolatedModules": true,
"importHelpers": true
},
"exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.test.ts"]
"$schema": "http://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "esnext",
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"types": ["node", "bun"],
"resolveJsonModule": true,
"typeRoots": ["./node_modules/@types"],
"experimentalDecorators": true,
"inlineSourceMap": false,
"isolatedModules": true,
"importHelpers": true
},
"exclude": ["node_modules", "dist", "**/*.spec.ts", "**/*.test.ts"]
}
26 changes: 0 additions & 26 deletions tsup.config.ts

This file was deleted.

0 comments on commit 605681a

Please sign in to comment.