@spree/cli 3.2.2 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/index.js +466 -317
- package/dist/templates/dashboard-starter/AGENTS.md +17 -3
- package/dist/templates/dashboard-starter/CLAUDE.md +1 -0
- package/dist/templates/dashboard-starter/package.json +15 -12
- package/dist/templates/dashboard-starter/src/routeTree.gen.ts +173 -38
- package/dist/templates/seller-dashboard-starter/AGENTS.md +32 -14
- package/dist/templates/seller-dashboard-starter/CLAUDE.md +1 -0
- package/dist/templates/seller-dashboard-starter/package.json +16 -12
- package/dist/templates/seller-dashboard-starter/src/plugins.ts +9 -8
- package/package.json +14 -13
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
# Agent Instructions
|
|
2
2
|
|
|
3
|
+
`CLAUDE.md` only imports this file — edit this one.
|
|
4
|
+
|
|
3
5
|
This is the Spree seller panel for this marketplace — a Vite + React app. The
|
|
4
6
|
shell ships in `@spree/seller-dashboard`; this project holds your
|
|
5
7
|
customizations. Sellers manage their own catalog and orders here.
|
|
6
8
|
|
|
7
9
|
Full docs: https://spreecommerce.org/docs/developer/dashboard/overview
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
## Running it
|
|
12
|
+
|
|
13
|
+
Start the Spree API with `spree dev` from the project root (`../..`) — it is
|
|
14
|
+
only ever run through the Spree CLI; see the project root's `AGENTS.md`. Then
|
|
15
|
+
run this app's own dev server here with `pnpm dev` (or `npm run dev`); the
|
|
16
|
+
Spree CLI does not start the seller panel for you.
|
|
11
17
|
|
|
12
18
|
## Imports
|
|
13
19
|
|
|
@@ -15,7 +21,7 @@ Import from `@spree/seller-dashboard` — it re-exports the framework and the de
|
|
|
15
21
|
system, so there is no need to work out which package an export lives in.
|
|
16
22
|
|
|
17
23
|
```ts
|
|
18
|
-
import { defineDashboardPlugin,
|
|
24
|
+
import { defineDashboardPlugin, sellerClient, Button, ResourceTable } from '@spree/seller-dashboard'
|
|
19
25
|
```
|
|
20
26
|
|
|
21
27
|
`@spree/dashboard-core` and `@spree/dashboard-ui` stay importable for the few
|
|
@@ -30,26 +36,35 @@ uses internally.
|
|
|
30
36
|
| Directory | Holds | Naming |
|
|
31
37
|
|---|---|---|
|
|
32
38
|
| `src/plugins.ts` | Registrations only: nav, slots, tables | one file |
|
|
33
|
-
| `src/pages/` |
|
|
34
|
-
| `src/hooks/` |
|
|
39
|
+
| `src/pages/` | Larger components rendered inside slots | `payout-summary.tsx` |
|
|
40
|
+
| `src/hooks/` | Seller API wrappers | `use-payouts.ts` |
|
|
35
41
|
| `src/tables/` | `defineTable` calls | `brands.tsx` |
|
|
36
42
|
| `src/schemas/` | Zod schema + `FormValues` | `brand.ts` |
|
|
37
43
|
| `src/slots/` | Widgets injected into built-in pages | `seller-payout-card.tsx` |
|
|
38
44
|
| `src/locales/` | Your `admin.*` translation keys | `en.json` |
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
Keep `plugins.ts` a map of what exists, not an implementation.
|
|
47
|
+
|
|
48
|
+
The seller panel does not support adding new pages yet: plugins can remove
|
|
49
|
+
built-in navigation entries, add widgets to the slots built-in screens expose,
|
|
50
|
+
and add table columns. A navigation entry pointing at a path the panel does
|
|
51
|
+
not have leads to a "not found" screen.
|
|
42
52
|
|
|
43
53
|
## Rules
|
|
44
54
|
|
|
45
|
-
- **The
|
|
55
|
+
- **The Seller API is the only data source.** Never reach into the Rails app or
|
|
46
56
|
import server-rendered HTML. Seller endpoints are scoped to the signed-in
|
|
47
57
|
seller by the server, never by the client. A missing endpoint is added to the API first.
|
|
48
|
-
- **
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
- **
|
|
52
|
-
|
|
58
|
+
- **Use the Seller API, through a hook.** Hooks call `sellerClient()`;
|
|
59
|
+
components never call it directly. Never use `adminClient` here — it targets
|
|
60
|
+
the Admin API, which sellers cannot sign in to.
|
|
61
|
+
- **There is no store context.** The panel's tenant is the signed-in seller, so
|
|
62
|
+
`useStore()` throws here. Build query keys with `useResourceKey`, which scopes
|
|
63
|
+
them to the seller.
|
|
64
|
+
- **Writes go through `useResourceMutation`.** It shows a toast for network
|
|
65
|
+
and server failures but not for 422 validation errors — catch those in the
|
|
66
|
+
form's submit handler with `mapSpreeErrorsToForm`, which puts each message on
|
|
67
|
+
its field.
|
|
53
68
|
- **Every visible string goes through i18next** — page titles, column labels,
|
|
54
69
|
buttons, empty states, toasts. Never hardcode English in JSX or in a table
|
|
55
70
|
definition. Add each new key to every locale file the project ships.
|
|
@@ -59,12 +74,15 @@ of what exists, not an implementation.
|
|
|
59
74
|
walks every nested key and the SDK's object graph overflows the TypeScript
|
|
60
75
|
compiler.
|
|
61
76
|
- **A sortable or filterable column must be allowlisted for Ransack** on the
|
|
62
|
-
model, or the request fails at runtime.
|
|
77
|
+
model, or the request fails at runtime. That change belongs to the Spree API
|
|
78
|
+
in `../../server/` — follow `../../server/AGENTS.md`.
|
|
63
79
|
- **Destructive actions that fire straight from a click need a confirm** —
|
|
64
80
|
`useConfirm()` with `variant: 'destructive'`.
|
|
65
81
|
|
|
66
82
|
## Checks
|
|
67
83
|
|
|
84
|
+
Run these with the project's package manager (`pnpm`, `npm run` or `yarn`):
|
|
85
|
+
|
|
68
86
|
```bash
|
|
69
87
|
pnpm typecheck
|
|
70
88
|
pnpm lint
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
|
@@ -16,24 +16,28 @@
|
|
|
16
16
|
"lint:fix": "biome check --fix ."
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@spree/
|
|
20
|
-
"@spree/dashboard-core": "^1.0.0-rc.
|
|
21
|
-
"@spree/dashboard-ui": "^1.0.0-rc.
|
|
22
|
-
"@spree/seller-
|
|
23
|
-
"@
|
|
24
|
-
"@tanstack/react-
|
|
25
|
-
"react": "^
|
|
26
|
-
"
|
|
19
|
+
"@spree/admin-sdk": "^1.0.0-rc.4",
|
|
20
|
+
"@spree/dashboard-core": "^1.0.0-rc.4",
|
|
21
|
+
"@spree/dashboard-ui": "^1.0.0-rc.4",
|
|
22
|
+
"@spree/seller-dashboard": "^1.0.0-rc.5",
|
|
23
|
+
"@spree/seller-sdk": "^1.0.0-rc.4",
|
|
24
|
+
"@tanstack/react-query": "^5.104.3",
|
|
25
|
+
"@tanstack/react-router": "^1.170.44",
|
|
26
|
+
"i18next": "^26.4.7",
|
|
27
|
+
"react": "^19.3.1",
|
|
28
|
+
"react-dom": "^19.3.1",
|
|
29
|
+
"react-hook-form": "^7.90.0",
|
|
30
|
+
"react-i18next": "^17.0.20"
|
|
27
31
|
},
|
|
28
32
|
"devDependencies": {
|
|
29
33
|
"@biomejs/biome": "^2.4.14",
|
|
30
|
-
"@playwright/test": "^1.
|
|
34
|
+
"@playwright/test": "^1.64.1",
|
|
31
35
|
"@types/react": "^19.2.14",
|
|
32
36
|
"@types/react-dom": "^19.2.3",
|
|
33
37
|
"@vitejs/plugin-react": "^6.0.1",
|
|
34
|
-
"typescript": "~
|
|
35
|
-
"vite": "^8.
|
|
36
|
-
"vitest": "^
|
|
38
|
+
"typescript": "~7.0.2",
|
|
39
|
+
"vite": "^8.3.4",
|
|
40
|
+
"vitest": "^5.0.5"
|
|
37
41
|
},
|
|
38
42
|
"packageManager": "pnpm@11.13.1"
|
|
39
43
|
}
|
|
@@ -7,26 +7,27 @@
|
|
|
7
7
|
// before the panel renders.
|
|
8
8
|
//
|
|
9
9
|
// Keep this file a map of what you added: the registrations live here, the
|
|
10
|
-
// implementations live in pages/, hooks/, tables/ and schemas/ — one file per
|
|
10
|
+
// implementations live in slots/, pages/, hooks/, tables/ and schemas/ — one file per
|
|
11
11
|
// resource, the same layout the seller panel uses internally. Translations go
|
|
12
12
|
// in locales/ and merge in with `i18n.addResourceBundle`.
|
|
13
13
|
//
|
|
14
|
-
// Example — add a
|
|
14
|
+
// Example — add a card to the team screen and drop the built-in team entry
|
|
15
|
+
// from the navigation (the seller panel does not support new pages yet):
|
|
15
16
|
//
|
|
16
17
|
// import { defineDashboardPlugin } from '@spree/seller-dashboard'
|
|
17
|
-
// import {
|
|
18
|
+
// import { TeamAuditCard } from './slots/team-audit-card'
|
|
18
19
|
//
|
|
19
20
|
// defineDashboardPlugin({
|
|
20
|
-
// nav: {
|
|
21
|
-
// add: [{ key: 'payouts', label: 'Payouts', path: '/payouts', position: 300 }],
|
|
22
|
-
// remove: ['team'],
|
|
23
|
-
// },
|
|
21
|
+
// nav: { remove: ['team'] },
|
|
24
22
|
// slots: {
|
|
25
23
|
// 'seller.team.after': [{ id: 'audit', component: TeamAuditCard }],
|
|
26
24
|
// },
|
|
27
25
|
// })
|
|
28
26
|
//
|
|
29
|
-
// Slots the built-in screens expose: `seller.team.actions`, `seller.team.after
|
|
27
|
+
// Slots the built-in screens expose: `seller.team.actions`, `seller.team.after`,
|
|
28
|
+
// `seller.product.form_sidebar`, `seller.order.form_sidebar`,
|
|
29
|
+
// `seller.payout.form_sidebar`, `seller.profile.form_main`,
|
|
30
|
+
// `seller.profile.form_sidebar`.
|
|
30
31
|
//
|
|
31
32
|
// `@spree/dashboard-core` and `@spree/dashboard-ui` are already installed —
|
|
32
33
|
// import hooks, providers and UI primitives straight from them.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spree/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "CLI for managing Spree Commerce projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,29 +32,30 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@clack/prompts": "^1.8.0",
|
|
35
|
-
"commander": "^
|
|
35
|
+
"commander": "^15.0.0",
|
|
36
36
|
"console-table-printer": "^2.15.0",
|
|
37
|
-
"execa": "^
|
|
37
|
+
"execa": "^10.1.1",
|
|
38
38
|
"picocolors": "^1.1.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@changesets/changelog-github": "^0.
|
|
42
|
-
"@changesets/cli": "^
|
|
43
|
-
"@types/node": "^
|
|
44
|
-
"tsup": "^
|
|
45
|
-
"typescript": "^
|
|
46
|
-
"vitest": "^
|
|
41
|
+
"@changesets/changelog-github": "^1.0.1",
|
|
42
|
+
"@changesets/cli": "^3.0.3",
|
|
43
|
+
"@types/node": "^26.6.5",
|
|
44
|
+
"tsup": "^9.0.0",
|
|
45
|
+
"typescript": "^7.0.2",
|
|
46
|
+
"vitest": "^5.0.5",
|
|
47
47
|
"yaml": "^2.8.4",
|
|
48
|
-
"@spree/
|
|
48
|
+
"@spree/sdk-core": "0.1.0",
|
|
49
|
+
"@spree/admin-sdk": "^1.0.0-rc.4"
|
|
49
50
|
},
|
|
50
51
|
"engines": {
|
|
51
52
|
"node": ">=20"
|
|
52
53
|
},
|
|
53
54
|
"scripts": {
|
|
54
55
|
"build": "node scripts/bundle-spec.mjs && node ../../scripts/sync-starter.mjs templates/dashboard-starter && node ../../scripts/sync-starter.mjs templates/seller-dashboard-starter seller-dashboard-starter && tsup",
|
|
55
|
-
"dev": "tsup --watch",
|
|
56
|
-
"test": "vitest run",
|
|
57
|
-
"typecheck": "tsc --noEmit",
|
|
56
|
+
"dev": "node scripts/bundle-spec.mjs && tsup --watch",
|
|
57
|
+
"test": "node scripts/bundle-spec.mjs && vitest run",
|
|
58
|
+
"typecheck": "node scripts/bundle-spec.mjs && tsc --noEmit",
|
|
58
59
|
"lint": "biome check src tests",
|
|
59
60
|
"lint:fix": "biome check --fix src tests",
|
|
60
61
|
"format": "biome format --write src tests",
|