Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add Electron to `clerk init` framework detection and `--framework`

Đã đóng
#482 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 4 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
electron, typescript
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu với packages/cli-core/src/lib/framework.ts và FRAMEWORK_MAP của nó, sau đó kiểm tra packages/cli-core/src/commands/env/pull.ts và luồng init. Xác minh rằng các dự án Electron Forge được phát hiện là Electron, các cài đặt môi trường của Electron SDK và publishable key được chọn, đồng thời CLERK_SECRET_KEY được bỏ qua; kiểm tra xem hành vi của starter và các bài kiểm thử hiện có cũng có cần được cập nhật hay không.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

clerk init cannot set up @clerk/electron. --framework has no electron choice, and detection (packages/cli-core/src/lib/framework.ts FRAMEWORK_MAP) matches an Electron Forge project as React once react is installed (React precedes Vite in the map) or as Vite/JavaScript before that, so init installs @clerk/react or @clerk/clerk-js. clerk env pull writes the right variable name (VITE_CLERK_PUBLISHABLE_KEY) but also writes CLERK_SECRET_KEY, because packages/cli-core/src/commands/env/pull.ts includes the secret key for every npm framework. A secret key has no use in an Electron app, so the docs cannot recommend env pull either.

The Electron docs (clerk/clerk#3382) therefore use the manual Publishable Key step and carry no CLI instructions.

Proposal

Add an entry to FRAMEWORK_MAP before the react and vite entries, since Electron Forge projects contain both:

{
  dep: "electron",
  name: "Electron",
  sdk: "@clerk/electron",
  envVar: "VITE_CLERK_PUBLISHABLE_KEY",
  envFile: ".env",
},

Notes for the implementer:

  • @clerk/electron needs electron-store installed alongside it (optional peer used by @clerk/electron/storage); sdkInstall may need to cover both.
  • Electron has no secret key; init and env pull should skip CLERK_SECRET_KEY for this framework the way the iOS and Android entries do (extend isNpmFramework/includeSecretKey or add a per-framework flag).
  • The Electron renderer's Content Security Policy needs the instance's Frontend API host; the docs put it in .env as VITE_CLERK_FRONTEND_API_HOST, which env pull could write too.
  • --starter could scaffold with Electron Forge: npm init electron-app@latest <name> -- --template=vite-typescript plus React, matching the docs quickstart at https://clerk.com/docs/electron/getting-started/quickstart.
  • Keyless is not supported by the Electron SDK today (the SDK requires publishableKey).

Follow-up in docs

Once shipped, the quickstart gains a "For AI agents" block with npx clerk@latest init --framework electron and a <PromptOnly> card (tracked in Linear DOCS, linked from the docs PR).

Ngôn ngữ chính
TypeScript
Star
55
Fork
5
Merge trung bình
5 ngày 17 giờ
Pull request đã merge (30 ngày)
33

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của clerk/cli

Tất cả issue của clerk/cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.