Skip to content
Merged
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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,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`
Comment thread
jycouet marked this conversation as resolved.
- **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 @@ -108,6 +108,11 @@ describe('cli', () => {
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
Copy Markdown
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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Was just tapping away and ended up grouping a few things together. I think its necessary for reproducibility.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, let's keep it in 👍


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