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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ Render the generated `<Toaster />` in your root layout and start from a clean co
Run the released generator from the application root:

```bash
pnpm dlx @btst/codegen@4.5.1 init \
pnpm dlx @btst/codegen@4.6.0 init \
--framework nextjs \
--adapter memory \
--plugins blog
```

The generator shows detected-file and conflict prompts before it writes. It installs `@btst/stack@4.5.1`, `next-themes@0.4.6`, registers Blog on the backend and client, mounts the API and page routes, adds the plugin CSS, and wires the shared provider.
The generator shows detected-file and conflict prompts before it writes. It installs `@btst/stack@4.6.0`, `next-themes@0.4.6`, registers Blog on the backend and client, mounts the API and page routes, adds the plugin CSS, and wires the shared provider.

Set the trusted local origins in `.env.local`:

Expand Down
6 changes: 3 additions & 3 deletions docs/content/docs/breaking-changes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Upgrade the packages together:

| Package | Version |
| --- | --- |
| `@btst/stack`, `@btst/codegen` | `4.5.1` |
| `@btst/stack`, `@btst/codegen` | `4.6.0` |
| `@btst/db`, selected `@btst/adapter-*`, `@btst/cli` | `3.0.0` |
| Optional `@btst/better-auth-ui` | `3.0.1` |
| `better-auth`, `@better-auth/core` | `1.7.6` |
Expand All @@ -35,10 +35,10 @@ Upgrade the packages together:
For example, a Drizzle application can install the core cohort with:

```bash
pnpm add --save-exact @btst/stack@4.5.1 @btst/adapter-drizzle@3.0.0 \
pnpm add --save-exact @btst/stack@4.6.0 @btst/adapter-drizzle@3.0.0 \
better-auth@1.7.6 @better-auth/core@1.7.6 \
@better-auth/utils@0.4.2 @better-fetch/fetch@1.3.2 better-call@1.4.0
pnpm add --save-dev --save-exact @btst/codegen@4.5.1
pnpm add --save-dev --save-exact @btst/codegen@4.6.0
```

Use Drizzle ORM `^0.45.2` or a compatible 1.0 release candidate supported by
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ below lists them explicitly.
Run this command from the existing application root:

```bash
npx @btst/codegen@4.5.1 init \
npx @btst/codegen@4.6.0 init \
--framework nextjs \
--adapter memory \
--plugins blog
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/plugins/better-auth-ui.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Better Auth UI 1.7.26. Install it with the BTST v4 cohort:

| Package | Version |
| --- | --- |
| `@btst/stack`, `@btst/codegen` | `4.5.1` |
| `@btst/stack`, `@btst/codegen` | `4.6.0` |
| `@btst/better-auth-ui` | `3.0.1` |
| `better-auth`, `@better-auth/core` | `1.7.6` |
| `@better-auth/api-key`, `@better-auth/passkey` | `1.7.6` |
Expand Down
1 change: 1 addition & 0 deletions docs/content/docs/plugins/blog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ overrides={{

| Override | Type | Description |
|----------|------|-------------|
| `postIntroductionSlot` | `(post: SerializedPost) => ReactNode` | Render content after the first top-level body paragraph; omitted when there is no paragraph. Reference links and footnotes remain part of one Markdown document. |
| `postBottomSlot` | `(post: SerializedPost) => ReactNode` | Render additional content below each blog post — use to embed a `CommentThread` |

```tsx
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@btst/codegen",
"version": "4.5.1",
"version": "4.6.0",
"description": "BTST project scaffolding and CLI passthrough commands.",
"repository": {
"type": "git",
Expand Down
9 changes: 8 additions & 1 deletion packages/cli/src/commands/init.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { access } from "node:fs/promises";
import { access, readFile } from "node:fs/promises";
import { resolve } from "node:path";
import {
cancel,
Expand Down Expand Up @@ -249,12 +249,19 @@ export function createInitCommand() {

const conflictPolicy = await pickConflictPolicy(rawOptions.yes);
const finalCssFile = cssFile as string;
const packageJson = JSON.parse(
await readFile(resolve(cwd, "package.json"), "utf8"),
);
const plan = await buildScaffoldPlan({
framework,
adapter,
plugins: selectedPlugins,
alias,
cssFile: finalCssFile,
hasTailwindTurbopack: Boolean(
packageJson.dependencies?.["@tailwindcss/turbopack"] ||
packageJson.devDependencies?.["@tailwindcss/turbopack"],
),
});
const removedLegacyFiles =
framework === "nextjs"
Expand Down
10 changes: 10 additions & 0 deletions packages/cli/src/templates/nextjs/next-config.ts.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import type { NextConfig } from "next"

const nextConfig: NextConfig = {
{{#if hasTailwindTurbopack}}
turbopack: {
rules: {
"*.css": {
loaders: ["@tailwindcss/turbopack"],
as: "*.css",
},
},
},
{{/if}}
{{#if hasAiChat}}
env: {
// Expose whether an OpenAI key is set so the pages layout can show a banner.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/utils/__tests__/package-installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("installInitDependencies", () => {
});

const installArguments = execa.mock.calls[0]?.[1] as string[];
expect(installArguments).toContain("@btst/stack@4.5.1");
expect(installArguments).toContain("@btst/stack@4.6.0");
expect(installArguments).toContain("next-themes@0.4.6");
expect(installArguments).toContain("@btst/adapter-drizzle@3.0.0");
expect(installArguments).toContain("drizzle-orm@0.45.2");
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/utils/__tests__/scaffold-plan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,23 @@ describe("scaffold plan", () => {
const config = plan.files.find((f) => f.path === "next.config.ts");
expect(config?.content).toContain("remotePatterns");
expect(config?.content).not.toContain("NEXT_PUBLIC_HAS_OPENAI_KEY");
expect(config?.content).not.toContain("@tailwindcss/turbopack");
});

it("retains native Tailwind processing when generating the Next.js config", async () => {
const plan = await buildScaffoldPlan({
framework: "nextjs",
adapter: "memory",
plugins: ["ai-chat", "media"],
alias: "@/",
cssFile: "app/globals.css",
hasTailwindTurbopack: true,
});
const config = plan.files.find((file) => file.path === "next.config.ts");
expect(config?.content).toContain('loaders: ["@tailwindcss/turbopack"]');
expect(config?.content).toContain('as: "*.css"');
expect(config?.content).toContain("NEXT_PUBLIC_HAS_OPENAI_KEY");
expect(config?.content).toContain("remotePatterns");
});

it("emits next.config.ts with both env and images when ai-chat + media selected", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/utils/package-installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function installInitDependencies(input: {
});

const packages = [
"@btst/stack@4.5.1",
"@btst/stack@4.6.0",
"@btst/yar@1.3.2",
"@tanstack/react-query@5.102.0",
"@tanstack/query-core@5.102.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/utils/scaffold-plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface BuildScaffoldPlanInput {
plugins: PluginKey[];
alias: AliasPrefix;
cssFile: string;
hasTailwindTurbopack?: boolean;
}

function getFrameworkPaths(framework: Framework, cssFile: string) {
Expand Down Expand Up @@ -376,6 +377,7 @@ export async function buildScaffoldPlan(

const sharedContext = {
alias: input.alias,
hasTailwindTurbopack: input.hasTailwindTurbopack,
browserApiURLExpression: getBrowserApiURLExpression(input.framework),
browserSiteURLExpression: getBrowserSiteURLExpression(input.framework),
migrationBrowserBaseURLExpression: getMigrationBrowserBaseURLExpression(
Expand Down
2 changes: 1 addition & 1 deletion packages/stack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@btst/stack",
"version": "4.5.1",
"version": "4.6.0",
"description": "A composable, plugin-based library for building full-stack applications.",
"repository": {
"type": "git",
Expand Down
Loading
Loading