Skip to content

Commit db94ac3

Browse files
authored
chore(hono): prepare @clerk/hono for initial release (#7963)
1 parent 25d37b0 commit db94ac3

18 files changed

Lines changed: 246 additions & 5 deletions

File tree

.changeset/clerk-hono-initial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
'@clerk/hono': minor
2+
'@clerk/hono': patch
33
---
44

55
Initial release of `@clerk/hono` - the official Clerk SDK for Hono.

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}
88
],
99
"commit": false,
10-
"ignore": ["@clerk/hono"],
10+
"ignore": [],
1111
"fixed": [],
1212
"linked": [],
1313
"access": "public",

integration/presets/hono.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { applicationConfig } from '../models/applicationConfig';
2+
import { templates } from '../templates';
3+
import { linkPackage } from './utils';
4+
5+
const vite = applicationConfig()
6+
.setName('hono-vite')
7+
.useTemplate(templates['hono-vite'])
8+
.setEnvFormatter('public', key => `VITE_${key}`)
9+
.addScript('setup', 'pnpm install')
10+
.addScript('dev', 'pnpm dev')
11+
.addScript('build', 'pnpm build')
12+
.addScript('serve', 'pnpm start')
13+
.addDependency('@clerk/hono', linkPackage('hono'))
14+
.addDependency('@clerk/clerk-js', linkPackage('clerk-js'))
15+
.addDependency('@clerk/ui', linkPackage('ui'));
16+
17+
export const hono = {
18+
vite,
19+
} as const;

integration/presets/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { customFlows } from './custom-flows';
33
import { envs, instanceKeys } from './envs';
44
import { expo } from './expo';
55
import { express } from './express';
6+
import { hono } from './hono';
67
import { createLongRunningApps } from './longRunningApps';
78
import { next } from './next';
89
import { nuxt } from './nuxt';
@@ -15,6 +16,7 @@ export const appConfigs = {
1516
customFlows,
1617
envs,
1718
express,
19+
hono,
1820
longRunningApps: createLongRunningApps(),
1921
next,
2022
react,

integration/presets/longRunningApps.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { astro } from './astro';
44
import { envs } from './envs';
55
import { expo } from './expo';
66
import { express } from './express';
7+
import { hono } from './hono';
78
import { next } from './next';
89
import { nuxt } from './nuxt';
910
import { react } from './react';
@@ -80,6 +81,11 @@ export const createLongRunningApps = () => {
8081
{ id: 'nuxt.node', config: nuxt.node, env: envs.withCustomRoles },
8182
{ id: 'react-router.node', config: reactRouter.reactRouterNode, env: envs.withEmailCodes },
8283
{ id: 'express.vite.withEmailCodes', config: express.vite, env: envs.withEmailCodes },
84+
85+
/**
86+
* Hono apps
87+
*/
88+
{ id: 'hono.vite.withEmailCodes', config: hono.vite, env: envs.withEmailCodes },
8389
] as const;
8490

8591
const apps = configs.map(longRunningApplication);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + TS + Hono</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/client/main.ts"></script>
12+
</body>
13+
</html>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "hono-vite",
3+
"version": "0.0.0",
4+
"private": true,
5+
"scripts": {
6+
"build": "vite build",
7+
"dev": "PORT=$PORT tsx src/server/main.ts",
8+
"preview": "vite preview --port $PORT --no-open",
9+
"start": "PORT=$PORT NODE_ENV=production tsx src/server/main.ts"
10+
},
11+
"dependencies": {
12+
"@hono/node-server": "^1.14.1",
13+
"dotenv": "^17.2.1",
14+
"express": "^5.1.0",
15+
"hono": "^4.7.10",
16+
"tsx": "^4.20.3",
17+
"vite-express": "^0.21.1"
18+
},
19+
"devDependencies": {
20+
"@types/express": "^5.0.3",
21+
"@types/node": "^24.2.1",
22+
"typescript": "^5.8.3",
23+
"vite": "^6.3.3"
24+
}
25+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Clerk } from '@clerk/clerk-js';
2+
import { ClerkUI } from '@clerk/ui/entry';
3+
4+
const publishableKey = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY;
5+
6+
document.addEventListener('DOMContentLoaded', async function () {
7+
const clerk = new Clerk(publishableKey);
8+
9+
await clerk.load({
10+
ui: { ClerkUI },
11+
});
12+
13+
if (clerk.isSignedIn) {
14+
document.getElementById('app')!.innerHTML = `
15+
<div id="user-button"></div>
16+
`;
17+
18+
const userButtonDiv = document.getElementById('user-button');
19+
20+
clerk.mountUserButton(userButtonDiv);
21+
} else {
22+
document.getElementById('app')!.innerHTML = `
23+
<div id="sign-in"></div>
24+
`;
25+
26+
const signInDiv = document.getElementById('sign-in');
27+
28+
clerk.mountSignIn(signInDiv);
29+
}
30+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"module": "ESNext",
5+
"moduleResolution": "Bundler"
6+
}
7+
}

0 commit comments

Comments
 (0)