Skip to content

Commit 849e3b5

Browse files
eluce2claude
andauthored
docs: use cliVersion constant instead of hardcoded @beta (#100)
- Add packageName prop to CliCommand for auto-versioning - Create PackageInstall component for install commands - Convert all hardcoded @beta references to use constant Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 301df30 commit 849e3b5

File tree

7 files changed

+65
-32
lines changed

7 files changed

+65
-32
lines changed

apps/docs/content/docs/better-auth/installation.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ title: Installation & Usage
55
import { Callout } from "fumadocs-ui/components/callout";
66

77
import { CliCommand } from "@/components/CliCommand";
8+
import { PackageInstall } from "@/components/PackageInstall";
89

910

1011
<Callout type="warning">
@@ -31,9 +32,7 @@ Follow the [Better-Auth installation guide](https://better-auth.com/docs/install
3132
### Database Setup
3233

3334
Ensure you have the @proofkit/better-auth package installed in your app.
34-
```package-install
35-
@proofkit/better-auth@beta
36-
```
35+
<PackageInstall packages="@proofkit/better-auth" />
3736

3837
Configure your database connection in your `auth.ts` file. Be sure to set these value secrets in your environment variables. The credentials you use here need `fmodata` permissions enabled, and read/write access to the better-auth tables.
3938
```ts title="auth.ts"
@@ -62,10 +61,10 @@ export const auth = betterAuth({
6261
# Step 2: Create/Update Database Tables
6362

6463
Run the following command to create the necessary tables and fields in your FileMaker file. It will show you a confirmation before any changes are applied, so you can review them.
65-
<CliCommand command="migrate" exec execPackage="@proofkit/better-auth@beta" />
64+
<CliCommand command="migrate" exec packageName="@proofkit/better-auth" />
6665

6766
[Full Access] credentials are required for the schema changes to be applied automatically, but you may want to use a more restricted account for the rest of better-auth usage. If your credentials that you entered earlier in the `auth.ts` file do not have the [Full Access] permissions, you can override them in the CLI.
68-
<CliCommand command={`migrate --username "full_access_username" --password "full_access_password"`} exec execPackage="@proofkit/better-auth@beta" />
67+
<CliCommand command={`migrate --username "full_access_username" --password "full_access_password"`} exec packageName="@proofkit/better-auth" />
6968

7069
These changes affect database schema only. No layouts or relationships are created or modified during this process.
7170

apps/docs/content/docs/better-auth/troubleshooting.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: Troubleshooting
33
---
44

5+
import { CliCommand } from "@/components/CliCommand";
6+
57
## Error when generating schema
68
```bash
79
ERROR [Better Auth]: filemaker is not supported. If it is a custom adapter, please request the maintainer to implement createSchema
810
```
911

1012
This means you used the better-auth CLI directly instead of the @proofkit/better-auth version. Run this instead:
1113

12-
```bash
13-
pnpm dlx @proofkit/better-auth@beta migrate
14-
```
14+
<CliCommand command="migrate" exec packageName="@proofkit/better-auth" />

apps/docs/content/docs/fmodata/quick-start.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
import { Callout } from "fumadocs-ui/components/callout";
1313
import { Card } from "fumadocs-ui/components/card";
1414
import { CliCommand } from "@/components/CliCommand";
15+
import { PackageInstall } from "@/components/PackageInstall";
1516
import { Badge } from "@/components/ui/badge";
1617

1718
Here's a minimal example to get you started with `@proofkit/fmodata`:
@@ -20,9 +21,7 @@ Here's a minimal example to get you started with `@proofkit/fmodata`:
2021
<Step>
2122
### Install the package
2223

23-
```package-install
24-
@proofkit/fmodata@beta
25-
```
24+
<PackageInstall packages="@proofkit/fmodata" />
2625

2726
</Step>
2827

@@ -67,7 +66,7 @@ Here's a minimal example to get you started with `@proofkit/fmodata`:
6766
</TabsList>
6867
<TabsContent value="automatic">
6968
Run this command in your project to launch a browser-based UI for configuring your schema definitions. You will need environment variables set for your FileMaker server and database.
70-
<CliCommand command="ui" exec execPackage="@proofkit/typegen@beta" />
69+
<CliCommand command="ui" exec packageName="@proofkit/typegen" />
7170

7271
Learn more about the [@proofkit/typegen](/docs/typegen) tool.
7372

apps/docs/content/docs/typegen/index.mdx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Tabs, TabItem } from "fumadocs-ui/components/tabs";
77
import { Callout } from "fumadocs-ui/components/callout";
88
import { File, Folder, Files } from "fumadocs-ui/components/files";
99
import { IconFileTypeTs } from "@tabler/icons-react";
10+
import { CliCommand } from "@/components/CliCommand";
1011

1112
A utility for generating runtime validators and TypeScript files from your
1213
own FileMaker layouts.
@@ -15,13 +16,7 @@ own FileMaker layouts.
1516

1617
Run this command to initialize `@proofkit/typegen` in your project:
1718

18-
```bash tab="pnpm"
19-
pnpm dlx @proofkit/typegen@beta
20-
```
21-
22-
```bash tab="npm"
23-
npx @proofkit/typegen@beta
24-
```
19+
<CliCommand command="" exec packageName="@proofkit/typegen" />
2520

2621
## Configuring Typegen
2722

@@ -51,14 +46,7 @@ If you need to use different env variable names (i.e. for multiple FileMaker con
5146
## Running Typegen
5247
Once you have a config file setup, you can run the command to generate the types:
5348

54-
55-
```bash tab="pnpm"
56-
pnpm dlx @proofkit/typegen@beta
57-
```
58-
59-
```bash tab="npm"
60-
npx @proofkit/typegen@beta
61-
```
49+
<CliCommand command="" exec packageName="@proofkit/typegen" />
6250

6351
<Callout type="info">
6452
We suggest adding a script to your `package.json` to run this command more easily

apps/docs/content/docs/typegen/ui.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: Typegen UI
33
---
44

5+
import { CliCommand } from "@/components/CliCommand";
6+
57
The typegen tool has a built-in web interface for editing your JSON config file and running the typegen scripts. It's helpful for making sure your environment variables are setup correctly and can help autocomplete layout/field/table names into the config file.
68

79
To launch the UI, run the following command and a browser window will open at `http://localhost:3141`:
810

9-
```bash
10-
npx @proofkit/typegen@beta ui
11-
```
11+
<CliCommand command="ui" exec packageName="@proofkit/typegen" />
1212

1313

1414
## CLI options

apps/docs/src/components/CliCommand.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,22 @@ const MANAGERS = [
3333
export function CliCommand({
3434
command,
3535
exec,
36-
execPackage = `@proofkit/cli@${cliVersion}`,
36+
execPackage,
37+
packageName = "@proofkit/cli",
3738
}: {
3839
command: string;
3940
exec?: boolean;
41+
/** @deprecated Use packageName instead */
4042
execPackage?: string;
43+
packageName?: string;
4144
}) {
45+
const pkg = execPackage ?? `${packageName}@${cliVersion}`;
4246
return (
4347
<Tabs groupId="package-manager" id="package-manager" items={MANAGERS.map((m) => m.label)} persist>
4448
{MANAGERS.map((manager) => (
4549
<Tab key={manager.key} value={manager.label}>
4650
<DynamicCodeBlock
47-
code={`${exec ? `${manager.execPrefix} ${execPackage}` : manager.prefix} ${command}`}
51+
code={`${exec ? `${manager.execPrefix} ${pkg}` : manager.prefix} ${command}`}
4852
lang="bash"
4953
/>
5054
</Tab>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"use client";
2+
import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock";
3+
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
4+
import { cliVersion } from "@/lib/constants";
5+
6+
const MANAGERS = [
7+
{ key: "npm", label: "npm", prefix: "npm install" },
8+
{ key: "pnpm", label: "pnpm", prefix: "pnpm add" },
9+
{ key: "yarn", label: "yarn", prefix: "yarn add" },
10+
{ key: "bun", label: "bun", prefix: "bun add" },
11+
];
12+
13+
const WHITESPACE_RE = /\s+/;
14+
15+
/**
16+
* Renders a tabbed package install command.
17+
* Automatically appends @{cliVersion} to @proofkit/* packages unless version is already specified.
18+
*/
19+
export function PackageInstall({ packages }: { packages: string }) {
20+
const pkgs = packages
21+
.trim()
22+
.split(WHITESPACE_RE)
23+
.map((pkg) => {
24+
// If it's a @proofkit package without a version, append the cliVersion
25+
if (pkg.startsWith("@proofkit/") && !pkg.includes("@", 1)) {
26+
return `${pkg}@${cliVersion}`;
27+
}
28+
return pkg;
29+
})
30+
.join(" ");
31+
32+
return (
33+
<Tabs groupId="package-manager" id="package-manager" items={MANAGERS.map((m) => m.label)} persist>
34+
{MANAGERS.map((manager) => (
35+
<Tab key={manager.key} value={manager.label}>
36+
<DynamicCodeBlock code={`${manager.prefix} ${pkgs}`} lang="bash" />
37+
</Tab>
38+
))}
39+
</Tabs>
40+
);
41+
}
42+
43+
export default PackageInstall;

0 commit comments

Comments
 (0)