[PR #1750] [CLOSED] refactor(CLI): init command #3974

Closed
opened 2026-03-13 11:25:53 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/1750
Author: @ping-maxwell
Created: 3/9/2025
Status: Closed

Base: mainHead: update/cli/init


📝 Commits (2)

📊 Changes

31 files changed (+4091 additions, -1187 deletions)

View changed files

📝 docs/content/docs/concepts/cli.mdx (+57 -15)
packages/cli/src/commands/init.ts (+0 -1158)
packages/cli/src/commands/init/generators/generate-auth-client.ts (+68 -0)
packages/cli/src/commands/init/generators/generate-auth.ts (+87 -0)
packages/cli/src/commands/init/generators/generate-plugins-array.ts (+75 -0)
packages/cli/src/commands/init/generators/generate-social-providers.ts (+30 -0)
packages/cli/src/commands/init/generators/import-statements.ts (+24 -0)
packages/cli/src/commands/init/index.ts (+216 -0)
packages/cli/src/commands/init/step-utils.ts (+601 -0)
packages/cli/src/commands/init/steps/1-cli-version.ts (+89 -0)
packages/cli/src/commands/init/steps/10-generate-auth-files.ts (+96 -0)
packages/cli/src/commands/init/steps/11-generate-auth-api-route.ts (+215 -0)
packages/cli/src/commands/init/steps/12-check-env.ts (+29 -0)
packages/cli/src/commands/init/steps/13-check-tsconfig.ts (+101 -0)
packages/cli/src/commands/init/steps/2-get-framework.ts (+298 -0)
packages/cli/src/commands/init/steps/3-better-auth-installation.ts (+106 -0)
packages/cli/src/commands/init/steps/4-check-auth-files.ts (+211 -0)
packages/cli/src/commands/init/steps/5-app-name.ts (+122 -0)
packages/cli/src/commands/init/steps/6-database-adapter.ts (+96 -0)
packages/cli/src/commands/init/steps/7-plugins.ts (+114 -0)

...and 11 more files

📄 Description

Minor changes.

(Just joking 🤣)

Recoded the entire init command because the old version was just a pure mess.
There are a lot more "checks" in place and a much more solid foundation around each step of the init command.

Also, I've added these on the init command since the previous:

  • added social providers option
  • sqlite db adapter now prompts to also install the @types package as well (and saved in dev-deps)
  • we now generate the API route file for each supported framework
  • and probably other things I added that just forgot

The PR is much larger than the previous init code because:

  1. It's now code-split
  2. There is actual foundational code
    And 3, most importantly, it now is agnostic (only frontend/fullstack), whereas the previous only supported Nextjs

Note: This PR does not include the "story mode" idea.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/1750 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 3/9/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `update/cli/init` --- ### 📝 Commits (2) - [`2681d3a`](https://github.com/better-auth/better-auth/commit/2681d3add6eba9fcc8d4da4b2249fbbecf395f81) refactor(CLI): init command - [`b8cfaf0`](https://github.com/better-auth/better-auth/commit/b8cfaf07895cec1ccc644c38817bed174d63e0f4) update(docs): init cmd ### 📊 Changes **31 files changed** (+4091 additions, -1187 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/concepts/cli.mdx` (+57 -15) ➖ `packages/cli/src/commands/init.ts` (+0 -1158) ➕ `packages/cli/src/commands/init/generators/generate-auth-client.ts` (+68 -0) ➕ `packages/cli/src/commands/init/generators/generate-auth.ts` (+87 -0) ➕ `packages/cli/src/commands/init/generators/generate-plugins-array.ts` (+75 -0) ➕ `packages/cli/src/commands/init/generators/generate-social-providers.ts` (+30 -0) ➕ `packages/cli/src/commands/init/generators/import-statements.ts` (+24 -0) ➕ `packages/cli/src/commands/init/index.ts` (+216 -0) ➕ `packages/cli/src/commands/init/step-utils.ts` (+601 -0) ➕ `packages/cli/src/commands/init/steps/1-cli-version.ts` (+89 -0) ➕ `packages/cli/src/commands/init/steps/10-generate-auth-files.ts` (+96 -0) ➕ `packages/cli/src/commands/init/steps/11-generate-auth-api-route.ts` (+215 -0) ➕ `packages/cli/src/commands/init/steps/12-check-env.ts` (+29 -0) ➕ `packages/cli/src/commands/init/steps/13-check-tsconfig.ts` (+101 -0) ➕ `packages/cli/src/commands/init/steps/2-get-framework.ts` (+298 -0) ➕ `packages/cli/src/commands/init/steps/3-better-auth-installation.ts` (+106 -0) ➕ `packages/cli/src/commands/init/steps/4-check-auth-files.ts` (+211 -0) ➕ `packages/cli/src/commands/init/steps/5-app-name.ts` (+122 -0) ➕ `packages/cli/src/commands/init/steps/6-database-adapter.ts` (+96 -0) ➕ `packages/cli/src/commands/init/steps/7-plugins.ts` (+114 -0) _...and 11 more files_ </details> ### 📄 Description Minor changes. (Just joking 🤣) Recoded the entire init command because the old version was just a pure mess. There are a lot more "checks" in place and a much more solid foundation around each step of the init command. Also, I've added these on the init command since the previous: - added social providers option - sqlite db adapter now prompts to also install the @types package as well (and saved in dev-deps) - we now generate the API route file for each supported framework - and probably other things I added that just forgot The PR is much larger than the previous init code because: 1. It's now code-split 2. There is actual foundational code And 3, most importantly, it now is agnostic (only frontend/fullstack), whereas the previous only supported Nextjs Note: This PR does not include the "story mode" idea. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 11:25:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#3974