Skip to content

Commit 48a5484

Browse files
jeremy-clerkwobsoriano
authored andcommitted
feat(electron): scaffold initial @clerk/electron package
Add the initial packages/electron package with metadata, dual ESM+CJS tsup build, exports, and a README placeholder. Exposes the intended entrypoints with stubbed bodies: - @clerk/electron (Electron main process) - @clerk/electron/preload (Electron preload scripts)
1 parent 7cfd510 commit 48a5484

11 files changed

Lines changed: 255 additions & 1 deletion

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

‎packages/electron/LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Clerk, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎packages/electron/README.md‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<p align="center">
2+
<a href="https://clerk.com?utm_source=github&utm_medium=clerk_electron" target="_blank" rel="noopener noreferrer">
3+
<picture>
4+
<source media="(prefers-color-scheme: dark)" srcset="https://images.clerk.com/static/logo-dark-mode-400x400.png">
5+
<img src="https://images.clerk.com/static/logo-light-mode-400x400.png" height="64">
6+
</picture>
7+
</a>
8+
<br />
9+
<h1 align="center">@clerk/electron</h1>
10+
</p>
11+
12+
<div align="center">
13+
14+
[![Clerk documentation](https://img.shields.io/badge/documentation-clerk-green.svg)](https://clerk.com/docs?utm_source=github&utm_medium=clerk_electron)
15+
[![Follow on X](https://img.shields.io/twitter/follow/clerk?style=social)](https://x.com/intent/follow?screen_name=clerk)
16+
17+
[Changelog](https://github.com/clerk/javascript/blob/main/packages/electron/CHANGELOG.md)
18+
·
19+
[Report a Bug](https://github.com/clerk/javascript/issues/new?assignees=&labels=needs-triage&projects=&template=BUG_REPORT.yml)
20+
·
21+
[Request a Feature](https://feedback.clerk.com/roadmap)
22+
·
23+
[Get help](https://clerk.com/contact/support?utm_source=github&utm_medium=clerk_electron)
24+
25+
</div>
26+
27+
## Getting Started
28+
29+
[Clerk](https://clerk.com/?utm_source=github&utm_medium=clerk_electron) is the easiest way to add authentication and user management to your Electron application.
30+
31+
> [!WARNING]
32+
> `@clerk/electron` is under active development and is not yet ready for production use. The API is incomplete and subject to change.
33+
34+
This package exposes two entrypoints, targeting Electron's distinct runtime contexts:
35+
36+
- `@clerk/electron` — for use in the Electron **main** process.
37+
- `@clerk/electron/preload` — for use in Electron **preload** scripts.
38+
39+
## Support
40+
41+
For help, visit our [support page](https://clerk.com/contact/support?utm_source=github&utm_medium=clerk_electron).
42+
43+
## Contributing
44+
45+
We're open to all community contributions! If you'd like to contribute in any way, please read [our contribution guidelines](https://github.com/clerk/javascript/blob/main/docs/CONTRIBUTING.md) and [code of conduct](https://github.com/clerk/javascript/blob/main/docs/CODE_OF_CONDUCT.md).
46+
47+
## Security
48+
49+
`@clerk/electron` follows good practices of security, but 100% security cannot be assured.
50+
51+
`@clerk/electron` is provided **"as is"** without any **warranty**. Use at your own risk.
52+
53+
_For more information and to report security issues, please refer to our [security documentation](https://github.com/clerk/javascript/blob/main/docs/SECURITY.md)._
54+
55+
## License
56+
57+
This project is licensed under the **MIT license**.
58+
59+
See [LICENSE](https://github.com/clerk/javascript/blob/main/packages/electron/LICENSE) for more information.

‎packages/electron/package.json‎

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"name": "@clerk/electron",
3+
"version": "0.0.0",
4+
"description": "Clerk SDK for Electron",
5+
"keywords": [
6+
"clerk",
7+
"electron",
8+
"auth",
9+
"authentication",
10+
"session",
11+
"jwt",
12+
"desktop"
13+
],
14+
"homepage": "https://clerk.com/",
15+
"bugs": {
16+
"url": "https://github.com/clerk/javascript/issues"
17+
},
18+
"repository": {
19+
"type": "git",
20+
"url": "git+https://github.com/clerk/javascript.git",
21+
"directory": "packages/electron"
22+
},
23+
"license": "MIT",
24+
"author": "Clerk",
25+
"sideEffects": false,
26+
"exports": {
27+
".": {
28+
"import": {
29+
"types": "./dist/types/index.d.ts",
30+
"default": "./dist/esm/index.js"
31+
},
32+
"require": {
33+
"types": "./dist/types/index.d.ts",
34+
"default": "./dist/cjs/index.js"
35+
}
36+
},
37+
"./preload": {
38+
"import": {
39+
"types": "./dist/types/preload/index.d.ts",
40+
"default": "./dist/esm/preload/index.js"
41+
},
42+
"require": {
43+
"types": "./dist/types/preload/index.d.ts",
44+
"default": "./dist/cjs/preload/index.js"
45+
}
46+
},
47+
"./package.json": "./package.json"
48+
},
49+
"main": "./dist/cjs/index.js",
50+
"module": "./dist/esm/index.js",
51+
"types": "./dist/types/index.d.ts",
52+
"files": [
53+
"dist",
54+
"preload"
55+
],
56+
"scripts": {
57+
"build": "tsup",
58+
"build:declarations": "tsc -p tsconfig.declarations.json",
59+
"clean": "rimraf ./dist",
60+
"dev": "tsup --watch",
61+
"format": "node ../../scripts/format-package.mjs",
62+
"format:check": "node ../../scripts/format-package.mjs --check",
63+
"lint": "eslint src",
64+
"lint:attw": "attw --pack . --profile node16 --ignore-rules unexpected-module-syntax",
65+
"lint:publint": "publint",
66+
"test": "vitest run",
67+
"test:ci": "vitest run --maxWorkers=70%",
68+
"test:watch": "vitest"
69+
},
70+
"dependencies": {
71+
"tslib": "catalog:repo"
72+
},
73+
"devDependencies": {
74+
"@types/node": "^22.19.17"
75+
},
76+
"engines": {
77+
"node": ">=20.9.0"
78+
},
79+
"publishConfig": {
80+
"access": "public"
81+
}
82+
}

‎packages/electron/src/global.d.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare const PACKAGE_NAME: string;
2+
declare const PACKAGE_VERSION: string;
3+
declare const __DEV__: boolean;

‎packages/electron/src/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// TODO: Implement the Clerk SDK for the Electron main process.
2+
export const SDK_NAME = PACKAGE_NAME;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// TODO: Implement the Clerk preload bridge for the Electron preload context.
2+
export const SDK_NAME = PACKAGE_NAME;
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+
"skipLibCheck": true,
5+
"noEmit": false,
6+
"declaration": true,
7+
"emitDeclarationOnly": true,
8+
"declarationMap": true,
9+
"sourceMap": false,
10+
"declarationDir": "./dist/types"
11+
}
12+
}

‎packages/electron/tsconfig.json‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2019",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"esModuleInterop": true,
8+
"allowSyntheticDefaultImports": true,
9+
"strict": true,
10+
"forceConsistentCasingInFileNames": true,
11+
"noFallthroughCasesInSwitch": true,
12+
"module": "preserve",
13+
"moduleResolution": "bundler",
14+
"resolveJsonModule": true,
15+
"isolatedModules": true,
16+
"jsx": "react-jsx",
17+
"declaration": true,
18+
"declarationDir": "dist/types",
19+
"declarationMap": true,
20+
"emitDeclarationOnly": true
21+
},
22+
"include": ["src"]
23+
}

‎packages/electron/tsup.config.ts‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import type { Options } from 'tsup';
2+
import { defineConfig } from 'tsup';
3+
4+
import { runAfterLast } from '../../scripts/utils';
5+
import { name, version } from './package.json';
6+
7+
export default defineConfig(overrideOptions => {
8+
const isWatch = !!overrideOptions.watch;
9+
const shouldPublish = !!overrideOptions.env?.publish;
10+
11+
const common: Options = {
12+
entry: ['./src/index.ts', './src/preload/index.ts'],
13+
bundle: true,
14+
clean: true,
15+
minify: false,
16+
sourcemap: true,
17+
legacyOutput: true,
18+
treeshake: true,
19+
define: {
20+
PACKAGE_NAME: `"${name}"`,
21+
PACKAGE_VERSION: `"${version}"`,
22+
__DEV__: `${isWatch}`,
23+
},
24+
};
25+
26+
const esm: Options = {
27+
...common,
28+
format: 'esm',
29+
};
30+
31+
const cjs: Options = {
32+
...common,
33+
format: 'cjs',
34+
outDir: './dist/cjs',
35+
};
36+
37+
return runAfterLast(['pnpm build:declarations', shouldPublish && 'pkglab pub --ping'])(esm, cjs);
38+
});

0 commit comments

Comments
 (0)