Skip to content

Commit

Permalink
chore: upgrade bun
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-run committed Apr 12, 2024
1 parent d096ae9 commit bc9c7ac
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ jobs:
if: "!contains(github.event.head_commit.message, 'docs:')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.25
bun-version: 1.1.3
- run: bun install --frozen-lockfile
- run: bun run tsc
- run: bun run lint
- run: bun run build-cli
- run: bun run sanity-check
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
registry-url: 'https://npm.pkg.github.com'
scope: '@navikt'
- run: npm publish
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
},
"devDependencies": {
"@navikt/eslint-config-teamsykmelding": "^5.2.0",
"@types/bun": "^1.0.12",
"@types/fs-extra": "^11.0.4",
"@types/inquirer": "^9.0.7",
"@types/inquirer-autocomplete-prompt": "^3.0.3",
"@types/yargs": "^17.0.32",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"bun-types": "^1.1.3",
"eslint": "^8.54.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
Expand Down
2 changes: 1 addition & 1 deletion src/actions/gh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async function loadCachedRepos(): Promise<string[]> {
const cachedRepos = Bun.file(path.join(CACHE_DIR, `repos-${team}.json`))
if (!(await cachedRepos.exists())) return []

return await cachedRepos.json<string[]>()
return await cachedRepos.json()
} catch (e) {
logError('Error loading cached repos', e)
return []
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/analytics-global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function loadGlobalAnalytics(): Promise<UserCommandUsage> {
const cachedAnalytics = Bun.file(path.join(CONFIG_DIR, `analytics${IS_DEV ? '-dev' : ''}.json`))
if (!(await cachedAnalytics.exists())) return { user: Bun.env.USER ?? 'unknown', usage: {} }

return await cachedAnalytics.json<UserCommandUsage>()
return await cachedAnalytics.json()
}

async function saveGlobalAnalytics(updated: UserCommandUsage): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async function loadCachedAnalytics(): Promise<UserCommandUsage> {
const cachedAnalytics = Bun.file(path.join(CACHE_DIR, 'analytics.json'))
if (!(await cachedAnalytics.exists())) return { user: Bun.env.USER ?? 'unknown', usage: {} }

return await cachedAnalytics.json<UserCommandUsage>()
return await cachedAnalytics.json()
}

async function saveCachedAnalytics(updated: UserCommandUsage): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/common/authors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function getCachedCoAuthors(): Promise<Author[] | []> {
const coAuthorsFile = Bun.file(path.join(CACHE_DIR, 'co-authors.json'))

if (await coAuthorsFile.exists()) {
return coAuthorsFile.json<Author[]>()
return coAuthorsFile.json()
}

return []
Expand Down
2 changes: 1 addition & 1 deletion src/common/cache/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ export async function getTeamsCache(): Promise<string[]> {
return []
}

return file.json<string[]>()
return file.json()
}
6 changes: 3 additions & 3 deletions src/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function getConfig(): Promise<Config> {
config = defaultConfig as Config
await Bun.write(configFile, JSON.stringify(defaultConfig))
} else {
config = await configFile.json<Config>()
config = await configFile.json()
}

if (!config.ide) {
Expand All @@ -73,7 +73,7 @@ export async function isTeamConfigured(): Promise<boolean> {

if (!fileExists) return false

const config = await configFile.json<{ team: string | undefined }>()
const config: { team: string | undefined } = await configFile.json()
return config.team != null
}

Expand All @@ -82,7 +82,7 @@ export async function migrateFromCacheToConfigDir(cacheDir: string, configDir: s
const cacheConfigFile = Bun.file(configInCacheDir)
if (await cacheConfigFile.exists()) {
log(chalk.blue('\n...Found config in cache dir, migrating to config dir. This is a one-time-thing. :)\n'))
const cacheConfigContent = await cacheConfigFile.json<Config>()
const cacheConfigContent: Config = await cacheConfigFile.json()
const newConfigFile = Bun.file(path.join(configDir, 'config.json'))
await Bun.write(newConfigFile, JSON.stringify(cacheConfigContent))
fs.unlinkSync(configInCacheDir)
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (
}
}

if (!semver || !semver.satisfies(Bun.version, '>= 1.0.25')) {
if (!semver || !semver.satisfies(Bun.version, '>= 1.1.0')) {
log(chalk.red('Oh no!!!!!'))
log(`This version of ${chalk.blue('tsm')} requires at least ${chalk.green('bun')} version ${chalk.green('1.0.25')}`)
log(`Please run ${chalk.green('bun upgrade')} to upgrade`)
Expand Down

0 comments on commit bc9c7ac

Please sign in to comment.