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.

Extract the dashboard host into a spree_dashboard gem

Damian Legawiec0cec7f4fe93a
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index d2767b000a..a8671609d2 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -56,7 +56,7 @@ jobs:
- name: Install all project dependencies
run: |
- for project in core api admin emails; do
+ for project in core api admin emails dashboard; do
echo "--- Installing gems for $project ---"
cd spree/$project
bundle config set --local path ${{ github.workspace }}/vendor/bundle
@@ -101,7 +101,7 @@ jobs:
- name: Install all project dependencies
run: |
- for project in core api admin emails; do
+ for project in core api admin emails dashboard; do
echo "--- Installing gems for $project ---"
cd spree/$project
bundle config set --local path ${{ github.workspace }}/vendor/bundle
@@ -131,6 +131,8 @@ jobs:
- { project: admin, shard: 1, total_shards: 1, procs: 4 }
# emails: 1 runner × 2 procs (tiny suite)
- { project: emails, shard: 1, total_shards: 1, procs: 2 }
+ # dashboard: 1 runner × 2 procs (tiny suite — SPA host)
+ - { project: dashboard, shard: 1, total_shards: 1, procs: 2 }
services:
postgres:
image: postgres:16
@@ -273,6 +275,8 @@ jobs:
- { project: admin, shard: 1, total_shards: 1, procs: 4 }
# emails: 1 runner × 2 procs
- { project: emails, shard: 1, total_shards: 1, procs: 2 }
+ # dashboard: 1 runner × 2 procs (tiny suite — SPA host)
+ - { project: dashboard, shard: 1, total_shards: 1, procs: 2 }
services:
mysql:
image: mysql:8.0
diff --git a/CLAUDE.md b/CLAUDE.md
index edee9f3211..23ae4e6295 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -69,6 +69,7 @@ Shipped plans:
| `spree/core` | Ruby gem — models, services, business logic (`spree_core`) |
| `spree/api` | Ruby gem — Store & Admin REST APIs (`spree_api`) |
| `spree/emails` | Ruby gem — transactional emails (optional). Deprecated in 6.0 — Next.js storefront handles consumer emails via webhooks. |
+| `spree/dashboard` | Ruby gem (`spree_dashboard`, optional) — hosts a built React Dashboard at `/dashboard` from `Spree::Dashboard.dist_path` / `SPREE_DASHBOARD_DIST_PATH` (single-node topology). Successor slot to `spree_admin` at 6.0. |
| `packages/dashboard` | `@spree/dashboard` — React SPA admin dashboard (Spree 6.0, replaces `spree/admin`). The deployable app shell, routes, schemas, resource hooks, locales. |
| `packages/dashboard-ui` | `@spree/dashboard-ui` — design system. Shadcn primitives + headless composed components + tokens. Source-only; consumer compiles via Vite/Tailwind. **Components are headless: data comes via props, no provider/hook imports.** |
| `packages/dashboard-core` | `@spree/dashboard-core` — framework. Registries (table, nav, slot, settings-nav), providers (auth, permission, store, theme), generic infra hooks, admin SDK client singleton, `defineDashboardPlugin` facade. The extension API for plugin authors. |
diff --git a/docs/developer/dashboard/deployment.mdx b/docs/developer/dashboard/deployment.mdx
index e690cf7cde..4d13fa7891 100644
--- a/docs/developer/dashboard/deployment.mdx
+++ b/docs/developer/dashboard/deployment.mdx
@@ -14,7 +14,7 @@ The dashboard deploys as **static files**. `vite build` produces `dist/` — HTM
The Spree server serves the dashboard itself at **`/dashboard`**: one container, one origin, zero CORS or cookie configuration. The official Spree Docker image ships with the stock dashboard baked in — deploy the image anywhere Docker runs (Render, Railway, AWS, Azure, your own host) and `https://your-api-host/dashboard` just works.
-Under the hood: `Spree::Config.dashboard_dist_path` (or the `SPREE_DASHBOARD_DIST_PATH` env var) points at a built `dist/` directory, and Spree serves it with SPA semantics — every dashboard route falls back to `index.html`, hashed assets get immutable caching. The bundle is built with a **relative API base** (`VITE_SPREE_API_URL` unset) and `base: /dashboard/`, so the same image works on every host and environment with no rebuild.
+Under the hood, the **`spree_dashboard` gem** (in the Gemfile of the starter and the official image) serves the directory in `Spree::Dashboard.dist_path` — or the `SPREE_DASHBOARD_DIST_PATH` env var — with SPA semantics: every dashboard route falls back to `index.html`, hashed assets get immutable caching. The bundle is built with a **relative API base** (`VITE_SPREE_API_URL` unset) and `base: /dashboard/`, so the same image works on every host and environment with no rebuild. API-only deployments simply omit the gem.
### Custom dashboard, single node
diff --git a/docs/plans/5.6-project-layout-and-dashboard.md b/docs/plans/5.6-project-layout-and-dashboard.md
index 88b9e6011e..8ac0ef2839 100644
--- a/docs/plans/5.6-project-layout-and-dashboard.md
+++ b/docs/plans/5.6-project-layout-and-dashboard.md
@@ -165,12 +165,12 @@ No credentials. The dashboard authenticates admins interactively — email/passw
The default production topology is **single node**: the Spree server serves the built dashboard at `/dashboard`, same origin as the Admin API — no CORS, `SameSite=Lax` cookies, one deployable. The pieces:
-- **Rails host** *(implemented)*: `Spree::Api::DashboardAppController` serves `Spree::Config.dashboard_dist_path` (env fallback `SPREE_DASHBOARD_DIST_PATH`) at `/dashboard` with SPA semantics — path fallback to `index.html` (no-cache), `assets/` immutable, traversal-guarded, 404 when unconfigured.
+- **Rails host** *(implemented)*: the **`spree_dashboard` gem** (opt-in via Gemfile; the successor slot to `spree_admin` at 6.0) serves `Spree::Dashboard.dist_path` (env fallback `SPREE_DASHBOARD_DIST_PATH`) at `/dashboard` with SPA semantics — path fallback to `index.html` (no-cache), `assets/` immutable, traversal-guarded, 404 when unconfigured. Deliberately host-only for the preview: vendoring the prebuilt stock dist inside the gem (`vendor/dist` fallback — zero-toolchain admin for gems-only Rails apps, dashboard version locked to the gem release) is an explicit **6.0 GA decision**, when the release cadences converge and the stock-admin merchant segment matters; during the preview it would couple fast dashboard iteration to gem releases for an audience that customizes immediately.
- **Basepath** *(implemented)*: builds take `VITE_BASE_PATH=/dashboard/` (Vite `base`), and `createDashboardRouter(routeTree, { basepath: import.meta.env.BASE_URL })` keeps the router aligned. `VITE_SPREE_API_URL` stays unset → the SDK emits origin-relative URLs, so one bundle works on every host/environment with no per-env rebuild.
- **Official image** *(pending, spree-starter repo)*: a multi-stage Dockerfile build — a Node stage extracts the stock dashboard template from the published `@spree/cli` tarball, `pnpm install`s the pinned `@spree/dashboard*` packages from npm, builds with `VITE_BASE_PATH=/dashboard/`; the final Rails stage copies only `dist/` and sets `SPREE_DASHBOARD_DIST_PATH`. No Node in the final image. Known caveat: the template pins `^0.x` carets with no lockfile, so image rebuilds can drift across dashboard patch releases — acceptable for the preview; exact-version build args are the later mitigation.
- **Ejected projects**: same stage shape, but `COPY apps/dashboard/` from the build context instead of extracting the template (requires widening the eject build context or compose `additional_contexts` — the wrapper's compose currently builds from `./backend`).
- **Render** *(implemented)*: `spree add dashboard` amends the project Blueprint's backend service instead of adding a static site — appends the dashboard build to `buildCommand` (Render's Ruby runtime includes Node; the repo is fully cloned even with `rootDir: backend`) and sets `SPREE_DASHBOARD_DIST_PATH=../apps/dashboard/dist`. Single service, builds the user's customized dashboard, zero manual steps. Unrecognized (hand-edited) Blueprints are left untouched with a docs pointer.
-- **6.0**: when the Classic Admin retires, the SPA moves from `/dashboard` to `/admin` and this becomes the default admin delivery. The static/CDN topology (see the deployment docs) remains the alternative for customized dashboards on independent release cadences.
+- **6.0**: the SPA stays at `/dashboard` permanently — `/admin` remains reserved for the Classic Admin (whether it retires or someone keeps maintaining it), so the dashboard URL is stable across upgrades with no route migration and no collision. `spree_dashboard` still becomes the default admin *delivery* at 6.0; only the path never changes. The static/CDN topology (see the deployment docs) remains the alternative for customized dashboards on independent release cadences.
### Scaffolding flow changes (`create-spree-app`)
diff --git a/spree/Rakefile b/spree/Rakefile
index e28f1c3e63..8217c2867e 100644
--- a/spree/Rakefile
+++ b/spree/Rakefile
@@ -8,7 +8,7 @@ rescue LoadError
end
SPREE_CORE_GEMS = %w(core api).freeze
-SPREE_OPTIONAL_GEMS = %w(emails admin).freeze
+SPREE_OPTIONAL_GEMS = %w(emails admin dashboard).freeze
task default: :test
diff --git a/spree/api/config/routes.rb b/spree/api/config/routes.rb
index 724dc31989..7a9b025edd 100644
--- a/spree/api/config/routes.rb
+++ b/spree/api/config/routes.rb
@@ -383,11 +383,4 @@ Spree::Core::Engine.add_routes do
end
end
end
-
- # Hosted React Dashboard (single-node topology). Serves the built SPA from
- # `Spree::Config.dashboard_dist_path`; 404s when unconfigured. `format: false`
- # keeps asset extensions (.js, .css, .svg) inside the splat instead of being
- # parsed as a response format.
- get '/dashboard', to: 'api/dashboard_app#show', as: :dashboard_app
- get '/dashboard/*path', to: 'api/dashboard_app#show', format: false
end
diff --git a/spree/core/lib/spree/core/configuration.rb b/spree/core/lib/spree/core/configuration.rb
index 3c415ee67d..61d7f66010 100644
--- a/spree/core/lib/spree/core/configuration.rb
+++ b/spree/core/lib/spree/core/configuration.rb
@@ -43,12 +43,6 @@ module Spree
preference :company, :boolean, default: false, deprecated: 'Use the company_field_enabled preference in the Spree::Store model' # Request company field for billing and shipping addr
preference :currency, :string, default: 'USD', deprecated: true
preference :credit_to_new_allocation, :boolean, default: false
- # Directory holding a built React Dashboard (`vite build` output). When
- # set (or via the SPREE_DASHBOARD_DIST_PATH env var, which the official
- # Docker image uses), the app serves the SPA at /dashboard — the
- # single-node topology: same origin as the Admin API, so no CORS or
- # cookie configuration. Unset, /dashboard 404s.
- preference :dashboard_dist_path, :string, default: nil
preference :disable_migration_check, :boolean, default: false # when turned on disables the startup warning about missing engine migrations
preference :enable_legacy_default_price, :boolean, default: false # when enabled, keeps the legacy DefaultPrice concern active (has_one :default_price, variant.price= delegation, check_price validation). Disable (default) to use set_price exclusively.
preference :disable_sku_validation, :boolean, default: false # when turned off disables the built-in SKU uniqueness validation
diff --git a/spree/dashboard/Gemfile b/spree/dashboard/Gemfile
new file mode 100644
index 0000000000..2e9d1966b8
--- /dev/null
+++ b/spree/dashboard/Gemfile
@@ -0,0 +1,7 @@
+eval_gemfile('../common_spree_dependencies.rb')
+
+gem 'spree', path: '../'
+
+gem 'sprockets-rails', '>= 3.5.2'
+
+gemspec
diff --git a/spree/dashboard/README.md b/spree/dashboard/README.md
new file mode 100644
index 0000000000..5b27e6f5b9
--- /dev/null
+++ b/spree/dashboard/README.md
@@ -0,0 +1,41 @@
+# spree_dashboard
+
+Hosts the [Spree React Dashboard](https://spreecommerce.org/docs/developer/dashboard/overview) from your Spree server — the **single-node topology**: the dashboard and the Admin API share one origin, so there are no CORS entries to maintain and auth cookies stay `SameSite=Lax`.
+
+> **Developer Preview.** In Spree 6 this gem becomes the default admin delivery. The path is permanent: the dashboard lives at `/dashboard`, and `/admin` stays reserved for the classic `spree_admin`.
+
+## What it does
+
+Serves a built dashboard (`vite build` output) at **`/dashboard`** with SPA semantics: every dashboard route falls back to `index.html` (no-cache), Vite's content-hashed `assets/` get immutable caching, and paths are traversal-guarded. The bundle is public client code, so there's no authentication on the route — the SPA authenticates its API calls itself.
+
+## Setup
+
+```ruby
+# Gemfile
+gem 'spree_dashboard'
+```
+
+Point it at a built dashboard, either via env (what the official Docker image and the Render Blueprint use):
+
+```bash
+SPREE_DASHBOARD_DIST_PATH=/rails/dashboard
+```
+
+or an initializer:
+
+```ruby
+# config/initializers/spree.rb
+Spree::Dashboard.dist_path = Rails.root.join('dashboard/dist').to_s
+```
+
+Unset, `/dashboard` responds 404.
+
+The bundle must be built for sub-path mounting with a relative API base: `VITE_BASE_PATH=/dashboard/ pnpm build` (and `VITE_SPREE_API_URL` unset) — see the [deployment docs](https://spreecommerce.org/docs/developer/dashboard/deployment) for the full picture, including baking it into a Docker image.
+
+## Testing
+
+```bash
+bundle install
+bundle exec rake test_app # generates the dummy app (skip if present)
+bundle exec rspec
+```
diff --git a/spree/dashboard/Rakefile b/spree/dashboard/Rakefile
new file mode 100644
index 0000000000..128d8916ea
--- /dev/null
+++ b/spree/dashboard/Rakefile
@@ -0,0 +1,15 @@
+require 'rubygems'
+require 'rake'
+require 'rake/testtask'
+require 'rspec/core/rake_task'
+require 'spree/testing_support/common_rake'
+
+RSpec::Core::RakeTask.new
+
+task default: :spec
+
+desc "Generates a dummy app for testing"
+task :test_app do
+ ENV['LIB_NAME'] = 'spree/dashboard'
+ Rake::Task['common:test_app'].invoke
+end
diff --git a/spree/api/app/controllers/spree/api/dashboard_app_controller.rb b/spree/dashboard/app/controllers/spree/dashboard/app_controller.rb
similarity index 86%
rename from spree/api/app/controllers/spree/api/dashboard_app_controller.rb
rename to spree/dashboard/app/controllers/spree/dashboard/app_controller.rb
index 7eaa4ee641..f3f7de5068 100644
--- a/spree/api/app/controllers/spree/api/dashboard_app_controller.rb
+++ b/spree/dashboard/app/controllers/spree/dashboard/app_controller.rb
@@ -1,17 +1,17 @@
module Spree
- module Api
+ module Dashboard
# Serves a built React Dashboard (`vite build` output) at /dashboard — the
# single-node topology: the SPA and the Admin API share one origin, so no
# CORS entries and Lax cookies. The dist directory comes from
- # `Spree::Config.dashboard_dist_path` (the official Docker image sets it
- # via SPREE_DASHBOARD_DIST_PATH); when unset, /dashboard 404s.
+ # `Spree::Dashboard.dist_path` (the official Docker image sets it via
+ # SPREE_DASHBOARD_DIST_PATH); when unset, /dashboard 404s.
#
# SPA semantics: real files are served with long-lived caching (Vite's
# `assets/` are content-hashed, so they're immutable); every other path
# falls back to index.html with no-cache so deploys take effect on the
# next navigation. No authentication — the bundle is public client code;
# the SPA authenticates its API calls itself.
- class DashboardAppController < ActionController::API
+ class AppController < ActionController::API
def show
root = dist_root
return head :not_found unless root
@@ -30,7 +30,7 @@ module Spree
private
def dist_root
- path = Spree::Config.dashboard_dist_path.presence || ENV.fetch('SPREE_DASHBOARD_DIST_PATH', nil)
+ path = Spree::Dashboard.dist_path
return if path.blank?
root = Pathname.new(path).expand_path
diff --git a/spree/dashboard/config/routes.rb b/spree/dashboard/config/routes.rb
new file mode 100644
index 0000000000..98b31d5226
--- /dev/null
+++ b/spree/dashboard/config/routes.rb
@@ -0,0 +1,8 @@
+Spree::Core::Engine.add_routes do
+ # Hosted React Dashboard (single-node topology). Serves the built SPA from
+ # `Spree::Dashboard.dist_path`; 404s when unconfigured. `format: false`
+ # keeps asset extensions (.js, .css, .svg) inside the splat instead of
+ # being parsed as a response format.
+ get '/dashboard', to: 'dashboard/app#show', as: :dashboard_app
+ get '/dashboard/*path', to: 'dashboard/app#show', format: false
+end
diff --git a/spree/dashboard/lib/spree/dashboard.rb b/spree/dashboard/lib/spree/dashboard.rb
new file mode 100644
index 0000000000..273094e336
--- /dev/null
+++ b/spree/dashboard/lib/spree/dashboard.rb
@@ -0,0 +1,19 @@
+require 'spree'
+
+module Spree
+ module Dashboard
+ class << self
+ # Directory holding a built React Dashboard (`vite build` output),
+ # served at /dashboard. Set from an initializer, or via the
+ # SPREE_DASHBOARD_DIST_PATH env var (which the official Docker image
+ # and the Render Blueprint use). Unset, /dashboard responds 404.
+ attr_writer :dist_path
+
+ def dist_path
+ @dist_path.presence || ENV.fetch('SPREE_DASHBOARD_DIST_PATH', nil)
+ end
+ end
+ end
+end
+
+require 'spree/dashboard/engine'
diff --git a/spree/dashboard/lib/spree/dashboard/engine.rb b/spree/dashboard/lib/spree/dashboard/engine.rb
new file mode 100644
index 0000000000..cdac9db4c4
--- /dev/null
+++ b/spree/dashboard/lib/spree/dashboard/engine.rb
@@ -0,0 +1,10 @@
+require 'rails/engine'
+
+module Spree
+ module Dashboard
+ class Engine < Rails::Engine
+ isolate_namespace Spree
+ engine_name 'spree_dashboard'
+ end
+ end
+end
diff --git a/spree/dashboard/lib/spree_dashboard.rb b/spree/dashboard/lib/spree_dashboard.rb
new file mode 100644
index 0000000000..eb21c6b126
--- /dev/null
+++ b/spree/dashboard/lib/spree_dashboard.rb
@@ -0,0 +1 @@
+require 'spree/dashboard'
diff --git a/spree/api/spec/requests/spree/api/dashboard_app_spec.rb b/spree/dashboard/spec/requests/spree/dashboard/app_spec.rb
similarity index 77%
rename from spree/api/spec/requests/spree/api/dashboard_app_spec.rb
rename to spree/dashboard/spec/requests/spree/dashboard/app_spec.rb
index 01f3fcba35..fe19631d89 100644
--- a/spree/api/spec/requests/spree/api/dashboard_app_spec.rb
+++ b/spree/dashboard/spec/requests/spree/dashboard/app_spec.rb
@@ -12,18 +12,18 @@ RSpec.describe 'Hosted React Dashboard', type: :request do
after do
FileUtils.remove_entry(dist)
- Spree::Config.dashboard_dist_path = nil
+ Spree::Dashboard.dist_path = nil
end
- context 'when dashboard_dist_path is not configured' do
+ context 'when dist_path is not configured' do
it 'returns 404' do
get '/dashboard'
expect(response).to have_http_status(:not_found)
end
end
- context 'when dashboard_dist_path is configured' do
- before { Spree::Config.dashboard_dist_path = dist }
+ context 'when dist_path is configured' do
+ before { Spree::Dashboard.dist_path = dist }
it 'serves index.html at the root with no-cache' do
get '/dashboard'
@@ -62,15 +62,26 @@ RSpec.describe 'Hosted React Dashboard', type: :request do
secret = File.expand_path(File.join(dist, '..', "spree-secret-#{Process.pid}.txt"))
File.write(secret, 'top secret')
- get '/dashboard/%2e%2e/' + File.basename(secret)
+ get "/dashboard/%2e%2e/#{File.basename(secret)}"
expect(response.body).not_to include('top secret')
ensure
FileUtils.rm_f(secret)
end
+ it 'reads the dist path from the environment when unset' do
+ Spree::Dashboard.dist_path = nil
+ ENV['SPREE_DASHBOARD_DIST_PATH'] = dist
+
+ get '/dashboard'
+ expect(response).to have_http_status(:ok)
+ expect(response.body).to include('dashboard shell')
+ ensure
+ ENV.delete('SPREE_DASHBOARD_DIST_PATH')
+ end
+
it 'returns 404 when the configured directory does not exist' do
- Spree::Config.dashboard_dist_path = File.join(dist, 'missing')
+ Spree::Dashboard.dist_path = File.join(dist, 'missing')
get '/dashboard'
expect(response).to have_http_status(:not_found)
diff --git a/spree/dashboard/spec/spec_helper.rb b/spree/dashboard/spec/spec_helper.rb
new file mode 100644
index 0000000000..05ac8350c3
--- /dev/null
+++ b/spree/dashboard/spec/spec_helper.rb
@@ -0,0 +1,92 @@
+if ENV['COVERAGE']
+ require 'simplecov'
+ require 'simplecov-cobertura'
+ SimpleCov.root(ENV.fetch('GITHUB_WORKSPACE', File.expand_path('../../..', __dir__)))
+ SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
+ SimpleCov.start 'rails' do
+ add_group 'Models', 'app/models'
+ add_group 'Mailers', 'app/mailers'
+ add_group 'Helpers', 'app/helpers'
+
+ add_filter '/app/assets/'
+ add_filter '/app/views/'
+ add_filter '/bin/'
+ add_filter '/config/'
+ add_filter '/db/'
+ add_filter '/lib/generators/'
+ add_filter '/lib/spree/testing_support/'
+ add_filter '/lib/tasks/'
+ add_filter '/script/'
+ add_filter '/spec/'
+
+ suffix = [ENV.fetch('CI_SHARD', '1'), ENV['TEST_ENV_NUMBER']].compact.reject(&:empty?).join('_')
+ if ENV['COVERAGE_DIR']
+ coverage_dir "#{ENV['COVERAGE_DIR']}/dashboard_#{suffix}"
+ end
+ command_name "dashboard_shard_#{suffix}"
+ end
+end
+
+# This file is copied to ~/spec when you run 'ruby script/generate rspec'
+# from the project root directory.
+ENV['RAILS_ENV'] ||= 'test'
+
+begin
+ require File.expand_path('../dummy/config/environment', __FILE__)
+rescue LoadError
+ puts 'Could not load dummy application. Please ensure you have run `bundle exec rake test_app`'
+end
+
+require 'rspec/rails'
+require 'database_cleaner/active_record'
+require 'ffaker'
+
+Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
+
+require 'spree/testing_support/i18n' if ENV['CHECK_TRANSLATIONS']
+
+require 'spree/testing_support/factories'
+require 'spree/testing_support/jobs'
+require 'spree/testing_support/store'
+require 'spree/testing_support/preferences'
+require 'spree/testing_support/url_helpers'
+require 'spree/testing_support/kernel'
+require 'spree/testing_support/rspec_retry_config'
+
+RSpec.configure do |config|
+ config.color = true
+ config.default_formatter = 'progress'
+ config.fail_fast = ENV['FAIL_FAST'] || false
+ config.infer_spec_type_from_file_location!
+ config.mock_with :rspec
+ config.raise_errors_for_deprecations!
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, comment the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+
+ config.before(:suite) do
+ Spree::Events.disable!
+ # Clean out the database state before the tests run
+ DatabaseCleaner.clean_with(:truncation)
+ end
+
+ # Re-enable events for specs that need them
+ config.around(:each, events: true) do |example|
+ Spree::Events.enable { example.run }
+ end
+
+ config.before(:each) do
+ reset_spree_preferences
+ I18n.locale = :en
+ ActionMailer::Base.default_url_options = {}
+ end
+
+ config.include FactoryBot::Syntax::Methods
+ config.include Spree::TestingSupport::Preferences
+ config.include Spree::TestingSupport::Kernel
+
+ config.order = :random
+ Kernel.srand config.seed
+end
diff --git a/spree/dashboard/spree_dashboard.gemspec b/spree/dashboard/spree_dashboard.gemspec
new file mode 100644
index 0000000000..5d78f6ce52
--- /dev/null
+++ b/spree/dashboard/spree_dashboard.gemspec
@@ -0,0 +1,29 @@
+# encoding: UTF-8
+
+require_relative '../core/lib/spree/core/version.rb'
+
+Gem::Specification.new do |s|
+ s.platform = Gem::Platform::RUBY
+ s.name = 'spree_dashboard'
+ s.version = Spree.version
+ s.authors = ['Vendo Connect Inc.']
+ s.email = '[email protected]'
+ s.summary = 'Hosts the Spree React Dashboard from your Spree server'
+ s.description = 'Serves a built Spree React Dashboard at /dashboard with SPA semantics — the single-node topology where the dashboard and the Admin API share one origin. Developer Preview; becomes the default admin delivery in Spree 6.'
+ s.homepage = 'https://spreecommerce.org'
+ s.license = 'BSD-3-Clause'
+
+ s.metadata = {
+ "bug_tracker_uri" => "https://github.com/spree/spree/issues",
+ "changelog_uri" => "https://github.com/spree/spree/releases/tag/v#{s.version}",
+ "documentation_uri" => "https://spreecommerce.org/docs/developer/dashboard/deployment",
+ "source_code_uri" => "https://github.com/spree/spree/tree/v#{s.version}",
+ }
+
+ s.required_ruby_version = '>= 3.2'
+
+ s.files = Dir["{app,config,lib,vendor}/**/*", "Rakefile", "README.md"].reject { |f| f.match(/^spec/) }
+ s.require_path = 'lib'
+
+ s.add_dependency 'spree', ">= #{s.version}"
+end