diff --git a/.npmignore b/.npmignore index 7cc8d56..e6688b6 100644 --- a/.npmignore +++ b/.npmignore @@ -19,3 +19,4 @@ biome.json tsup.config.ts vitest.config.ts bun.lockb +bun.build.js diff --git a/biome.json b/biome.json index ed8dca7..2b2bbc9 100644 --- a/biome.json +++ b/biome.json @@ -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 }, diff --git a/bun.build.js b/bun.build.js new file mode 100644 index 0000000..4adece8 --- /dev/null +++ b/bun.build.js @@ -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()] +}) diff --git a/bun.lockb b/bun.lockb index f8a274d..88c6a29 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 531e69b..1ceffb7 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" } } diff --git a/src/__tests__/anime-client.spec.ts b/src/__tests__/anime-client.spec.ts index 691c6e3..9a1b8a2 100644 --- a/src/__tests__/anime-client.spec.ts +++ b/src/__tests__/anime-client.spec.ts @@ -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' @@ -16,7 +16,6 @@ describe('test Anime Client', () => { it('should be instantiated correctly', () => { expect(client).toBeDefined() - assertType(client) }) // Endpoints diff --git a/src/__tests__/genres-client.spec.ts b/src/__tests__/genres-client.spec.ts index b9953f4..a5a535d 100644 --- a/src/__tests__/genres-client.spec.ts +++ b/src/__tests__/genres-client.spec.ts @@ -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' diff --git a/src/__tests__/manga-client.spec.ts b/src/__tests__/manga-client.spec.ts index 7a00db6..cd0017d 100644 --- a/src/__tests__/manga-client.spec.ts +++ b/src/__tests__/manga-client.spec.ts @@ -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, diff --git a/src/__tests__/seasons-client.spec.ts b/src/__tests__/seasons-client.spec.ts index 949bb38..fc6dc5a 100644 --- a/src/__tests__/seasons-client.spec.ts +++ b/src/__tests__/seasons-client.spec.ts @@ -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, diff --git a/src/__tests__/top-client.spec.ts b/src/__tests__/top-client.spec.ts index 95c8a01..bab52ab 100644 --- a/src/__tests__/top-client.spec.ts +++ b/src/__tests__/top-client.spec.ts @@ -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, diff --git a/tsconfig.json b/tsconfig.json index dd3b5ad..e106c2e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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"] } diff --git a/tsup.config.ts b/tsup.config.ts deleted file mode 100644 index 85a7a2e..0000000 --- a/tsup.config.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { defineConfig } from 'tsup'; -import { peerDependencies } from './package.json'; - -// Extract peerDependencies from package.json -const EXTERNAL_DEPS = Object.keys(peerDependencies as Record); - -export default defineConfig({ - // Entry file(s) for the bundling process - entry: ['src/index.ts'], - // Output directory for the bundled code - outDir: 'dist', - // Enable code splitting for better performance - splitting: true, - // Specify external dependencies to exclude from the bundle - external: EXTERNAL_DEPS, - // Generate source maps - sourcemap: false, - // Clean the output directory before each build if not in a continuous integration environment - clean: true, - // Generate declaration files (.d.ts) - dts: true, - // Output formats: CommonJS and ECMAScript modules - format: ['esm'], - // Minify the code if in a continuous integration environment - minify: true, -});