Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Changed installer: optional Seller Panel, --no-dashboard, consistent app setup (#14814)

Damian Legawiec992b25e00dc6
diff --git a/.changeset/installer-optional-seller-panel.md b/.changeset/installer-optional-seller-panel.md
new file mode 100644
index 0000000000..195ea468fd
--- /dev/null
+++ b/.changeset/installer-optional-seller-panel.md
@@ -0,0 +1,6 @@
+---
+"create-spree-app": minor
+"@spree/cli": patch
+---
+
+Made the marketplace seller panel optional: `create-spree-app` now asks whether to install it (yes by default) and accepts `--no-seller-dashboard`. Added `--no-dashboard` for projects that are happy with the built-in admin dashboard; `--react-dashboard` is deprecated and does nothing. Apps are now set up in a consistent order — dashboard, seller panel, then storefront — and the storefront step looks the same as the others. `spree init` also installs the seller panel's dependencies, and both tools now point projects without their own dashboard at the built-in one instead of saying no admin is installed.
diff --git a/docs/developer/create-spree-app/quickstart.mdx b/docs/developer/create-spree-app/quickstart.mdx
index 8a848fa8b6..77411f809d 100644
--- a/docs/developer/create-spree-app/quickstart.mdx
+++ b/docs/developer/create-spree-app/quickstart.mdx
@@ -18,7 +18,7 @@ The CLI walks you through an interactive setup:
Once complete, your store is running at [http://localhost:3000](http://localhost:3000) — setup pulls the latest Spree image, seeds the database, and configures API keys, then prints a summary with your admin credentials and keys. If you skipped starting services, the first `pnpm dev` completes setup automatically.
-The **dashboard** and the marketplace **seller panel** are included in every project — there is no flag to add them.
+The **admin dashboard** is included in every project (skip it with `--no-dashboard` and the API still serves the built-in one at `/dashboard`). The installer asks whether to add the **seller panel** — a dedicated panel where marketplace vendors manage their products, orders and settings. Answer yes only if you run a marketplace; you can add it later with `spree add seller-dashboard`.
## Prerequisites
@@ -30,14 +30,14 @@ The **dashboard** and the marketplace **seller panel** are included in every pro
All prompts can be skipped with flags for non-interactive (CI/CD) usage:
```bash
-npx create-spree-app@latest my-store --no-storefront --no-sample-data --no-start
+npx create-spree-app@latest my-store --no-seller-dashboard --no-storefront --no-start
```
| Flag | Description |
|------|-------------|
-| `--react-dashboard` | No-op — the dashboard is always included. Kept so existing scripts keep working |
+| `--no-dashboard` | Skip the admin dashboard app — the API still serves the built-in one at `/dashboard` |
+| `--no-seller-dashboard` | Skip the marketplace seller panel |
| `--no-storefront` | Skip Next.js storefront setup |
-| `--no-sample-data` | Skip loading sample products and categories |
| `--no-start` | Don't start Docker services after scaffolding |
| `--port <number>` | Port for the Spree backend (default: `3000`) |
| `--use-npm` | Use npm as package manager |
@@ -62,9 +62,9 @@ my-store/
│ ├── Dockerfile # Also builds the production image (API + dashboard)
│ └── Gemfile
├── apps/
-│ ├── dashboard/ # Admin dashboard (React)
+│ ├── dashboard/ # Admin dashboard (unless --no-dashboard)
│ │ └── .env.local # Dev proxy target — no credentials
-│ ├── seller-dashboard/ # Seller panel, for marketplaces (React)
+│ ├── seller-dashboard/ # Seller panel, for marketplaces (unless --no-seller-dashboard)
│ └── storefront/ # Next.js storefront (unless --no-storefront)
│ └── .env.local # API URL + publishable key
├── .env # SECRET_KEY_BASE, encryption keys, SPREE_PORT, SPREE_VERSION_TAG, SPREE_SAMPLE_DATA
@@ -113,11 +113,12 @@ The project includes [@spree/cli](/developer/cli/quickstart) for managing your S
| Command | Description |
|---------|-------------|
-| `spree dev` | Run the app in the foreground — streams logs, Ctrl+C stops it. First run completes setup automatically; co-runs the React Dashboard dev server when `apps/dashboard` exists |
+| `spree dev` | Run the app in the foreground — streams logs, Ctrl+C stops it. First run completes setup automatically; co-runs the Admin Dashboard dev server when `apps/dashboard` exists |
| `spree stop` | Stop backend services |
| `spree update` | Pull latest Spree image and restart (runs migrations automatically) |
| `spree eject` | Switch from prebuilt image to building from `server/` |
-| `spree add dashboard` | Add the React Dashboard to an existing project |
+| `spree add dashboard` | Add the Admin Dashboard to an existing project, to customize it |
+| `spree add seller-dashboard` | Add the marketplace seller panel to an existing project |
| `spree build --production` | Build the production image — the Spree API plus your dashboard, in one |
| `spree logs` | View backend logs |
| `spree logs worker` | View background jobs logs |
@@ -164,7 +165,7 @@ SPREE_VERSION_TAG=5.4
## Deployment
-The project deploys as **one image**: `server/Dockerfile` builds the Spree API together with your React Dashboard (when `apps/dashboard` exists), served same-origin at `/dashboard` — no CORS, no cookie configuration, no second service.
+The project deploys as **one image**: `server/Dockerfile` builds the Spree API together with your Admin Dashboard (when `apps/dashboard` exists), served same-origin at `/dashboard` — no CORS, no cookie configuration, no second service.
- **Render** — the `render.yaml` at the project root is a ready Blueprint: one Docker service built straight from your repo, migrations run on boot.
- **Anywhere else** — `spree build --production` builds the same image locally; push it to a registry and run it on any Docker host.
diff --git a/packages/cli/README.md b/packages/cli/README.md
index 9ca314b47c..a21c5fa426 100644
--- a/packages/cli/README.md
+++ b/packages/cli/README.md
@@ -15,11 +15,12 @@ Run from your Spree project directory:
| Command | Description |
|---------|-------------|
-| `spree dev` | Run the app in the foreground — streams logs, Ctrl+C stops it. First run completes setup automatically; co-runs the React Dashboard dev server when `apps/dashboard` exists |
+| `spree dev` | Run the app in the foreground — streams logs, Ctrl+C stops it. First run completes setup automatically; co-runs the Admin Dashboard dev server when `apps/dashboard` exists |
| `spree stop` | Stop backend services |
| `spree update` | Pull the latest Spree image and restart (runs migrations automatically) |
| `spree eject` | Switch from the prebuilt image to building from `backend/` |
-| `spree add dashboard` | Add the React Dashboard (Developer Preview) to an existing project |
+| `spree add dashboard` | Add the Admin Dashboard to an existing project, to customize it |
+| `spree add seller-dashboard` | Add the marketplace seller panel to an existing project |
| `spree build --production` | Build the production image — the Spree API plus your dashboard, in one |
| `spree console` / `spree shell` / `spree logs` | Rails console, container shell, log tailing |
| `spree migrate` / `spree seed` / `spree sample-data` | Database tasks |
diff --git a/packages/cli/src/commands/dev.ts b/packages/cli/src/commands/dev.ts
index c3306c6eb2..7b0a5cb3e2 100644
--- a/packages/cli/src/commands/dev.ts
+++ b/packages/cli/src/commands/dev.ts
@@ -24,7 +24,7 @@ export function registerDevCommand(program: Command): void {
program
.command('dev')
.description(
- 'Run the app in the foreground — the API, plus the React Dashboard dev server when apps/dashboard exists; Ctrl+C stops them',
+ 'Run the app in the foreground — the API, plus the Admin Dashboard dev server when apps/dashboard exists; Ctrl+C stops them',
)
.action(async () => {
const ctx = detectProject()
diff --git a/packages/cli/src/commands/init.ts b/packages/cli/src/commands/init.ts
index 9ba095d5db..2510a87ed6 100644
--- a/packages/cli/src/commands/init.ts
+++ b/packages/cli/src/commands/init.ts
@@ -132,8 +132,9 @@ export async function runFirstRunSetup(flags: {
const secretKey = await mintCliCredentials(ctx.projectDir, ctx.port)
s.stop('API keys configured.')
- await installAppDeps(ctx.projectDir, 'storefront')
- await installAppDeps(ctx.projectDir, 'dashboard')
+ for (const app of ['dashboard', 'seller-dashboard', 'storefront']) {
+ await installAppDeps(ctx.projectDir, app)
+ }
ensureDashboardDevEnv(ctx.projectDir, ctx.port)
// Sample-data imports need an admin as their owner; without credentials
@@ -155,7 +156,7 @@ export async function runFirstRunSetup(flags: {
writeProjectSetupMarker(ctx.projectDir)
- // With the React Dashboard chosen, its dev server IS the admin — started
+ // With apps/dashboard present, its dev server IS the admin — started
// below alongside the stack, so what the user customizes is what they use.
// One admin block: the dev server is the only admin URL worth naming. (The
// production image serves a built dashboard at /dashboard — a deployment
@@ -196,8 +197,13 @@ export async function runFirstRunSetup(flags: {
]
: [
pc.bold('Admin Dashboard'),
- ` ${pc.dim(`Not installed — add it with ${pc.bold('spree add dashboard')}`)}`,
+ ` ${pc.cyan(`http://localhost:${ctx.port}/dashboard`)}`,
...credentialLines,
+ ` ${pc.dim(
+ hasDashboardApp(ctx.projectDir)
+ ? 'Built-in dashboard — apps/dashboard/ runs once its dependencies are installed'
+ : `Built-in dashboard — run ${pc.bold('spree add dashboard')} to customize it`,
+ )}`,
]
// The wholesale demo needs both the storefront env opt-in and the seeded
@@ -249,16 +255,14 @@ export async function runFirstRunSetup(flags: {
if (flags.open) {
// With the dashboard, wait for Vite to report ready (it auto-bumps the
// port when 5173 is taken) so the browser opens the real URL. Without
- // one there's no admin to open in development, so fall back to the
- // store itself.
- const dashboardUrl = dashboard ? await dashboard.url : null
+ // one, open the built-in dashboard the summary names.
+ const dashboardUrl = dashboard ? await dashboard.url : setupBase
// No admin was seeded, so the dashboard would only show a login form
// nobody can pass — open first-run setup instead and land the operator
// on the account form directly.
- const target =
- setupToken && dashboardUrl
- ? `${dashboardUrl.replace(/\/$/, '')}/setup?token=${setupToken}`
- : (dashboardUrl ?? `http://localhost:${ctx.port}`)
+ const target = setupToken
+ ? `${dashboardUrl.replace(/\/$/, '')}/setup?token=${setupToken}`
+ : dashboardUrl
await openBrowser(target)
}
@@ -275,17 +279,17 @@ export async function runFirstRunSetup(flags: {
// create-spree-app's per-app install steps, so first-run setup leaves every
// app runnable with `pnpm dev`. Best-effort: a registry hiccup shouldn't
// fail backend setup.
-async function installAppDeps(projectDir: string, app: 'storefront' | 'dashboard'): Promise<void> {
+async function installAppDeps(projectDir: string, app: string): Promise<void> {
const appDir = path.join(projectDir, 'apps', app)
if (!fs.existsSync(path.join(appDir, 'package.json'))) return
if (fs.existsSync(path.join(appDir, 'node_modules'))) return
const pm = detectPackageManager(projectDir, appDir)
const s = p.spinner()
- s.start(`Installing ${app} dependencies with ${pm}...`)
+ s.start(`Installing apps/${app}/ dependencies with ${pm}...`)
try {
await execa(pm, ['install'], { cwd: appDir })
- s.stop(`${app === 'dashboard' ? 'Dashboard' : 'Storefront'} dependencies installed.`)
+ s.stop(`apps/${app}/ dependencies installed.`)
} catch (err) {
s.stop(pc.yellow(`${pm} install failed — run it manually in apps/${app}/.`))
p.log.warn(err instanceof Error ? err.message : String(err))
diff --git a/packages/cli/src/commands/open.ts b/packages/cli/src/commands/open.ts
index 71a5aae817..c3d1a029e6 100644
--- a/packages/cli/src/commands/open.ts
+++ b/packages/cli/src/commands/open.ts
@@ -11,12 +11,11 @@ export function registerOpenCommand(program: Command): void {
.description('Open the admin dashboard in the browser')
.action(async () => {
const ctx = detectProject()
- // The React dashboard runs on its own Vite server (`spree dev`). Without
- // one, open the store: /dashboard serves a production build and isn't a
- // development target.
+ // A project's own dashboard runs on its Vite server (`spree dev`);
+ // without one, the API serves the built-in dashboard.
const url = hasDashboardApp(ctx.projectDir)
? `http://localhost:${DASHBOARD_PORT}`
- : `http://localhost:${ctx.port}`
+ : `http://localhost:${ctx.port}/dashboard`
const os = platform()
const cmd = os === 'darwin' ? 'open' : os === 'win32' ? 'start' : 'xdg-open'
await execaCommand(`${cmd} ${url}`)
diff --git a/packages/cli/src/commands/upgrade.ts b/packages/cli/src/commands/upgrade.ts
index 8936ef8235..630febc929 100644
--- a/packages/cli/src/commands/upgrade.ts
+++ b/packages/cli/src/commands/upgrade.ts
@@ -96,7 +96,7 @@ async function runBundleUpdate(projectDir: string, flags: { yes?: boolean }): Pr
if (spreeGems.length === 0) {
throw new Error(
'No Spree gems detected in Gemfile.lock. ' +
- 'Confirm the project has `gem "spree"` (or `spree_core`/`spree_admin`) in its Gemfile.',
+ 'Confirm the project has `gem "spree"` (or `spree_core`) in its Gemfile.',
)
}
diff --git a/packages/create-spree-app/README.md b/packages/create-spree-app/README.md
index 08d95fd926..ac9831eedb 100644
--- a/packages/create-spree-app/README.md
+++ b/packages/create-spree-app/README.md
@@ -1,6 +1,6 @@
# create-spree-app
-Scaffold a new [Spree Commerce](https://spreecommerce.org) project with a single command — a full Rails backend (the Spree API) running via Docker, an optional Next.js storefront, the React Dashboard behind `--react-dashboard`, and the `spree` CLI for day-to-day work. Setup completes automatically: image pulled, database seeded, API keys configured.
+Scaffold a new [Spree Commerce](https://spreecommerce.org) project with a single command — a full Rails backend (the Spree API) running via Docker, an optional Next.js storefront, the Admin Dashboard and an optional marketplace seller panel, and the `spree` CLI for day-to-day work. Setup completes automatically: image pulled, database seeded, API keys configured.
## Quick Start
@@ -10,9 +10,9 @@ npx create-spree-app my-store
| Flag | Description |
|------|-------------|
-| `--react-dashboard` | Include the React Dashboard (Developer Preview — also available later via `spree add dashboard`) |
+| `--no-dashboard` | Skip the Admin Dashboard app — the API still serves the built-in one at `/dashboard` (add your own copy later via `spree add dashboard`) |
+| `--no-seller-dashboard` | Skip the marketplace seller panel (also available later via `spree add seller-dashboard`) |
| `--no-storefront` | Skip Next.js storefront setup |
-| `--no-sample-data` | Skip loading sample products |
| `--no-start` | Don't start Docker services (the first `dev` run completes setup instead) |
| `--port <number>` | Port for the Spree backend (default: `3000`) |
| `--use-npm` / `--use-yarn` / `--use-pnpm` | Package manager (auto-detected from how you run the command) |
diff --git a/packages/create-spree-app/src/constants.ts b/packages/create-spree-app/src/constants.ts
index bfc008e2b7..232a20097d 100644
--- a/packages/create-spree-app/src/constants.ts
+++ b/packages/create-spree-app/src/constants.ts
@@ -4,6 +4,7 @@ export const DASHBOARD_PORT = 5173
// Seller panel dev server; 5174 matches @spree/cli's own default.
export const SELLER_DASHBOARD_PORT = 5174
+export const DOCS_MCP_URL = 'https://spreecommerce.org/docs/mcp'
export const STOREFRONT_REPO = 'https://github.com/spree/storefront.git'
/**
diff --git a/packages/create-spree-app/src/dashboard.ts b/packages/create-spree-app/src/dashboard.ts
index 7180ab89f6..0330d7be3b 100644
--- a/packages/create-spree-app/src/dashboard.ts
+++ b/packages/create-spree-app/src/dashboard.ts
@@ -2,6 +2,8 @@ import { execa } from 'execa'
import type { PackageManager } from './types.js'
import { runCommand } from './utils.js'
+export type AdminApp = 'dashboard' | 'seller-dashboard'
+
/**
* Scaffold an admin SPA into `apps/<component>/` by delegating to the
* project-local CLI: `spree add <component>`. The generated project already
@@ -10,10 +12,14 @@ import { runCommand } from './utils.js'
* release — one template source, no copy in this package. The command reads
* the API port from the project's `.env` and writes the app's `.env.local`
* itself (API URL only — never credentials).
+ *
+ * The Dashboard is the admin and ships in every project. The Seller Panel is
+ * for marketplaces only; a project without `apps/seller-dashboard/` still gets
+ * the stock panel baked into its production image by the starter's Dockerfile.
*/
-async function scaffoldApp(
+export async function scaffoldApp(
projectDir: string,
- component: 'dashboard' | 'seller-dashboard',
+ component: AdminApp,
opts: { install: boolean; packageManager: PackageManager },
): Promise<void> {
// --quiet: the scaffold's own summary cards cover these — the command's
@@ -22,18 +28,3 @@ async function scaffoldApp(
if (!opts.install) args.push('--no-install')
await execa(runCommand(opts.packageManager), args, { cwd: projectDir, stdio: 'inherit' })
}
-
-/**
- * Scaffold both admin SPAs: the Dashboard at `apps/dashboard/` and the
- * marketplace Seller Panel at `apps/seller-dashboard/`. Both ship in every
- * project so the starter's Dockerfile finds them and bakes both into the
- * image — a marketplace that never invites a seller simply leaves /sellers
- * unvisited.
- */
-export async function scaffoldDashboard(
- projectDir: string,
- opts: { install: boolean; packageManager: PackageManager },
-): Promise<void> {
- await scaffoldApp(projectDir, 'dashboard', opts)
- await scaffoldApp(projectDir, 'seller-dashboard', opts)
-}
diff --git a/packages/create-spree-app/src/index.ts b/packages/create-spree-app/src/index.ts
index fe142dd0fe..3cde725c57 100644
--- a/packages/create-spree-app/src/index.ts
+++ b/packages/create-spree-app/src/index.ts
@@ -1,5 +1,5 @@
import * as p from '@clack/prompts'
-import { Command } from 'commander'
+import { Command, Option } from 'commander'
import getPort, { portNumbers } from 'get-port'
import pc from 'picocolors'
import { DEFAULT_SPREE_PORT } from './constants.js'
@@ -12,11 +12,12 @@ const program = new Command()
.name('create-spree-app')
.description('Create a new Spree Commerce project')
.argument('[directory]', 'project directory')
+ .option('--no-dashboard', 'skip the admin dashboard (the built-in one stays at /dashboard)')
+ .option('--no-seller-dashboard', 'skip the marketplace seller dashboard')
.option('--no-storefront', 'skip Next.js storefront setup')
- .option(
- '--react-dashboard',
- 'no-op: the React Dashboard is always included (kept so existing scripts keep working)',
- )
+ // Deprecated: the dashboard is included by default. Hidden, kept so
+ // existing scripts keep working.
+ .addOption(new Option('--react-dashboard').hideHelp())
.option('--no-start', 'do not start Docker services')
.option('--port <number>', 'port for the Spree server', String(DEFAULT_SPREE_PORT))
.option('--use-npm', 'use npm as package manager')
@@ -39,7 +40,8 @@ const program = new Command()
const options = await runPrompts({
directory,
noStorefront: flags.storefront === false ? true : undefined,
- reactDashboard: flags.reactDashboard === true,
+ noSellerDashboard: flags.sellerDashboard === false ? true : undefined,
+ noDashboard: flags.dashboard === false,
noStart: flags.start === false ? true : undefined,
packageManager,
})
diff --git a/packages/create-spree-app/src/prompts.ts b/packages/create-spree-app/src/prompts.ts
index e1a89ccac4..749db66b34 100644
--- a/packages/create-spree-app/src/prompts.ts
+++ b/packages/create-spree-app/src/prompts.ts
@@ -1,10 +1,12 @@
import * as p from '@clack/prompts'
+import pc from 'picocolors'
import type { PackageManager, ScaffoldOptions } from './types.js'
interface PromptFlags {
directory?: string
noStorefront?: boolean
- reactDashboard?: boolean
+ noSellerDashboard?: boolean
+ noDashboard?: boolean
noStart?: boolean
packageManager?: PackageManager
}
@@ -29,6 +31,11 @@ export async function runPrompts(
process.exit(0)
}
+ // Not prompted: nearly every project wants its own copy of the admin to
+ // customize. Without one the API still serves the built-in dashboard at
+ // /dashboard, so `--no-dashboard` is safe for API-only setups.
+ const dashboard = !flags.noDashboard
+
let storefront: boolean
if (flags.noStorefront !== undefined) {
storefront = !flags.noStorefront
@@ -45,11 +52,21 @@ export async function runPrompts(
storefront = storefrontResult
}
- // Always scaffolded, never prompted: from Spree 6 the React Dashboard IS
- // the admin (the Rails admin engine is gone), so a project without one has
- // no back office at all. The marketplace Seller Panel ships alongside it so
- // the pair stays consistent with what the starter's Docker image bakes.
- const dashboard = true
+ let sellerDashboard: boolean
+ if (flags.noSellerDashboard !== undefined) {
+ sellerDashboard = !flags.noSellerDashboard
+ } else {
+ const sellerResult = await p.confirm({
+ message: `Include Seller Panel?\n${pc.dim('Marketplaces only: a dedicated seller panel for your vendors to manage their products, orders and settings')}`,
+ initialValue: true,
+ })
+
+ if (p.isCancel(sellerResult)) {
+ p.cancel('Setup cancelled.')
+ process.exit(0)
+ }
+ sellerDashboard = sellerResult
+ }
let start: boolean
if (flags.noStart !== undefined) {
@@ -71,6 +88,7 @@ export async function runPrompts(
directory,
storefront,
dashboard,
+ sellerDashboard,
start,
packageManager: flags.packageManager ?? 'npm',
}
diff --git a/packages/create-spree-app/src/scaffold.ts b/packages/create-spree-app/src/scaffold.ts
index f9df2dae82..92e5ad5730 100644
--- a/packages/create-spree-app/src/scaffold.ts
+++ b/packages/create-spree-app/src/scaffold.ts
@@ -3,15 +3,15 @@ import path from 'node:path'
import * as p from '@clack/prompts'
import { execa } from 'execa'
import pc from 'picocolors'
-import { DASHBOARD_PORT, STOREFRONT_REPO } from './constants.js'
-import { scaffoldDashboard } from './dashboard.js'
-import { downloadServer } from './server.js'
import {
- downloadStorefront,
- installRootDeps,
- installStorefrontDeps,
- writeStorefrontEnv,
-} from './storefront.js'
+ DASHBOARD_PORT,
+ DOCS_MCP_URL,
+ SELLER_DASHBOARD_PORT,
+ STOREFRONT_REPO,
+} from './constants.js'
+import { scaffoldApp } from './dashboard.js'
+import { downloadServer } from './server.js'
+import { installRootDeps, scaffoldStorefront } from './storefront.js'
import { agentsMdContent, rootClaudeMdContent } from './templates/claude-md.js'
import { dependabotContent } from './templates/dependabot.js'
import { envContent } from './templates/env.js'
@@ -32,7 +32,7 @@ import {
export async function scaffold(options: ScaffoldOptions): Promise<void> {
const projectDir = path.resolve(options.directory)
const projectName = path.basename(projectDir)
- const { port, storefront, dashboard } = options
+ const { port, storefront, dashboard, sellerDashboard } = options
// Pre-flight checks
if (options.start) {
@@ -113,76 +113,71 @@ export async function scaffold(options: ScaffoldOptions): Promise<void> {
await installRootDeps(projectDir, options.packageManager)
s.stop('Dependencies installed.')
- // Phases 3/3b are optional apps — their failures warn and continue. They
- // must never abort the scaffold before Phase 4: `spree init` is what
- // guarantees a fresh Spree image (skipping it leaves a stale local `latest`
- // to boot) and a seeded, credentialed server.
-
- // Phase 3: Storefront (optional)
- let storefrontReady = storefront
- if (storefront) {
+ // Phase 3: the apps — Dashboard, Seller Panel, then storefront. Their
+ // failures warn and continue: they must never abort the scaffold before
+ // Phase 4, since `spree init` is what guarantees a fresh Spree image
+ // (skipping it leaves a stale local `latest` to boot) and a seeded,
+ // credentialed server. A failed app's partial directory is removed so the
+ // recovery command, which expects it absent, actually works.
+ const run = runCommand(options.packageManager)
+ const tryApp = async (dir: string, recovery: string, step: () => Promise<void>) => {
try {
- s.start('Downloading storefront template...')
- await downloadStorefront(projectDir)
- s.stop('Storefront template downloaded.')
-
- writeStorefrontEnv(projectDir, port)
-
- s.start('Installing storefront dependencies...')
- await installStorefrontDeps(projectDir, options.packageManager)
- s.stop('Storefront dependencies installed.')
+ await step()
+ return true
} catch (err) {
- storefrontReady = false
- s.stop('Storefront setup failed.')
- // Remove the partial checkout so the recovery command (a fresh clone)
- // actually works instead of failing on a non-empty directory.
- fs.rmSync(path.join(projectDir, 'apps', 'storefront'), { recursive: true, force: true })
+ fs.rmSync(path.join(projectDir, 'apps', dir), { recursive: true, force: true })
p.log.warn(
- `Continuing without the storefront — add it later by cloning ${STOREFRONT_REPO} into apps/storefront.\n${errorMessage(err)}`,
+ `Continuing without apps/${dir}/ — add it later with ${pc.bold(recovery)}.\n${errorMessage(err)}`,
)
+ return false
}
}
+ const appOpts = { install: true, packageManager: options.packageManager }
- // Phase 3b: the admin SPAs — the Dashboard
- // and the marketplace Seller Panel. Delegates to the project-local
- // `npx spree add <component>` — @spree/cli is already installed (root deps,
- // above) and bundles both starter templates. It reads the port from the
- // project's .env and prints its own progress.
- let dashboardReady = dashboard
- if (dashboard) {
- try {
- await scaffoldDashboard(projectDir, { install: true, packageManager: options.packageManager })
- } catch (err) {
- dashboardReady = false
- // Remove the partial scaffold so the recovery command (`spree add
- // dashboard`, which expects the directory to be absent) actually works.
- // Both apps go: the second can fail after the first succeeded, and a
- // half-scaffolded pair is worse than none.
- for (const app of ['dashboard', 'seller-dashboard']) {
- fs.rmSync(path.join(projectDir, 'apps', app), { recursive: true, force: true })
- }
- p.log.warn(
- `Continuing without the React Dashboard — add it later with ${pc.bold(`${runCommand(options.packageManager)} spree add dashboard`)}.\n${errorMessage(err)}`,
- )
- }
- }
+ const dashboardReady =
+ dashboard &&
+ (await tryApp('dashboard', `${run} spree add dashboard`, () =>
+ scaffoldApp(projectDir, 'dashboard', appOpts),
+ ))
+ const sellerDashboardReady =
+ sellerDashboard &&
+ (await tryApp('seller-dashboard', `${run} spree add seller-dashboard`, () =>
+ scaffoldApp(projectDir, 'seller-dashboard', appOpts),
+ ))
+ const storefrontReady =
+ storefront &&
+ (await tryApp('storefront', `git clone ${STOREFRONT_REPO} apps/storefront`, () =>
+ scaffoldStorefront(projectDir, port, options.packageManager),
+ ))
// Project docs are generated only now, from the phases' actual outcomes —
// a README written up front from the requested flags would document apps
// whose setup failed.
fs.writeFileSync(
path.join(projectDir, 'README.md'),
- readmeContent(projectName, storefrontReady, port, dashboardReady, options.packageManager),
+ readmeContent(
+ projectName,
+ storefrontReady,
+ port,
+ dashboardReady,
+ options.packageManager,
+ sellerDashboardReady,
+ ),
)
fs.writeFileSync(
path.join(projectDir, 'CLAUDE.md'),
- rootClaudeMdContent(storefrontReady, dashboardReady, options.packageManager),
+ rootClaudeMdContent(
+ storefrontReady,
+ dashboardReady,
+ options.packageManager,
+ sellerDashboardReady,
+ ),
)
const githubDir = path.join(projectDir, '.github')
fs.mkdirSync(githubDir, { recursive: true })
fs.writeFileSync(
path.join(githubDir, 'dependabot.yml'),
- dependabotContent(storefrontReady, dashboardReady),
+ dependabotContent(storefrontReady, dashboardReady, sellerDashboardReady),
)
// Phase 4: Initialize and start services
@@ -211,18 +206,32 @@ export async function scaffold(options: ScaffoldOptions): Promise<void> {
`${pc.bold('Storefront')}: ${pc.cyan(`cd ${projectName}/apps/storefront && ${storefrontPm(options.packageManager)} run dev`)}`,
)
}
+ if (sellerDashboardReady) {
+ p.log.info(
+ `${pc.bold('Seller Panel')}: ${pc.cyan(`cd ${projectName}/apps/seller-dashboard && ${options.packageManager} run dev`)} ${pc.dim(`→ http://localhost:${SELLER_DASHBOARD_PORT}`)}`,
+ )
+ }
// No dashboard line here — with the dashboard chosen, `spree init`'s
// summary already leads with it (served at /dashboard, plus the
// customize command).
} else {
- printSuccessWithoutDocker(projectName, storefrontReady, dashboardReady, options.packageManager)
+ printSuccessWithoutDocker(
+ projectName,
+ port,
+ storefrontReady,
+ dashboardReady,
+ sellerDashboardReady,
+ options.packageManager,
+ )
}
}
function printSuccessWithoutDocker(
projectName: string,
+ port: number,
hasStorefront: boolean,
hasDashboard: boolean,
+ hasSellerDashboard: boolean,
pm: PackageManager,
): void {
const run = runCommand(pm)
@@ -244,10 +253,9 @@ function printSuccessWithoutDocker(
)
}
- // With the React Dashboard chosen, its dev server IS the admin — and
- // `spree dev` co-runs it with the API, so the URL is live the moment the
- // stack is up. Without it there is no admin to open yet — Spree 6 has no
- // Rails admin — so point at the command that adds one.
+ // With apps/dashboard, its dev server is the admin — `spree dev` co-runs it
+ // with the API, so the URL is live the moment the stack is up. Without it
+ // the API serves the built-in dashboard at /dashboard.
if (hasDashboard) {
lines.push(
'',
@@ -261,8 +269,20 @@ function printSuccessWithoutDocker(
lines.push(
'',
`${pc.bold('Admin Dashboard')}`,
- ` ${run} spree add dashboard`,
- ` ${pc.dim('# scaffolds the React admin into apps/dashboard/')}`,
+ ` http://localhost:${port}/dashboard`,
+ ` ${pc.dim(`# to customize it: ${run} spree add dashboard`)}`,
+ '',
+ )
+ }
+
+ if (hasSellerDashboard) {
+ lines.push(
+ `${pc.bold('Seller Panel')}`,
+ ` ${pc.dim('# In another terminal:')}`,
+ ` cd ${projectName}/apps/seller-dashboard`,
+ ` ${pm} run dev`,
+ ` http://localhost:${SELLER_DASHBOARD_PORT}`,
+ ` ${pc.dim('# sellers you invite from the Admin Dashboard sign in here')}`,
'',
)
}
@@ -277,6 +297,11 @@ function printSuccessWithoutDocker(
` ${pc.dim('# Adds 23 Spree skills to whichever AI agent(s) you use')}`,
` ${pc.dim('# (Claude Code, Codex, Cursor, Copilot, Cline, Aider, +60 others)')}`,
'',
+ `${pc.bold('Spree docs MCP server (optional)')}`,
+ ` claude mcp add --transport http spree-docs ${DOCS_MCP_URL}`,
+ ` ${pc.dim('# Lets your AI agent search the latest Spree docs. Other agents:')}`,
+ ` ${pc.dim('# https://spreecommerce.org/docs/developer/agentic/mcp')}`,
+ '',
`${pc.bold('Join our Discord')}`,
` https://discord.spreecommerce.org`,
'',
diff --git a/packages/create-spree-app/src/storefront.ts b/packages/create-spree-app/src/storefront.ts
index 1231228caf..e5964679c7 100644
--- a/packages/create-spree-app/src/storefront.ts
+++ b/packages/create-spree-app/src/storefront.ts
@@ -1,11 +1,48 @@
import fs from 'node:fs'
import path from 'node:path'
+import * as p from '@clack/prompts'
import { execa } from 'execa'
+import pc from 'picocolors'
import { STOREFRONT_REPO } from './constants.js'
import { storefrontEnvContent } from './templates/env.js'
import type { PackageManager } from './types.js'
import { installCommand, storefrontPm } from './utils.js'
+/**
+ * Clone the storefront into `apps/storefront/` and install its dependencies,
+ * printing the same steps `spree add dashboard` does so every app section of
+ * the scaffold reads alike. Throws on failure; the caller decides recovery.
+ */
+export async function scaffoldStorefront(
+ projectDir: string,
+ port: number,
+ pm: PackageManager,
+): Promise<void> {
+ p.intro(pc.bgCyan(pc.black(' Spree Storefront ')))
+ const s = p.spinner()
+
+ s.start('Fetching storefront starter...')
+ try {
+ await downloadStorefront(projectDir)
+ } catch (err) {
+ s.stop('Fetch failed.')
+ throw err
+ }
+ s.stop(`Created ${pc.cyan('apps/storefront/')}`)
+
+ writeStorefrontEnv(projectDir, port)
+
+ s.start(`Installing dependencies with ${storefrontPm(pm)}...`)
+ try {
+ await installStorefrontDeps(projectDir, pm)
+ } catch (err) {
+ s.stop(pc.yellow(`${storefrontPm(pm)} install failed.`))
+ throw err
+ }
+ s.stop('Dependencies installed.')
+ p.outro('Done!')
+}
+
export async function downloadStorefront(projectDir: string): Promise<void> {
const storefrontDir = path.join(projectDir, 'apps', 'storefront')
await execa('git', ['clone', '--depth', '1', STOREFRONT_REPO, storefrontDir], { stdio: 'ignore' })
diff --git a/packages/create-spree-app/src/templates/claude-md.ts b/packages/create-spree-app/src/templates/claude-md.ts
index 40506f8d2b..2610f798a9 100644
--- a/packages/create-spree-app/src/templates/claude-md.ts
+++ b/packages/create-spree-app/src/templates/claude-md.ts
@@ -11,7 +11,7 @@ the directory you are working in before changing anything there.
## Spree-specific agent skills
For deeper Spree-specific guidance (API conventions, the data model, event system,
-testing patterns, security, deployment, the React dashboard, the Next.js
+testing patterns, security, deployment, the admin dashboard, the Next.js
storefront, etc.), install the official skill set:
\`\`\`bash
@@ -32,6 +32,7 @@ export function rootClaudeMdContent(
hasStorefront: boolean,
hasDashboard = false,
pm: PackageManager = 'pnpm',
+ hasSellerDashboard = hasDashboard,
): string {
const run = runCommand(pm)
const lines = [
@@ -49,7 +50,10 @@ export function rootClaudeMdContent(
}
if (hasDashboard) {
- lines.push('| `apps/dashboard/` | React Dashboard — admin SPA |')
+ lines.push('| `apps/dashboard/` | Admin Dashboard — React SPA |')
+ }
+
+ if (hasSellerDashboard) {
lines.push('| `apps/seller-dashboard/` | Seller Panel — marketplace seller SPA |')
}
@@ -69,6 +73,11 @@ export function rootClaudeMdContent(
if (hasDashboard) {
lines.push(
'- **Dashboard work** (admin SPA, React, TypeScript): See `apps/dashboard/AGENTS.md`',
+ )
+ }
+
+ if (hasSellerDashboard) {
+ lines.push(
'- **Seller Panel work** (marketplace seller SPA): See `apps/seller-dashboard/AGENTS.md`',
)
}
@@ -84,7 +93,7 @@ export function rootClaudeMdContent(
'├── developer/',
'│ ├── core-concepts/ # Products, orders, payments, inventory, etc.',
'│ ├── customization/ # Decorators, extensions, configuration, dependencies',
- '│ ├── dashboard/ # React dashboard: customization, recipes, plugins',
+ '│ ├── dashboard/ # Admin dashboard: customization, recipes, plugins',
'│ ├── storefront/ # Storefront building guides',
'│ ├── sdk/ # TypeScript SDK documentation',
'│ └── tutorial/ # Step-by-step tutorials',
diff --git a/packages/create-spree-app/src/templates/dependabot.ts b/packages/create-spree-app/src/templates/dependabot.ts
index 9a953c0d88..53a7d8be58 100644
--- a/packages/create-spree-app/src/templates/dependabot.ts
+++ b/packages/create-spree-app/src/templates/dependabot.ts
@@ -40,7 +40,11 @@ function ecosystemBlock({ comment, ecosystem, directory, group }: Ecosystem): st
* toggle in the repo's Settings → Advanced Security; the config only groups
* them.
*/
-export function dependabotContent(hasStorefront: boolean, hasDashboard = false): string {
+export function dependabotContent(
+ hasStorefront: boolean,
+ hasDashboard = false,
+ hasSellerDashboard = false,
+): string {
const ecosystems: Ecosystem[] = [
{
comment: 'Root wrapper (@spree/cli, @spree/docs)',
@@ -73,13 +77,22 @@ export function dependabotContent(hasStorefront: boolean, hasDashboard = false):
if (hasDashboard) {
ecosystems.push({
- comment: 'React Dashboard',
+ comment: 'Admin Dashboard',
ecosystem: 'npm',
directory: '/apps/dashboard',
group: 'dashboard',
})
}
+ if (hasSellerDashboard) {
+ ecosystems.push({
+ comment: 'Seller Panel',
+ ecosystem: 'npm',
+ directory: '/apps/seller-dashboard',
+ group: 'seller-dashboard',
+ })
+ }
+
return `version: 2
updates:
${ecosystems.map(ecosystemBlock).join('\n\n')}
diff --git a/packages/create-spree-app/src/templates/readme.ts b/packages/create-spree-app/src/templates/readme.ts
index b8e2e9ffcd..788127e682 100644
--- a/packages/create-spree-app/src/templates/readme.ts
+++ b/packages/create-spree-app/src/templates/readme.ts
@@ -14,6 +14,7 @@ export function readmeContent(
port: number,
hasDashboard = false,
pm: PackageManager = 'pnpm',
+ hasSellerDashboard = hasDashboard,
): string {
const run = runCommand(pm)
let content = `# ${name}
@@ -41,9 +42,13 @@ Wait for the services to be healthy, then open:
${
hasDashboard
? `- **Admin Dashboard:** http://localhost:${DASHBOARD_PORT} — started automatically by \`spree dev\`
- - The first run opens a setup link where you create the admin account
-- **Seller Panel (marketplace):** http://localhost:${SELLER_DASHBOARD_PORT} — run it with \`cd apps/seller-dashboard && pnpm dev\``
- : `- **Admin Dashboard:** run \`spree add dashboard\` to scaffold it`
+ - The first run opens a setup link where you create the admin account`
+ : `- **Admin Dashboard:** http://localhost:${port}/dashboard — run \`${run} spree add dashboard\` to get your own copy to customize`
+}${
+ hasSellerDashboard
+ ? `
+- **Seller Panel (marketplace):** http://localhost:${SELLER_DASHBOARD_PORT} — run it with \`cd apps/seller-dashboard && ${pm} run dev\``
+ : ''
}
- **Store API:** http://localhost:${port}/api/v3/store
`
@@ -65,7 +70,7 @@ Open http://localhost:${STOREFRONT_PORT}
if (hasDashboard) {
content += `
-### The React Dashboard
+### The Admin Dashboard
\`apps/dashboard/\` is your admin — a customizable React SPA (plugins, your
own pages, table tweaks) with live reload. \`spree dev\` starts it
@@ -83,7 +88,7 @@ When you deploy, the production image builds your dashboard and serves it at
\`/dashboard\` on the same origin as the API (\`${run} spree build --production\`).
To learn how to add pages, tweak tables, or build plugins, see the
-[React Dashboard docs](https://spreecommerce.org/docs/developer/dashboard/overview).
+[Admin Dashboard docs](https://spreecommerce.org/docs/developer/dashboard/overview).
`
}
diff --git a/packages/create-spree-app/src/types.ts b/packages/create-spree-app/src/types.ts
index cdfa9b53af..581cadd4f6 100644
--- a/packages/create-spree-app/src/types.ts
+++ b/packages/create-spree-app/src/types.ts
@@ -4,6 +4,7 @@ export interface ScaffoldOptions {
directory: string
storefront: boolean
dashboard: boolean
+ sellerDashboard: boolean
start: boolean
packageManager: PackageManager
port: number
diff --git a/packages/create-spree-app/tests/dashboard.test.ts b/packages/create-spree-app/tests/dashboard.test.ts
index 6482c5f3da..8a295f789e 100644
--- a/packages/create-spree-app/tests/dashboard.test.ts
+++ b/packages/create-spree-app/tests/dashboard.test.ts
@@ -3,58 +3,26 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
vi.mock('execa', () => ({ execa: vi.fn() }))
import { execa } from 'execa'
-import { scaffoldDashboard } from '../src/dashboard'
+import { scaffoldApp } from '../src/dashboard'
-// Both admin SPAs ship in every project: from Spree 6 the Dashboard IS the
-// admin, and the starter's Dockerfile bakes whichever of the two it finds
-// under apps/. A scaffold that silently produced only one would leave either
-// no back office or no seller panel in the built image.
-describe('scaffoldDashboard', () => {
+describe('scaffoldApp', () => {
beforeEach(() => vi.mocked(execa).mockClear())
- function componentsScaffoldedInto(projectDir: string): string[] {
- return vi
- .mocked(execa)
- .mock.calls.filter(([, args]) => (args as string[])?.[0] === 'spree')
- .filter(([, , opts]) => (opts as { cwd?: string })?.cwd === projectDir)
- .map(([, args]) => (args as string[])[2])
- }
-
- it('scaffolds both the dashboard and the seller panel', async () => {
- await scaffoldDashboard('/tmp/project', { install: true, packageManager: 'pnpm' })
-
- expect(componentsScaffoldedInto('/tmp/project')).toEqual(['dashboard', 'seller-dashboard'])
- })
-
- it('runs each through the project-local CLI, quietly', async () => {
- await scaffoldDashboard('/tmp/project', { install: true, packageManager: 'npm' })
+ it('runs `spree add <app>` through the project-local CLI, quietly', async () => {
+ await scaffoldApp('/tmp/project', 'seller-dashboard', { install: true, packageManager: 'npm' })
// npm reaches the local CLI through npx; --quiet suppresses the command's
// own summary because the scaffold prints its own.
- for (const [cmd, args, opts] of vi.mocked(execa).mock.calls) {
- expect(cmd).toBe('npx')
- expect(args).toContain('--quiet')
- expect((opts as { cwd?: string }).cwd).toBe('/tmp/project')
- }
+ expect(vi.mocked(execa)).toHaveBeenCalledWith(
+ 'npx',
+ ['spree', 'add', 'seller-dashboard', '--quiet'],
+ expect.objectContaining({ cwd: '/tmp/project' }),
+ )
})
- it('passes --no-install through to both apps when installing is skipped', async () => {
- await scaffoldDashboard('/tmp/project', { install: false, packageManager: 'pnpm' })
-
- const calls = vi.mocked(execa).mock.calls
- expect(calls).toHaveLength(2)
- for (const [, args] of calls) {
- expect(args).toContain('--no-install')
- }
- })
-
- it('stops at the first failure rather than leaving a half-scaffolded pair', async () => {
- vi.mocked(execa).mockRejectedValueOnce(new Error('spree add dashboard failed'))
-
- await expect(
- scaffoldDashboard('/tmp/project', { install: true, packageManager: 'pnpm' }),
- ).rejects.toThrow('spree add dashboard failed')
+ it('passes --no-install through when installing is skipped', async () => {
+ await scaffoldApp('/tmp/project', 'dashboard', { install: false, packageManager: 'pnpm' })
- expect(componentsScaffoldedInto('/tmp/project')).toEqual(['dashboard'])
+ expect(vi.mocked(execa).mock.calls[0][1]).toContain('--no-install')
})
})
diff --git a/packages/create-spree-app/tests/prompts.test.ts b/packages/create-spree-app/tests/prompts.test.ts
index f467054557..2a92049470 100644
--- a/packages/create-spree-app/tests/prompts.test.ts
+++ b/packages/create-spree-app/tests/prompts.test.ts
@@ -13,24 +13,36 @@ import { runPrompts } from '../src/prompts'
const ANSWERED = {
directory: './my-store',
noStorefront: true,
+ noSellerDashboard: false,
noStart: true,
packageManager: 'pnpm',
} as const
describe('runPrompts', () => {
- // From Spree 6 the React Dashboard IS the admin — the Rails admin engine is
- // gone — so a scaffold without one has no back office. It is therefore not
- // a question, and `--react-dashboard` is a no-op rather than a gate.
- it('always includes the admin apps, with no prompt and regardless of flags', async () => {
+ it('includes the dashboard without asking, unless --no-dashboard is passed', async () => {
const { confirm } = await import('@clack/prompts')
expect((await runPrompts({ ...ANSWERED })).dashboard).toBe(true)
- expect((await runPrompts({ ...ANSWERED, reactDashboard: false })).dashboard).toBe(true)
- expect((await runPrompts({ ...ANSWERED, reactDashboard: true })).dashboard).toBe(true)
+ expect((await runPrompts({ ...ANSWERED, noDashboard: true })).dashboard).toBe(false)
expect(vi.mocked(confirm)).not.toHaveBeenCalled()
})
+ it('asks about the seller panel, defaulting to yes', async () => {
+ const { confirm } = await import('@clack/prompts')
+ vi.mocked(confirm).mockResolvedValueOnce(false)
+
+ const options = await runPrompts({ ...ANSWERED, noSellerDashboard: undefined })
+
+ expect(options.sellerDashboard).toBe(false)
+ expect(vi.mocked(confirm)).toHaveBeenCalledWith(
+ expect.objectContaining({
+ message: expect.stringContaining('Include Seller Panel?'),
+ initialValue: true,
+ }),
+ )
+ })
+
// Sample data is loaded on demand with `spree sample-data`, never as part of
// the scaffold: the seed runs before the store is configured through the
// first-run setup UI.
diff --git a/packages/create-spree-app/tests/scaffold.test.ts b/packages/create-spree-app/tests/scaffold.test.ts
index 1374f5de30..908f7c5fe3 100644
--- a/packages/create-spree-app/tests/scaffold.test.ts
+++ b/packages/create-spree-app/tests/scaffold.test.ts
@@ -61,18 +61,16 @@ vi.mock('../src/storefront', async (importOriginal) => {
const mod = await importOriginal<typeof import('../src/storefront')>()
return {
...mod,
- downloadStorefront: vi.fn(),
installRootDeps: vi.fn(),
- installStorefrontDeps: vi.fn(),
- writeStorefrontEnv: vi.fn(),
+ scaffoldStorefront: vi.fn(),
}
})
vi.mock('../src/dashboard', () => ({
// The real implementation shells out to the project-local
- // `npx spree add dashboard` — its behavior is covered by @spree/cli's own
+ // `npx spree add <app>` — its behavior is covered by @spree/cli's own
// tests. Here we only assert the delegation happens (or doesn't).
- scaffoldDashboard: vi.fn(),
+ scaffoldApp: vi.fn(),
}))
// `spree init` is shelled out to; the scaffold only decides its arguments.
@@ -251,45 +249,104 @@ describe('scaffold (no-start)', () => {
expect(pkg.scripts.eject).toBe('spree eject')
})
- it('delegates dashboard scaffolding to the project-local CLI when included', async () => {
- const { scaffoldDashboard } = await import('../src/dashboard')
+ it('scaffolds the dashboard, then the seller panel, then the storefront', async () => {
+ const { scaffoldApp } = await import('../src/dashboard')
+ const { scaffoldStorefront } = await import('../src/storefront')
+ const order: string[] = []
+ vi.mocked(scaffoldApp).mockImplementation(async (_dir, app) => {
+ order.push(app)
+ })
+ vi.mocked(scaffoldStorefront).mockImplementation(async () => {
+ order.push('storefront')
+ })
const projectDir = getTempProjectDir()
await scaffold({
directory: projectDir,
- storefront: false,
+ storefront: true,
dashboard: true,
+ sellerDashboard: true,
start: false,
packageManager: 'npm',
port: 4567,
})
- expect(scaffoldDashboard).toHaveBeenCalledWith(projectDir, {
+ expect(order).toEqual(['dashboard', 'seller-dashboard', 'storefront'])
+ expect(scaffoldApp).toHaveBeenCalledWith(projectDir, 'dashboard', {
install: true,
packageManager: 'npm',
})
- expect(fs.readFileSync(path.join(projectDir, 'README.md'), 'utf-8')).toContain(
- 'React Dashboard',
+ const readme = fs.readFileSync(path.join(projectDir, 'README.md'), 'utf-8')
+ expect(readme).toContain('### The Admin Dashboard')
+ expect(readme).toContain('Seller Panel')
+ })
+
+ it('skips the seller panel when not chosen', async () => {
+ const { scaffoldApp } = await import('../src/dashboard')
+ vi.mocked(scaffoldApp).mockReset()
+ const projectDir = getTempProjectDir()
+
+ await scaffold({
+ directory: projectDir,
+ storefront: false,
+ dashboard: true,
+ sellerDashboard: false,
+ start: false,
+ packageManager: 'npm',
+ port: 3000,
+ })
+
+ expect(vi.mocked(scaffoldApp).mock.calls.map(([, app]) => app)).toEqual(['dashboard'])
+ expect(fs.readFileSync(path.join(projectDir, 'README.md'), 'utf-8')).not.toContain(
+ 'Seller Panel',
)
})
+ // A failed seller panel must not take the working dashboard down with it.
+ it('keeps the dashboard when only the seller panel fails', async () => {
+ const { scaffoldApp } = await import('../src/dashboard')
+ vi.mocked(scaffoldApp).mockReset()
+ vi.mocked(scaffoldApp).mockImplementation(async (dir, app) => {
+ fs.mkdirSync(path.join(dir, 'apps', app), { recursive: true })
+ if (app === 'seller-dashboard') throw new Error('spree add seller-dashboard failed')
+ })
+ const projectDir = getTempProjectDir()
+
+ await scaffold({
+ directory: projectDir,
+ storefront: false,
+ dashboard: true,
+ sellerDashboard: true,
+ start: false,
+ packageManager: 'npm',
+ port: 3000,
+ })
+
+ expect(fs.existsSync(path.join(projectDir, 'apps', 'dashboard'))).toBe(true)
+ expect(fs.existsSync(path.join(projectDir, 'apps', 'seller-dashboard'))).toBe(false)
+ const readme = fs.readFileSync(path.join(projectDir, 'README.md'), 'utf-8')
+ expect(readme).toContain('### The Admin Dashboard')
+ expect(readme).not.toContain('Seller Panel')
+ })
+
it('skips the dashboard when not included', async () => {
- const { scaffoldDashboard } = await import('../src/dashboard')
- vi.mocked(scaffoldDashboard).mockClear()
+ const { scaffoldApp } = await import('../src/dashboard')
+ vi.mocked(scaffoldApp).mockReset()
const projectDir = getTempProjectDir()
await scaffold({
directory: projectDir,
storefront: false,
dashboard: false,
+ sellerDashboard: false,
start: false,
packageManager: 'npm',
port: 3000,
})
- expect(scaffoldDashboard).not.toHaveBeenCalled()
+ expect(scaffoldApp).not.toHaveBeenCalled()
expect(fs.readFileSync(path.join(projectDir, 'README.md'), 'utf-8')).not.toContain(
- 'React Dashboard',
+ '### The Admin Dashboard',
)
})
diff --git a/packages/create-spree-app/tests/templates.test.ts b/packages/create-spree-app/tests/templates.test.ts
index 67810d335b..ebd692c419 100644
--- a/packages/create-spree-app/tests/templates.test.ts
+++ b/packages/create-spree-app/tests/templates.test.ts
@@ -201,11 +201,9 @@ describe('readmeContent', () => {
expect(content).toContain('cd apps/dashboard\nyarn run dev')
})
- it('includes the React Dashboard section when included', () => {
+ it('includes the Admin Dashboard section when included', () => {
const content = readmeContent('my-store', true, 3000, true)
- expect(content).toContain('### The React Dashboard')
- // The dashboard's dev server IS the admin in Spree 6 — the Rails admin
- // engine is gone, so the README must not point at /admin.
+ expect(content).toContain('### The Admin Dashboard')
expect(content).toContain('http://localhost:5173')
expect(content).not.toMatch(/classic admin/i)
expect(content).not.toContain('localhost:3000/admin')
@@ -213,9 +211,10 @@ describe('readmeContent', () => {
expect(content).toContain('docs/developer/dashboard')
})
- it('omits the React Dashboard section by default', () => {
+ it('points at the built-in dashboard when apps/dashboard was skipped', () => {
const content = readmeContent('my-store', true, 3000)
- expect(content).not.toContain('React Dashboard')
+ expect(content).not.toContain('### The Admin Dashboard')
+ expect(content).toContain('http://localhost:3000/dashboard')
})
})
@@ -238,6 +237,12 @@ describe('rootClaudeMdContent', () => {
it('omits apps/dashboard by default', () => {
expect(rootClaudeMdContent(true)).not.toContain('apps/dashboard')
})
+
+ it('omits the seller panel when it was not installed', () => {
+ const content = rootClaudeMdContent(true, true, 'pnpm', false)
+ expect(content).toContain('apps/dashboard/AGENTS.md')
+ expect(content).not.toContain('apps/seller-dashboard')
+ })
})
describe('gitignoreContent', () => {
@@ -282,6 +287,13 @@ describe('dependabotContent', () => {
expect(content).toContain('dashboard-security:')
})
+ it('adds the seller panel npm ecosystem only when it was installed', () => {
+ expect(dependabotContent(true, true, true)).toContain(
+ 'package-ecosystem: npm\n directory: "/apps/seller-dashboard"',
+ )
+ expect(dependabotContent(true, true)).not.toContain('/apps/seller-dashboard')
+ })
+
it('omits the dashboard ecosystem by default', () => {
expect(dependabotContent(true)).not.toContain('/apps/dashboard')
})