Skip to content

Commit d76e137

Browse files
committed
feat!: drop node < 22 support
import source file with ts extensions
1 parent d851641 commit d76e137

25 files changed

Lines changed: 96 additions & 76 deletions

example/tsconfig.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"paths": {
5+
"sponsorkit": [
6+
"../src/index.ts"
7+
]
8+
},
9+
"declaration": false
10+
},
11+
"exclude": []
12+
}

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
"bin",
3333
"dist"
3434
],
35+
"engines": {
36+
"node": "^22.18.0 || ^24.11.0 || >=26.0.0"
37+
38+
},
3539
"scripts": {
3640
"build": "tsdown",
3741
"dev": "tsx src/cli.ts",
@@ -66,9 +70,6 @@
6670
"vite": "^8.2.0",
6771
"vitest": "^4.1.10"
6872
},
69-
"resolutions": {
70-
"sponsorkit": "workspace:*"
71-
},
7273
"inlinedDependencies": {
7374
"@antfu/utils": "9.3.0",
7475
"@fast-csv/parse": "5.0.7",

src/cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Sponsorship } from './types'
1+
import type { Sponsorship } from './types.ts'
22
import { Buffer } from 'node:buffer'
33

44
export function stringifyCache(cache: Sponsorship[]): string {

src/cli.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env node
2-
import type { SponsorkitConfig } from './types'
2+
import type { SponsorkitConfig } from './types.ts'
33
import cac from 'cac'
4-
import { version } from '../package.json'
5-
import { run } from './run'
4+
import pkg from '../package.json' with { type: 'json' }
5+
import { run } from './run.ts'
66

77
const RE_FILTER = /([<>=]+)(\d+)/
88
const cli = cac('sponsors-svg')
9-
.version(version)
9+
.version(pkg.version)
1010
.help()
1111

1212
cli

src/configs/defaults.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { SponsorkitConfig, Tier } from '../types'
2-
import { tierPresets } from './tier-presets'
1+
import type { SponsorkitConfig, Tier } from '../types.ts'
2+
import { tierPresets } from './tier-presets.ts'
33

44
export const defaultTiers: Tier[] = [
55
{

src/configs/env.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { GitHubAccountType, SponsorkitConfig } from '../types'
1+
import type { GitHubAccountType, SponsorkitConfig } from '../types.ts'
22
import process from 'node:process'
33

44
function getDeprecatedEnv(name: string, replacement: string) {
@@ -9,7 +9,10 @@ function getDeprecatedEnv(name: string, replacement: string) {
99
}
1010

1111
export function loadEnv(): Partial<SponsorkitConfig> {
12-
process.loadEnvFile('.env')
12+
try {
13+
process.loadEnvFile('.env')
14+
}
15+
catch {}
1316

1417
const config: Partial<SponsorkitConfig> = {
1518
mode: process.env.SPONSORKIT_MODE as SponsorkitConfig['mode'] | undefined,

src/configs/fallback.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { svgToPng } from '../processing/image'
1+
import { svgToPng } from '../processing/image.ts'
22

33
const fallback = `
44
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 135.47 135.47">

src/configs/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type { SponsorkitConfig, Sponsorship, Tier, TierPartition } from '../types'
1+
import type { SponsorkitConfig, Sponsorship, Tier, TierPartition } from '../types.ts'
22
import { loadConfig as _loadConfig } from 'unconfig'
3-
import { defaultConfig } from './defaults'
4-
import { loadEnv } from './env'
5-
import { FALLBACK_AVATAR } from './fallback'
3+
import { defaultConfig } from './defaults.ts'
4+
import { loadEnv } from './env.ts'
5+
import { FALLBACK_AVATAR } from './fallback.ts'
66

7-
export * from './defaults'
8-
export * from './fallback'
9-
export * from './tier-presets'
7+
export * from './defaults.ts'
8+
export * from './fallback.ts'
9+
export * from './tier-presets.ts'
1010

1111
export function defineConfig(config: SponsorkitConfig): SponsorkitConfig {
1212
return config

src/configs/tier-presets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { BadgePreset } from '../types'
1+
import type { BadgePreset } from '../types.ts'
22

33
const none: BadgePreset = {
44
avatar: {

src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export * from './configs'
2-
export * from './processing/image'
3-
export * from './processing/svg'
4-
export * from './providers'
5-
export * from './types'
1+
export * from './configs/index.ts'
2+
export * from './processing/image.ts'
3+
export * from './processing/svg.ts'
4+
export * from './providers/index.ts'
5+
export * from './types.ts'

0 commit comments

Comments
 (0)