@spree/docs 0.1.294 → 0.1.296

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.
@@ -76,14 +76,6 @@ spree restart
76
76
 
77
77
  Not appropriate for Gemfile changes (use `spree bundle install`, then Ctrl+C and re-run `spree dev`), Dockerfile / `.ruby-version` changes (use `spree build`), or compose file changes (Ctrl+C and re-run `spree dev`).
78
78
 
79
- ### `spree update`
80
-
81
- Pull the latest Spree Docker image and recreate containers. Migrations run automatically on startup.
82
-
83
- ```bash
84
- spree update
85
- ```
86
-
87
79
  ### `spree build`
88
80
 
89
81
  Rebuild the dev image after Dockerfile or `.ruby-version` changes. Only relevant after `spree eject`.
@@ -100,17 +92,27 @@ spree build --yes # Skip confirmation prompts (for CI)
100
92
 
101
93
  ### `spree upgrade`
102
94
 
103
- Walk a Spree version upgrade end-to-end inside the dev stack. Runs `bundle update`, applies pending migrations, then walks the version-specific data backfills from the upgrade manifest.
95
+ Upgrade your project to the latest Spree release in one go. It works for both kinds of project:
96
+
97
+ 1. **Update the server**
98
+ - On a project that runs the prebuilt image, it pulls the latest Spree image and recreates the containers. Database migrations run as the containers start.
99
+ - On an [ejected](#spree-eject) project, it updates the Spree gems with `bundle update`, applies pending migrations, and restarts the app so it loads the new gems.
100
+ 2. **Run data backfills** — the version-specific steps from the upgrade manifest that convert existing records.
101
+ 3. **Update the `@spree/*` packages** — `@spree/cli` in the project root, and the dashboard packages and Admin SDK in `apps/dashboard` and `apps/seller-dashboard`. Each package moves to the newest release its declared range in `package.json` allows, the same way `bundle update` respects your `Gemfile`. To move to a new major version, change the range in `package.json` first.
104
102
 
105
103
  ```bash
106
- spree upgrade # Detect target, run the full sequence interactively
107
- spree upgrade --plan # Print the plan without executing (DRY_RUN=1)
108
- spree upgrade --to 5.5 # Cap the walk at a specific target version
109
- spree upgrade --step <id> # Re-run a single step idempotently (skips bundle + migrate)
110
- spree upgrade --yes # Skip the per-step prompts
104
+ spree upgrade # Run every step, asking before each one
105
+ spree upgrade --plan # List the data backfills without running anything
106
+ spree upgrade --to 6.1 # Set the target version for the data backfills
107
+ spree upgrade --step <id> # Re-run a single data backfill (runs nothing else)
108
+ spree upgrade --yes # Skip the prompts
111
109
  ```
112
110
 
113
- Production upgrades only need the third stage — `bundle install` and `db:migrate` happen in your deploy pipeline. The CLI runs all three for local development. See [Upgrades](../upgrades.md) for the manual production path.
111
+ Your storefront is your own code, so `spree upgrade` does not change it — it tells you which `@spree/sdk` version to move to.
112
+
113
+ Production upgrades only need the data backfills — installing gems and migrating happen in your deploy pipeline. See [Upgrades](../upgrades.md) for the manual production path.
114
+
115
+ > **NOTE:** `spree update` is the old name for this command. It still works, prints a deprecation warning, and will be removed in a future release.
114
116
 
115
117
  ### `spree eject`
116
118
 
@@ -204,7 +206,7 @@ spree encryption init # Add ACTIVE_RECORD_ENCRYPTION_* keys to the pr
204
206
  spree encryption init --print # Print a fresh set without writing anything (e.g. for your hosting provider)
205
207
  ```
206
208
 
207
- It never overwrites keys `.env` already sets, and there is no `--force`: changing the keys makes data encrypted with them unreadable. Afterwards, recreate the containers so they load the new `.env` (`spree update`, or `spree dev` for an ejected project — `spree restart` keeps the old environment), and back the keys up in your secret manager.
209
+ It never overwrites keys `.env` already sets, and there is no `--force`: changing the keys makes data encrypted with them unreadable. Afterwards, recreate the containers so they load the new `.env` (`spree dev` — `spree restart` keeps the old environment), and back the keys up in your secret manager.
208
210
 
209
211
  ### `spree api`
210
212
 
@@ -111,7 +111,7 @@ The project includes [@spree/cli](../cli/quickstart.md) for managing your Spree
111
111
  |---------|-------------|
112
112
  | `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 |
113
113
  | `spree stop` | Stop backend services |
114
- | `spree update` | Pull latest Spree image and restart (runs migrations automatically) |
114
+ | `spree upgrade` | Upgrade Spree — the server, database and `@spree/*` packages |
115
115
  | `spree eject` | Switch from prebuilt image to building from `server/` |
116
116
  | `spree add dashboard` | Add the Admin Dashboard to an existing project, to customize it |
117
117
  | `spree add seller-dashboard` | Add the marketplace seller panel to an existing project |
@@ -148,10 +148,10 @@ Open [http://localhost:3001](http://localhost:3001) to see your store.
148
148
  To update to the latest Spree version:
149
149
 
150
150
  ```bash
151
- spree update
151
+ spree upgrade
152
152
  ```
153
153
 
154
- This pulls the latest Docker image and recreates the containers. The entrypoint automatically runs database migrations.
154
+ This updates the server (the Docker image, or the Spree gems on an ejected project), runs database migrations and data backfills, and updates the `@spree/*` packages of the project and its dashboard apps. See [`spree upgrade`](../cli/quickstart.md#spree-upgrade) for details.
155
155
 
156
156
  To pin a specific version, edit `SPREE_VERSION_TAG` in `.env`:
157
157
 
@@ -42,7 +42,8 @@ Each object's fields, and the fields of the objects nested in it.
42
42
 
43
43
  ### `store`
44
44
 
45
- - `store`: `id`, `name`, `address`, `mail_from_address`, `default_currency`, `default_locale`, `url`, `support_email`, `logo_url`, `logo_width`
45
+ - `store`: `id`, `name`, `address`, `mail_from_address`, `default_currency`, `default_locale`, `url`, `support_email`, `logo_url`, `logo_width`, `branding`
46
+ - `store.branding`: `background_color`, `card_color`, `text_color`, `heading_color`, `accent_color` (empty unless the merchant set one), `link_color`, `button_color`, `button_text_color`, `button_border`, `font`, `font_family`, `heading_font_family`, `font_url` (a web font's stylesheet, empty for email-safe fonts)
46
47
 
47
48
  ### `order`
48
49
 
@@ -8,7 +8,7 @@ Every email Spree sends — order confirmations, shipping notices, password rese
8
8
 
9
9
  To change an email, you copy its template into your app and edit it. Nothing else changes: Spree still picks the recipient, the language and the sender, and delivers the email through your [SMTP provider](../providers/emails.md).
10
10
 
11
- > **NOTE:** Templates read plain data — the same fields the [Store API](../../api-reference/store-api/introduction.md) returns, plus what only an email needs — never Ruby objects. The same template can later run outside Ruby, and merchants will be able to edit templates safely from the dashboard.
11
+ > **NOTE:** Templates read plain data — the same fields the [Store API](../../api-reference/store-api/introduction.md) returns, plus what only an email needs — never Ruby objects. The same template can run outside Ruby, and merchants can edit customer emails safely from the dashboard.
12
12
 
13
13
  ## Where templates live
14
14
 
@@ -102,6 +102,73 @@ In development and test, a variable that does not exist raises an error instead
102
102
 
103
103
  To look at every email with real data, open the mailer previews at `/rails/mailers` on your Spree server.
104
104
 
105
+ ## Templates merchants edit in the dashboard
106
+
107
+ Merchants can edit the emails their customers receive in **Settings → Emails → Templates**, along with the layout and the shared blocks in `spree/shared`. An edit is saved as a draft and goes live when published; publishing renders it with the store's own data first and refuses a template that does not render. An email built from a record the store does not have yet, such as an order confirmation in a store with no orders, is checked for template syntax only. Staff, store-owner and seller emails are not editable and always render from files.
108
+
109
+ A store's published template comes first, so the lookup for an editable email is:
110
+
111
+ 1. the store's published template in the email's language
112
+ 2. the store's published template for every language
113
+ 3. your app's file
114
+ 4. Spree's file
115
+
116
+ Your file stays the default the dashboard starts from and reverts to, so overriding a template in code and letting merchants edit it work together. When a Spree upgrade or a change to your file alters a default a merchant has customized, the dashboard tells them and shows what changed.
117
+
118
+ The same operations are open to integrations through the [Admin API](../../api-reference/admin-api/introduction.md), with the `email_templates` permission:
119
+
120
+ **Admin SDK:**
121
+
122
+ ```typescript
123
+ const preview = await client.emailTemplates.preview('spree.order_mailer.confirm_email', {
124
+ body: '<mj-section><mj-column><mj-text>Thanks, {{ order.customer_name }}!</mj-text></mj-column></mj-section>',
125
+ })
126
+
127
+ await client.emailTemplates.draft.update('spree.order_mailer.confirm_email', {
128
+ body: '<mj-section><mj-column><mj-text>Thanks, {{ order.customer_name }}!</mj-text></mj-column></mj-section>',
129
+ })
130
+ await client.emailTemplates.publish('spree.order_mailer.confirm_email')
131
+ ```
132
+
133
+ **cURL:**
134
+
135
+ ```bash
136
+ curl -X PUT https://your-store.com/api/v3/admin/email_templates/spree.order_mailer.confirm_email/draft \
137
+ -H "X-Spree-Api-Key: sk_xxx" -H "Content-Type: application/json" \
138
+ -d '{"body": "<mj-section><mj-column><mj-text>Thanks, {{ order.customer_name }}!</mj-text></mj-column></mj-section>"}'
139
+
140
+ curl -X POST https://your-store.com/api/v3/admin/email_templates/spree.order_mailer.confirm_email/publication \
141
+ -H "X-Spree-Api-Key: sk_xxx"
142
+ ```
143
+
144
+
145
+ ### Branding
146
+
147
+ Merchants set the colors and font of their customer emails in **Settings → Emails**, without touching a template. Templates read them from [`store.branding`](email-variables.md#store), and Spree's layout uses them throughout. If you override the layout or a template, read colors and fonts from `store.branding` rather than writing them in, so a store's branding keeps applying.
148
+
149
+ ### Making your own customer email editable
150
+
151
+ A customer email your app adds can be edited like Spree's own. Register it with a class that builds the data its preview renders with:
152
+
153
+ ```ruby server/config/initializers/spree.rb
154
+ Rails.application.config.after_initialize do
155
+ Spree.editable_email_templates.register(
156
+ 'spree/review_mailer/request_email', kind: :email, sample: 'ReviewRequestSample'
157
+ )
158
+ end
159
+ ```
160
+
161
+ ```ruby server/app/services/review_request_sample.rb
162
+ # Previews with the store's latest completed order, or the one the merchant picks.
163
+ class ReviewRequestSample < Spree::Emails::Samples::Order
164
+ def variables
165
+ { order: super[:order], review_url: placeholder_url('reviews/new') }
166
+ end
167
+ end
168
+ ```
169
+
170
+ A sample builds from the record the merchant picked, else the store's latest one; a store with none is told there is nothing to preview with yet. Pass placeholder URLs, never real tokens, and register only emails your customers receive.
171
+
105
172
  ## Your own mailers
106
173
 
107
174
  A mailer that inherits `Spree::BaseMailer` and renders its own ERB views with `mail` keeps working. Spree wraps its HTML in the same layout as every other email, so it carries the store's logo, header and footer. The `spree/shared/mailer_hero` and `spree/shared/mailer_button` partials are still there for those views.
@@ -226,7 +226,7 @@ bin/rails db:encryption:init # prints a set; put it in env vars or encrypted
226
226
  ```
227
227
 
228
228
 
229
- Recreate the containers so they pick up the new `.env` (`spree update`, or `spree dev` for an ejected project — `spree restart` keeps the old environment). Set the keys on your production host **before** deploying, and store them in your secret manager.
229
+ Recreate the containers so they pick up the new `.env` (`spree dev` — `spree restart` keeps the old environment). Set the keys on your production host **before** deploying, and store them in your secret manager.
230
230
 
231
231
  > **WARNING:** Never change or lose the keys once data is encrypted — the encrypted records become unreadable.
232
232
 
@@ -9,6 +9,38 @@ The upgrade process is fairly easy and well described. Of course, it all boils d
9
9
 
10
10
  We strongly advise upgrading Spree incrementally, rather than in one big go.
11
11
 
12
+ ## How to upgrade
13
+
14
+ An upgrade updates the server, migrates the database, runs the version's data backfills, and updates the `@spree/*` packages of your dashboard apps. Always read the guide for the version you're moving to first — it lists the behavior changes to review.
15
+
16
+ **Spree CLI:**
17
+
18
+ ```bash
19
+ spree upgrade
20
+ ```
21
+
22
+ One command for every project: it pulls the new image, or updates the Spree gems on an [ejected](../cli/quickstart.md#spree-eject) project, then runs migrations, data backfills and the package updates. See [`spree upgrade`](../cli/quickstart.md#spree-upgrade) for its options.
23
+
24
+ **Without CLI:**
25
+
26
+ Run from the project root:
27
+
28
+ ```bash
29
+ cd server
30
+ bundle update $(bundle list --name-only | grep ^spree)
31
+ bin/rails spree:install:migrations db:migrate
32
+ bin/rails spree:upgrade
33
+ cd ..
34
+
35
+ # The project root and each dashboard app have their own package.json
36
+ pnpm update "@spree/*"
37
+ (cd apps/dashboard && pnpm update "@spree/*")
38
+ (cd apps/seller-dashboard && pnpm update "@spree/*")
39
+ ```
40
+
41
+ On npm or Yarn, run `npm update` or `yarn upgrade` instead, naming each `@spree/*` package from that `package.json` (they do not accept the `"@spree/*"` pattern).
42
+
43
+
12
44
  ## Support
13
45
 
14
46
  If you're stuck and would want to get some professional help, you can [contact us directly](https://spreecommerce.org/contact/) and request a quote for our consulting services.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spree/docs",
3
- "version": "0.1.294",
3
+ "version": "0.1.296",
4
4
  "description": "Spree Commerce developer documentation for AI agents and local reference",
5
5
  "type": "module",
6
6
  "license": "CC-BY-4.0",