Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sweet-moose-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"sv": patch
---

fix: install `@better-auth/cli` as a dev dependency
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Please keep your pull requests focused to feature or issue. Focused smaller chan
This is a monorepo, meaning the repo holds multiple packages. It requires the use of [pnpm](https://pnpm.io/). You can [install pnpm](https://pnpm.io/installation) with:

```sh
npm i -g pnpm
npm i -g corepack@latest
Copy link

@WarningImHack3r WarningImHack3r Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a line or two to explain why specifically use corepack over the user's install, if it even is mandatory to use the corepack version?
Your sources explain why corepack is still a viable install method, but don't mention any specific advantage over any other installation method. Maybe removing this block altogether and let the user install it however they want is simpler to manage?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corepack automatically installs and activates the required version when commands are executed. Developers no longer need to manually manage versions.
https://corepack.org/

It is not typical in the repo to add that kind of context. By default, users expect us to provide best in class and best in practice information. If it is not, we simply update it, as I am here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but pnpm does this by default since v10 (Jan 2025), no matter the installation method, hence my comment

But it's fair to enforce corepack, but maybe adding an explanation line would be nice to explain that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hear about corepack for a long time... and finally took the time to check (thx to this comment).

Yes, I find a bit strange to write "You need to install pnpm, do corepack".

It's funny that we don't speak about node and nvm or devbox before that.
So, not sure about this one.

corepack enable pnpm
```

_(Optional)_ For running certain packages and tests locally you will need to install [docker](https://docs.docker.com/get-started/get-docker).
Expand All @@ -29,7 +30,7 @@ Linux users, you will have to ensure 'sudo' is not required. See [docker post in
```sh
git clone https://github.com/sveltejs/cli.git
cd cli
pnpm install
pnpm i
```

## Build and run
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/10-introduction/10-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The command line interface (CLI), `sv`, is a toolkit for creating and maintainin

## Usage

The easiest way to run `sv` is with [`npx`](https://docs.npmjs.com/cli/v8/commands/npx) (or the equivalent command if you're using a different package manager — for example, `pnpx` if you're using [pnpm](https://pnpm.io/)):
The easiest way to run `sv` is with [`npx`](https://docs.npmjs.com/cli/v8/commands/npx) (or the equivalent command if you're using a different package manager — for example, `pnpm dlx` if you're using [pnpm](https://pnpm.io/)):

```sh
npx sv <command> <args>
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/10-introduction/20-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Frequently asked questions
Running `sv` looks slightly different for each package manager. Here is a list of the most common commands:

- **npm** : `npx sv create`
- **pnpm** : `pnpx sv create` or `pnpm dlx sv create`
- **pnpm** : `pnpm dlx sv create`
- **Bun** : `bunx sv create`
- **Deno** : `deno run npm:sv create`
- **Yarn** : `yarn dlx sv create`
Expand Down
3 changes: 2 additions & 1 deletion packages/sv/src/addons/better-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default defineAddon({
let drizzleDialect: Dialect;

sv.devDependency('better-auth', '^1.4.18');
sv.devDependency('@better-auth/cli', '^1.4.18');

sv.file(`drizzle.config.${language}`, (content) => {
const { ast, generateCode } = parse.script(content);
Expand Down Expand Up @@ -134,7 +135,7 @@ export default defineAddon({
json.packageScriptsUpsert(
data,
'auth:schema',
`npx @better-auth/cli generate --config ${authConfigPath} --output ${authSchemaPath} --yes`
`better-auth generate --config ${authConfigPath} --output ${authSchemaPath} --yes`
);
return generateCode();
});
Expand Down
5 changes: 5 additions & 0 deletions packages/sv/src/cli/tests/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}
];

it.for(testCases)(

Check failure on line 46 in packages/sv/src/cli/tests/cli.ts

View workflow job for this annotation

GitHub Actions / test (windows-latest)

[cli] tests/cli.ts > cli > should create a new project with name '@my-org/sv'

Error: Test timed out in 51000ms. If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout". ❯ tests/cli.ts:46:18
'should create a new project with name $projectName',
{ timeout: 51_000 },
async (testCase) => {
Expand Down Expand Up @@ -108,6 +108,11 @@
generated = generated.replaceAll('\r\n', '\n'); // make it work on Windows too
if (!generated.endsWith('\n')) generated += '\n'; // ensure trailing newline

// Normalize sv version in README.md to avoid snapshot drift
if (relativeFile === 'README.md') {
generated = generated.replace(/sv@\d+\.\d+\.\d+/g, 'sv@0.0.0');
}

await expect(generated).toMatchFileSnapshot(
path.resolve(snapPath, relativeFile),
`file "${relativeFile}" does not match snapshot`
Expand Down
2 changes: 1 addition & 1 deletion packages/sv/src/cli/tests/snapshots/create-only/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To recreate this project with the same configuration:

```sh
# recreate this project
npx sv create --template minimal --types ts --no-install packages/sv/.test-output/cli/create-only
npx sv@0.0.0 create --template minimal --types ts --no-install packages/sv/.test-output/cli/create-only
```

## Developing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To recreate this project with the same configuration:

```sh
# recreate this project
npx sv create --template minimal --types ts --add prettier eslint vitest="usages:unit,component" playwright tailwindcss="plugins:typography,forms" sveltekit-adapter="adapter:node" devtools-json drizzle="database:sqlite+sqlite:libsql" better-auth="demo:password,github" mdsvex paraglide="languageTags:en,es+demo:yes" mcp="ide:claude-code,cursor,gemini,opencode,vscode,other+setup:local" --no-install packages/sv/.test-output/cli/create-with-all-addons
npx sv@0.0.0 create --template minimal --types ts --add prettier eslint vitest="usages:unit,component" playwright tailwindcss="plugins:typography,forms" sveltekit-adapter="adapter:node" devtools-json drizzle="database:sqlite+sqlite:libsql" better-auth="demo:password,github" mdsvex paraglide="languageTags:en,es+demo:yes" mcp="ide:claude-code,cursor,gemini,opencode,vscode,other+setup:local" --no-install packages/sv/.test-output/cli/create-with-all-addons
```

## Developing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
"db:studio": "drizzle-kit studio",
"auth:schema": "npx @better-auth/cli generate --config src/lib/server/auth.ts --output src/lib/server/db/auth.schema.ts --yes"
"auth:schema": "better-auth generate --config src/lib/server/auth.ts --output src/lib/server/db/auth.schema.ts --yes"
},
"devDependencies": {
"@better-auth/cli": "^1.4.18",
"@eslint/compat": "^2.0.2",
"@eslint/js": "^9.39.2",
"@inlang/paraglide-js": "^2.10.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/sv/src/core/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export function buildAndLogArgs(
args: string[],
lastArgs: string[] = []
): string {
const allArgs = ['sv', command, ...args];
const allArgs = [`sv@${pkg.version}`, command, ...args];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hummm, not sure why we do this in this PR?
There is a specific need for it?


// Handle install option
if (agent === null || agent === undefined) allArgs.push('--no-install');
Expand Down
Loading