trek 2.5.0 → 2.7.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.
- checksums.yaml +4 -4
- data/.node-version +1 -1
- data/AGENTS.md +18 -14
- data/CHANGELOG.md +88 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +135 -124
- data/Makefile +9 -1
- data/README.md +17 -21
- data/app/components/trek/dashboard/tile_component/tile_component.css +9 -0
- data/app/components/trek/dashboard/tile_component/tile_component.html.slim +4 -2
- data/app/components/trek/dashboard/tile_component.rb +12 -2
- data/app/components/trek/form/content_editor_component/content_editor_component.css +9 -8
- data/app/components/trek/form/content_editor_component/content_editor_component.html.slim +19 -93
- data/app/components/trek/form/content_editor_component/content_editor_component.js +94 -251
- data/app/components/trek/form/content_editor_component/extensions/block_view.js +40 -0
- data/app/components/trek/form/content_editor_component/extensions/image_block.js +28 -26
- data/app/components/trek/form/content_editor_component/extensions/prompts_block.js +15 -26
- data/app/components/trek/form/content_editor_component/extensions/table_of_contents.js +1 -3
- data/app/components/trek/form/content_editor_component.rb +15 -0
- data/app/components/trek/form/image_field_component/image_field_component.css +40 -1
- data/app/components/trek/form/image_field_component/image_field_component.html.slim +0 -9
- data/app/components/trek/form/image_field_component/image_field_component.js +1 -2
- data/app/components/trek/form/image_field_component.rb +36 -9
- data/app/components/trek/form/password_strength_component/password_strength_component.css +2 -0
- data/app/components/trek/form/sound_field_component/sound_field_component.js +1 -2
- data/app/components/trek/security_check_component/security_check_component.css +69 -0
- data/app/components/trek/security_check_component/security_check_component.html.slim +19 -0
- data/app/components/trek/security_check_component/security_check_component.js +15 -0
- data/app/components/trek/security_check_component.rb +19 -0
- data/app/content/trek/content/cleaner.rb +53 -0
- data/app/content/trek/content/document.rb +2 -2
- data/app/content/trek/content/list_item.rb +1 -1
- data/app/content/trek/content/paragraph.rb +7 -2
- data/app/content/trek/content/prompts_block.rb +1 -2
- data/app/content/trek/content.rb +6 -0
- data/app/controllers/concerns/trek/auditable.rb +5 -2
- data/app/controllers/concerns/trek/localization.rb +6 -2
- data/app/controllers/concerns/trek/reorderable.rb +24 -6
- data/app/controllers/trek/csp_reports_controller.rb +14 -1
- data/app/controllers/trek/panels/prompts_controller.rb +1 -1
- data/app/controllers/trek/resource_controller.rb +5 -5
- data/app/jobs/trek/purge_expired_sessions_job.rb +4 -3
- data/app/jobs/trek/purge_expired_sign_in_codes_job.rb +15 -0
- data/app/models/concerns/trek/contentable.rb +15 -1
- data/app/models/concerns/trek/users/sign_in_code.rb +70 -0
- data/app/models/concerns/trek/users/sign_in_lockout.rb +4 -2
- data/app/policies/trek/security_check_policy.rb +8 -0
- data/app/uploaders/image_uploader.rb +77 -15
- data/app/views/trek/panels/links/_form.html.slim +2 -4
- data/app/views/trek/panels/prompts/create.turbo_stream.slim +0 -1
- data/config/locales/trek.en.yml +97 -11
- data/config/locales/trek.fr.yml +97 -11
- data/docs/.vitepress/config.mjs +5 -1
- data/docs/background-jobs.md +74 -0
- data/docs/content-editor.md +219 -0
- data/docs/customize.md +2 -0
- data/docs/deploy.md +69 -6
- data/docs/getting-started.md +16 -18
- data/docs/index.md +2 -2
- data/docs/personal-data.md +61 -0
- data/docs/proxies.md +2 -2
- data/docs/reference/components.md +4 -4
- data/docs/reference/concerns/contentable.md +10 -4
- data/docs/reference/concerns/formattable.md +1 -1
- data/docs/reference/concerns/fragmentable.md +12 -6
- data/docs/reference/concerns/orderable.md +2 -2
- data/docs/reference/concerns/search-engine-optimizable.md +1 -1
- data/docs/reference/concerns/searchable.md +14 -1
- data/docs/reference/concerns/sectionable.md +7 -3
- data/docs/reference/concerns/versionable.md +1 -1
- data/docs/reference/controllers.md +33 -1
- data/docs/reference/environment-variables.md +3 -2
- data/docs/reference/formatters.md +4 -31
- data/docs/reference/forms.md +7 -4
- data/docs/reference/generators/admin-user.md +1 -1
- data/docs/reference/generators/audit-log.md +12 -13
- data/docs/reference/generators/install.md +23 -11
- data/docs/reference/generators/public-accounts.md +159 -0
- data/docs/reference/generators/scaffold.md +28 -9
- data/docs/reference/generators/security-headers.md +5 -4
- data/docs/reference/generators/taxonomies.md +1 -1
- data/docs/reference/icons.md +5 -3
- data/docs/reference/index.md +10 -7
- data/docs/reference/models/current.md +5 -3
- data/docs/reference/models/page-version.md +1 -1
- data/docs/reference/models/user.md +7 -8
- data/docs/reference/uploaders.md +25 -0
- data/docs/reference/validators.md +1 -1
- data/docs/security.md +30 -9
- data/docs/what-is-trek.md +4 -4
- data/lib/generators/trek/USAGE +1 -1
- data/lib/generators/trek/audit_log_generator.rb +62 -0
- data/lib/generators/trek/helpers.rb +17 -0
- data/lib/generators/trek/install/admin/routes_generator.rb +2 -1
- data/lib/generators/trek/install/admin/security_check_generator.rb +36 -0
- data/lib/generators/trek/install/admin/users_generator.rb +6 -1
- data/lib/generators/trek/install/audit_log_generator.rb +9 -45
- data/lib/generators/trek/install/ci_generator.rb +19 -0
- data/lib/generators/trek/install/good_job_generator.rb +161 -0
- data/lib/generators/trek/install/model_specs_generator.rb +3 -3
- data/lib/generators/trek/install/postcss_generator.rb +1 -2
- data/lib/generators/trek/install/ruby_generator.rb +1 -1
- data/lib/generators/trek/install/scalingo_generator.rb +7 -45
- data/lib/generators/trek/install/translations_generator.rb +1 -2
- data/lib/generators/trek/install_generator.rb +18 -2
- data/lib/generators/trek/public_accounts_generator.rb +294 -0
- data/lib/generators/trek/scaffold_generator.rb +22 -21
- data/lib/generators/trek/scalingo_generator.rb +67 -0
- data/lib/generators/trek/templates/.gitlab-ci.yml +10 -1
- data/lib/generators/trek/templates/AGENTS.md +2 -2
- data/lib/generators/trek/templates/Makefile +1 -0
- data/lib/generators/trek/templates/config/i18n-tasks.yml.erb +0 -8
- data/lib/generators/trek/templates/controllers/admin/password_renewals_controller.rb +11 -0
- data/lib/generators/trek/templates/controllers/admin/security_checks_controller.rb +11 -0
- data/lib/generators/trek/templates/controllers/admin/user_sessions_controller.rb +1 -1
- data/lib/generators/trek/templates/controllers/admin/users_controller.rb +0 -8
- data/lib/generators/trek/templates/controllers/concerns/trek/authentication.rb +13 -4
- data/lib/generators/trek/templates/initializers/content_security_policy.rb +3 -2
- data/lib/generators/trek/templates/initializers/good_job.rb.tt +40 -0
- data/lib/generators/trek/templates/jobs/mail_delivery_job.rb +6 -0
- data/lib/generators/trek/templates/layouts/admin.html.slim +10 -0
- data/lib/generators/trek/templates/mailers/admin_mailer.rb +4 -2
- data/lib/generators/trek/templates/package.json.tt +1 -1
- data/lib/generators/trek/templates/policies/security_check.rb +4 -0
- data/lib/generators/trek/templates/public_accounts/api/authentication.rb.tt +76 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/accounts_controller.rb.tt +22 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/active_sessions_controller.rb.tt +21 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/base_controller.rb.tt +71 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/email_changes_controller.rb.tt +55 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/email_confirmations_controller.rb.tt +19 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/password_resets_controller.rb.tt +28 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/passwords_controller.rb.tt +17 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/registrations_controller.rb.tt +17 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/sessions_controller.rb.tt +57 -0
- data/lib/generators/trek/templates/public_accounts/api/controllers/sign_in_codes_controller.rb.tt +20 -0
- data/lib/generators/trek/templates/public_accounts/jobs/sign_in_code_job.rb.tt +23 -0
- data/lib/generators/trek/templates/public_accounts/locales/accounts.en.yml.tt +215 -0
- data/lib/generators/trek/templates/public_accounts/locales/accounts.fr.yml.tt +215 -0
- data/lib/generators/trek/templates/public_accounts/mailers/account_mailer.rb.tt +85 -0
- data/lib/generators/trek/templates/public_accounts/migrations/create_accounts.rb.tt +46 -0
- data/lib/generators/trek/templates/public_accounts/models/account/session.rb.tt +47 -0
- data/lib/generators/trek/templates/public_accounts/models/account/sign_in_code.rb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/models/account.rb.tt +87 -0
- data/lib/generators/trek/templates/public_accounts/spec/api/accounts_spec.rb.tt +90 -0
- data/lib/generators/trek/templates/public_accounts/spec/api/sign_ins_spec.rb.tt +188 -0
- data/lib/generators/trek/templates/public_accounts/spec/models/account/sign_in_code_spec.rb.tt +66 -0
- data/lib/generators/trek/templates/public_accounts/spec/models/account_spec.rb.tt +129 -0
- data/lib/generators/trek/templates/public_accounts/spec/web/accounts_spec.rb.tt +126 -0
- data/lib/generators/trek/templates/public_accounts/spec/web/authentication_spec.rb.tt +43 -0
- data/lib/generators/trek/templates/public_accounts/spec/web/sign_ins_spec.rb.tt +237 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change.en.html.slim.tt +10 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change.en.text.erb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change.fr.html.slim.tt +13 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change.fr.text.erb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change_code.en.html.slim.tt +9 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change_code.en.text.erb.tt +11 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change_code.fr.html.slim.tt +11 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_change_code.fr.text.erb.tt +11 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_confirmation.en.html.slim.tt +10 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_confirmation.en.text.erb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_confirmation.fr.html.slim.tt +10 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/email_confirmation.fr.text.erb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/password_reset.en.html.slim.tt +10 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/password_reset.en.text.erb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/password_reset.fr.html.slim.tt +13 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/password_reset.fr.text.erb.tt +8 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_code.en.html.slim.tt +9 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_code.en.text.erb.tt +11 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_code.fr.html.slim.tt +9 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_code.fr.text.erb.tt +11 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_locked.en.html.slim.tt +23 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_locked.en.text.erb.tt +14 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_locked.fr.html.slim.tt +24 -0
- data/lib/generators/trek/templates/public_accounts/views/mailer/sign_in_locked.fr.text.erb.tt +14 -0
- data/lib/generators/trek/templates/public_accounts/web/authentication.rb.tt +97 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/accounts_controller.rb.tt +33 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/active_sessions_controller.rb.tt +15 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/base_controller.rb.tt +52 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/email_changes_controller.rb.tt +85 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/email_confirmations_controller.rb.tt +19 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/password_resets_controller.rb.tt +41 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/passwords_controller.rb.tt +23 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/registrations_controller.rb.tt +24 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/sessions_controller.rb.tt +85 -0
- data/lib/generators/trek/templates/public_accounts/web/controllers/sign_in_codes_controller.rb.tt +32 -0
- data/lib/generators/trek/templates/public_accounts/web/views/_flash.html.slim.tt +5 -0
- data/lib/generators/trek/templates/public_accounts/web/views/accounts/show.html.slim.tt +52 -0
- data/lib/generators/trek/templates/public_accounts/web/views/email_changes/edit.html.slim.tt +17 -0
- data/lib/generators/trek/templates/public_accounts/web/views/email_changes/new.html.slim.tt +15 -0
- data/lib/generators/trek/templates/public_accounts/web/views/password_resets/edit.html.slim.tt +29 -0
- data/lib/generators/trek/templates/public_accounts/web/views/password_resets/new.html.slim.tt +15 -0
- data/lib/generators/trek/templates/public_accounts/web/views/passwords/edit.html.slim.tt +28 -0
- data/lib/generators/trek/templates/public_accounts/web/views/registrations/new.html.slim.tt +30 -0
- data/lib/generators/trek/templates/public_accounts/web/views/sessions/new.html.slim.tt +40 -0
- data/lib/generators/trek/templates/public_accounts/web/views/sign_in_codes/new.html.slim.tt +17 -0
- data/lib/generators/trek/templates/spec/jobs/mail_delivery_job_spec.rb +11 -0
- data/lib/generators/trek/templates/spec/mailers/admin_mailer_spec.rb +10 -0
- data/lib/generators/trek/templates/spec/requests/admin/fragments_spec.rb +1 -1
- data/lib/generators/trek/templates/spec/requests/admin/good_job_spec.rb +34 -0
- data/lib/generators/trek/templates/spec/requests/admin/pages_spec.rb +12 -1
- data/lib/generators/trek/templates/spec/requests/admin/panels_spec.rb +16 -0
- data/lib/generators/trek/templates/spec/requests/admin/password_renewal_spec.rb +2 -2
- data/lib/generators/trek/templates/spec/requests/admin/security_checks_spec.rb +24 -0
- data/lib/generators/trek/templates/spec/requests/admin/sign_in_lockout_spec.rb +1 -1
- data/lib/generators/trek/templates/spec/requests/admin/sign_in_notices_spec.rb +33 -0
- data/lib/generators/trek/templates/spec/requests/admin/user_sessions_spec.rb +2 -2
- data/lib/generators/trek/templates/views/admin/pages/_form.html.slim +1 -1
- data/lib/generators/trek/templates/views/admin/security_checks/show.html.slim +9 -0
- data/lib/generators/trek/templates/views/admin/user_password_resets/edit.html.slim +6 -1
- data/lib/generators/trek/templates/views/admin/user_sessions/new.html.slim +4 -1
- data/lib/generators/trek/templates/views/admin/users/index.html.slim +1 -1
- data/lib/generators/trek/templates/views/admin_mailer/new_sign_in.en.html.slim +1 -1
- data/lib/generators/trek/templates/views/admin_mailer/new_sign_in.en.text.erb +1 -1
- data/lib/generators/trek/templates/views/admin_mailer/new_sign_in.fr.html.slim +1 -1
- data/lib/generators/trek/templates/views/admin_mailer/new_sign_in.fr.text.erb +1 -1
- data/lib/tasks/trek/attachments.rake +12 -0
- data/lib/tasks/trek/security.rake +10 -0
- data/lib/trek/csp_reports.rb +22 -4
- data/lib/trek/disposable_email_domains.rb +9 -20
- data/lib/trek/engine.rb +5 -0
- data/lib/trek/json_compatibility.rb +20 -0
- data/lib/trek/security_check.rb +241 -0
- data/lib/trek/stored_image_metadata.rb +88 -0
- data/lib/trek/typography_formatter.rb +35 -4
- data/lib/trek/version.rb +1 -1
- data/lib/trek.rb +2 -1
- data/package.json +16 -13
- data/postcss.config.js +0 -3
- data/trek.gemspec +6 -7
- data/vitest.config.mjs +24 -0
- data/yarn.lock +1667 -1010
- metadata +122 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03b9804e1d6af7dbc4c266cf1a7380ae465840d125095ef970229b0f2b6a7488
|
|
4
|
+
data.tar.gz: 3eda65aaabb84fb33770f83b3f8ad1048180ca773eea0746eaeb691dfad042b5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 67d42c244017d6d8c3417b619d34e0148be67ecc9a6d4400134a32c3132fa763a965540d1331e3db6d77851b7089586172245203533e078e5fff5bd89201e126
|
|
7
|
+
data.tar.gz: 76add725b10eee26ec497612565d3a5b1bc49ac4e1e5fe93a72a1a0e385958f80686f84abc3dc7590ffb49a270eb920841af1a05adf929ebd5b2b5c6e3833c77
|
data/.node-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
24.22.
|
|
1
|
+
24.22.1
|
data/AGENTS.md
CHANGED
|
@@ -4,15 +4,15 @@ Guidance for AI coding agents working in this repository. Keep it accurate — u
|
|
|
4
4
|
|
|
5
5
|
## What is Trek
|
|
6
6
|
|
|
7
|
-
Trek is a customizable CMS for Ruby on Rails, shipped as a **Ruby gem** (`trek`) plus a companion **NPM package** (`trek`). It's a Rails **engine** (`lib/trek/engine.rb`) that installs a back-office/admin into a host app. Installation and features are driven by Rails generators (`rails g trek:install`, `trek:scaffold`, `trek:admin:user`, …). Authored by Etamin Studio. Distributed publicly: the gem on [RubyGems](https://rubygems.org/gems/trek), the npm package on [npmjs.com](https://www.npmjs.com/package/trek); the source repository stays private on self-hosted GitLab (`git.etamin.studio`).
|
|
7
|
+
Trek is a customizable CMS for Ruby on Rails, shipped as a **Ruby gem** (`trek`) plus a companion **NPM package** (`trek`). It's a Rails **engine** (`lib/trek/engine.rb`) that installs a back-office/admin into a host app. Installation and features are driven by Rails generators (`bin/rails g trek:install`, `trek:scaffold`, `trek:admin:user`, …). Authored by Etamin Studio. Distributed publicly: the gem on [RubyGems](https://rubygems.org/gems/trek), the npm package on [npmjs.com](https://www.npmjs.com/package/trek); the source repository stays private on self-hosted GitLab (`git.etamin.studio`).
|
|
8
8
|
|
|
9
9
|
## Tech stack
|
|
10
10
|
|
|
11
|
-
- **Ruby** `>= 3.3` (RuboCop targets 3.4) · **Rails** `>= 8.0, < 8.2` (lockfile 8.1.4)
|
|
12
|
-
- **Node** 24.22.
|
|
13
|
-
- Backend: `action_policy`, `closure_tree`, `acts_as_list`, `mobility` + `i18n-tasks`, `shrine` (+ blurhash/image_processing/aws-sdk-s3), `view_component` + `slim-rails` + `lookbook`, `kaminari
|
|
11
|
+
- **Ruby** `>= 3.3` (RuboCop targets 3.4) · **Rails** `>= 8.0, < 8.2` (lockfile 8.1.4.1)
|
|
12
|
+
- **Node** 24.22.1 (`.node-version`) · **Yarn** 4.18.1 with its defaults: no install scripts, no package published less than a day ago · **PostgreSQL** 12+ · **libvips** for images
|
|
13
|
+
- Backend: `action_policy`, `closure_tree`, `acts_as_list`, `mobility` + `i18n-tasks`, `shrine` (+ blurhash/image_processing/aws-sdk-s3), `view_component` + `slim-rails` + `lookbook`, `kaminari`
|
|
14
14
|
- Frontend: **esbuild** (`esbuild.config.js`) + **PostCSS** (`postcss.config.js`); Stimulus/Turbo, TipTap, Uppy, Tom Select, SortableJS
|
|
15
|
-
- Tests: **RSpec** (`rspec-rails`, capybara, simplecov) · Docs: **VitePress** (`docs/`)
|
|
15
|
+
- Tests: **RSpec** (`rspec-rails`, capybara with Cuprite, simplecov), **Vitest** (browser mode, headless Chrome through Playwright) · Docs: **VitePress** (`docs/`)
|
|
16
16
|
|
|
17
17
|
## Commands
|
|
18
18
|
|
|
@@ -21,9 +21,10 @@ bin/setup # bundle install + yarn install (dev setup)
|
|
|
21
21
|
bin/console # IRB with trek loaded
|
|
22
22
|
rake # default: spec + rubocop
|
|
23
23
|
rake spec # run tests (or: bundle exec rspec)
|
|
24
|
+
yarn test # JavaScript tests (Vitest): the admin's Stimulus controllers, e.g. the content editor's
|
|
24
25
|
COVERAGE=1 bundle exec rspec # tests + SimpleCov report in coverage/ (fails under the minimum set in spec/spec_helper.rb)
|
|
25
26
|
make lint # all linters below (make -k lint to run them all despite a failure)
|
|
26
|
-
make security # brakeman + bundler-audit
|
|
27
|
+
make security # brakeman + bundler-audit + yarn npm audit
|
|
27
28
|
make fix # rubocop/eslint/stylelint/prettier autocorrect, then make i18n-normalize
|
|
28
29
|
make i18n-normalize # sort the locale keys (i18n-tasks normalize), then Prettier them; CI checks it
|
|
29
30
|
make release # bump version (version.rb + package.json), stamp CHANGELOG, tag, push gem + npm
|
|
@@ -38,21 +39,24 @@ bundle exec slim-lint "app/**/*.slim"
|
|
|
38
39
|
yarn eslint "app/**/*.js"
|
|
39
40
|
yarn stylelint "app/**/*.css"
|
|
40
41
|
yarn prettier --check "{app,config,lib,spec}/**/*.{css,js,json,md,yml}"
|
|
42
|
+
bundle exec i18n-tasks missing -t diff
|
|
41
43
|
```
|
|
42
44
|
|
|
43
|
-
Security: `bundle exec brakeman` · `bundle exec bundle-audit check --update`
|
|
45
|
+
Security: `bundle exec brakeman` · `bundle exec bundle-audit check --update` · `yarn npm audit --recursive --environment production` (skipped advisories in `.yarnrc.yml`)
|
|
44
46
|
|
|
45
47
|
## Structure
|
|
46
48
|
|
|
47
|
-
- `app/` — engine code, namespaced under `trek/`: `components/` (ViewComponents), `controllers/`, `forms/`, `models/`, `policies/` (ActionPolicy), `uploaders/` (Shrine), `validators/` (top-level, e.g. `NotDisposableValidator`), `views/`, `javascript/` (Stimulus)
|
|
48
|
-
- `lib/generators/trek/` — the heart of the gem: `install/` (~
|
|
49
|
-
- `lib/trek/` — `engine.rb`, `version.rb`, `
|
|
49
|
+
- `app/` — engine code, namespaced under `trek/`: `components/` (ViewComponents), `content/` (`Trek::Content`, the content editor's schema and node types), `controllers/`, `forms/`, `helpers/`, `jobs/`, `models/`, `policies/` (ActionPolicy), `uploaders/` (Shrine), `validators/` (top-level, e.g. `NotDisposableValidator`), `views/`, `javascript/` (Stimulus), `assets/` (icons, stylesheets)
|
|
50
|
+
- `lib/generators/trek/` — the heart of the gem: `install/` (~55 generators, `install/admin/` included), `scaffold_generator.rb`, `taxonomies_generator.rb`, `audit_log_generator.rb`, `public_accounts_generator.rb`, `scalingo_generator.rb`, `admin/`, `upgrade/`, `templates/`
|
|
51
|
+
- `lib/trek/` — `engine.rb`, `version.rb`, and the engine's plain Ruby classes (`typography_formatter.rb`, `security_check.rb`, `admin_ip_allowlist.rb`…); rake tasks in `lib/tasks/trek/`
|
|
50
52
|
- `config/locales/` — `trek.en.yml`, `trek.fr.yml`
|
|
51
53
|
- `spec/` — RSpec suite, two kinds of spec:
|
|
52
54
|
- **isolated** (`require_relative` the file under test, stub its host): concerns, helpers, simple components
|
|
53
|
-
- **Rails** (`require "rails_helper"`): boots `spec/dummy`, a minimal host app on PostgreSQL (`trek_test`, or `DATABASE_URL`). Its models, migrations, Shrine initializer and the whole admin (controllers, views, routes, policies, mailers) are not committed: `spec/dummy/lib/generated_files.rb` runs Trek's own generator steps into `tmp/dummy` on every boot, and the database is rebuilt from them. A new model or migration template must be added to its `STEPS
|
|
55
|
+
- **Rails** (`require "rails_helper"`): boots `spec/dummy`, a minimal host app on PostgreSQL (`trek_test`, or `DATABASE_URL`). Its models, migrations, Shrine initializer and the whole admin (controllers, views, routes, policies, mailers) are not committed: `spec/dummy/lib/generated_files.rb` runs Trek's own generator steps into `tmp/dummy` on every boot, and the database is rebuilt from them. A new model or migration template must be added to its `STEPS` (and a generator taking arguments, to its `ARGUMENTS`), or `spec/dummy/generated_files_spec.rb` fails.
|
|
54
56
|
- **Host-app specs**: model, admin request, policy and mailer specs and their [Oaken](https://github.com/kaspth/oaken) seeds are templates (`lib/generators/trek/templates/{spec/models,spec/requests,spec/policies,spec/mailers,db/seeds}/`), installed in host apps by `trek:install:model_specs` and run by Trek's suite from `tmp/dummy` (`spec/dummy/generated_specs_spec.rb`); test data comes from `users.create`, `pages.create` and `seed "cases/…"`, not factories. Write specs for Trek's models there, in host-app style (no `frozen_string_literal`, Ruby 3.3-compatible — no bare `it` block parameter), so host apps get them too.
|
|
55
57
|
- **Generators** (`spec/trek/generators_spec.rb`): every generator runs on a copy of a real `rails new` app (`spec/support/generators.rb`, built once per run into `tmp/generator_skeleton`), then again to check it changes nothing. Shell-outs are recorded in `shell_commands`, not run. A new generator is picked up automatically; if it needs arguments, an earlier Trek step or a starting file, add it to the spec's `arguments`, `prerequisites` or `setups`.
|
|
58
|
+
- **System** (`spec/system`, `type: :system`): the admin in a headless Chrome (Cuprite), for what needs a real browser: typing, Turbo panels, uploads. `spec/support/system.rb` builds Trek's JS and CSS once per run (`node esbuild.config.js`) and serves them as the admin's `admin.js` and `admin.css`. Keep them few: they take seconds each.
|
|
59
|
+
- `spec/javascript/` — Vitest tests (`yarn test`) of the admin's Stimulus controllers with their libraries, in a headless Chrome (the installed one, or `CHROME_PATH`): the content editor's controller and Tiptap, mounted on its component's markup, driven with the keyboard and the mouse (`userEvent`), and the image and sound fields' controllers with Uppy (`upload_fields.test.js`). Most editor behaviour is tested there: the editor's file runs in about five seconds.
|
|
56
60
|
- Both kinds run in one process, so an isolated spec must restore any global it changes (`I18n`, `Shrine` storages…). `spec_helper` loads Rails and Action View before Trek, as a host app does: several dependencies (ActionPolicy, Slim, ViewComponent) configure themselves from what is already loaded.
|
|
57
61
|
- `docs/` — VitePress site
|
|
58
62
|
|
|
@@ -60,10 +64,10 @@ Security: `bundle exec brakeman` · `bundle exec bundle-audit check --update`
|
|
|
60
64
|
|
|
61
65
|
- **Ruby**: rubocop-rails-omakase + rubocop-rspec (`.rubocop.yml`) — double-quoted strings, line length 120, target 3.4
|
|
62
66
|
- **Slim** linted via slim_lint; **JS/CSS** via ESLint + Stylelint + Prettier 2.8.8
|
|
63
|
-
- **i18n**: keep English + French locales in sync (`config/locales/trek.*.yml`)
|
|
67
|
+
- **i18n**: keep English + French locales in sync (`config/locales/trek.*.yml`)
|
|
64
68
|
- **Versioning**: version lives in both `lib/trek/version.rb` and `package.json` — keep in sync via `make release`
|
|
65
|
-
- **CHANGELOG.md**: Keep-a-Changelog format. **Every MR must add an `[Unreleased]` entry**, except one that only changes specs. Keep entries short: one or two sentences on what changed for host apps, not how it was found or fixed — the MR description holds the details. When the change requires action in the host app on upgrade, end the entry with a bold `**Upgrade note:**` label followed by what to do. Use the same label when the change lets host apps remove or simplify existing patches or custom implementations (e.g. "**Upgrade note:** you can now drop your custom …") — never as an unlabelled trailing sentence.
|
|
69
|
+
- **CHANGELOG.md**: Keep-a-Changelog format. **Every MR must add an `[Unreleased]` entry**, except one that only changes specs or the repository's own tooling (`Makefile`, CI, Renovate config), which host apps never see. Keep entries short: one or two sentences on what changed for host apps, not how it was found or fixed — the MR description holds the details. When the change requires action in the host app on upgrade, end the entry with a bold `**Upgrade note:**` label followed by what to do. Use the same label when the change lets host apps remove or simplify existing patches or custom implementations (e.g. "**Upgrade note:** you can now drop your custom …") — never as an unlabelled trailing sentence.
|
|
66
70
|
- **Generated model names**: a new model template belonging to another model is nested under it, in `models/<owner>/` (`User::Session`, `User::PreviousPassword`), not prefixed (`UserSession`). Nested in an Active Record model, it keeps the prefixed table name (`user_sessions`) and its owner's `has_many` finds it without `class_name:`. The older `PagePath`, `PageVersion` and `TagCategory` move in Trek 3 (#248).
|
|
67
|
-
- **Generators' npm packages**: the install generators' `NPM_DEPENDENCIES` (`lib/generators/trek/install/*_generator.rb`) add to host apps the packages needed by the config files they copy from Trek's root (`esbuild.config.js`, `postcss.config.js`, `.eslintrc.json`, `.stylelintrc.json`, `lefthook.yml`). When a package is bumped in Trek's `package.json` — by hand or by Renovate, which doesn't touch the generators — bump its range in the generator in the same MR, or new apps get a version the copied config may not work with (as esbuild 0.15 did). List only packages those configs or the generated scripts use.
|
|
71
|
+
- **Generators' npm packages**: the install generators' `NPM_DEPENDENCIES` (`lib/generators/trek/install/*_generator.rb`) add to host apps the packages needed by the config files they copy from Trek's root (`esbuild.config.js`, `postcss.config.js`, `.eslintrc.json`, `.stylelintrc.json`, `lefthook.yml`). When a package is bumped in Trek's `package.json` — by hand or by Renovate, which doesn't touch the generators — bump its range in the generator in the same MR, or new apps get a version the copied config may not work with (as esbuild 0.15 did). List only packages those configs or the generated scripts use, and install them as `devDependencies` (`install_npm_dependencies(…, dev: true)`): they only run at build time, and the generated `npm-audit` job checks the production dependencies, which would otherwise include them.
|
|
68
72
|
- **Public code**: Trek ships publicly (gem, npm, docs), so nothing committed may mention a client or project name, nor a client's domain models or business logic — not in code, comments, specs, templates, docs, CHANGELOG or commit messages. Use neutral examples (`Page`, `Shop::Product`, an engine's `Blog::Post`). Client context belongs in GitLab issues and MR descriptions only.
|
|
69
73
|
- **CI**: GitLab CI (`.gitlab-ci.yml`), stages build → lint (one job: `make -k lint security i18n-check`) → test → deploy, the test jobs starting without waiting for lint; docs deploy to Netlify; deps via Renovate
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,93 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [2.7.0] - 2026-11-16
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `rails g trek:public_accounts Member --invite-only`, for a private site where only the accounts the app created sign in: a code is emailed only to an email that has an account, with the same answer for every email, and signing in never creates an account. Which accounts may sign in is `Member.for_sign_in(email)`, to narrow in the app (e.g. `active.find_by(email:)`). Codes only. See [Public accounts](https://trek.etamin.studio/reference/generators/public-accounts#invite-only).
|
|
8
|
+
- Generated apps check their npm packages for known vulnerabilities, as bundler-audit does their gems: `make scan` and a new `npm-audit` CI job run `yarn npm audit`, failing on any advisory or deprecation in the packages the app bundles (`dependencies`, not `devDependencies`). See [Vulnerable dependencies](https://trek.etamin.studio/reference/generators/install#vulnerable-dependencies) for how to resolve one. **Upgrade note:** move the PostCSS packages to `devDependencies` first (see below), then add the `npm-audit` job next to `bundler-audit` in `.gitlab-ci.yml`, and `yarn npm audit --recursive --environment production` to `make scan` (see `lib/generators/trek/templates/.gitlab-ci.yml`).
|
|
9
|
+
- The [Controllers](https://trek.etamin.studio/reference/controllers#localization) reference documents `Trek::Localization`: where a request's locale comes from, and how to add a source by overriding `locale_for_request`.
|
|
10
|
+
- `bin/rails trek:security:check` checks a deployed app's configuration against Trek's recommended settings: HTTPS and HSTS, the Content Security Policy, the cache store, the proxies and `ADMIN_ALLOWED_IPS`, the audit log and the scheduled purges, the admin users (password only, dormant, password expiry) and Active Record Encryption's keys. It prints each check with ✓, •, ⚠ or ✗ and a link to the docs, in a dated report to keep as evidence, and exits with status 1 when a check fails. See [Self-check](https://trek.etamin.studio/security#self-check).
|
|
11
|
+
- A **Settings › Security** page in the admin, for admins only, shows the same checks, dated, and checks the request that opened it too: that it reached the app over HTTPS, and that the IP address Rails sees is the one a CDN forwards. See [In the admin](https://trek.etamin.studio/security#in-the-admin). **Upgrade note:** run `rails g trek:install:admin:security_check`, and add the page to the Settings section of `app/views/layouts/admin.html.slim`, after the background jobs: `s.with_item(text: t("admin.security_checks.show.title"), href: %i[admin security_check], allowed_to: Current.user.admin?)`. In apps with Trek's host specs, copy `spec/requests/admin/security_checks_spec.rb` from Trek's templates (`lib/generators/trek/templates/spec/requests/admin/`).
|
|
12
|
+
- A [Personal data](https://trek.etamin.studio/personal-data) page lists the personal data Trek's generators create, table by table: why it's kept, for how long, and what deletes it; what deleting a user or an account leaves; and the third parties a default app sends some of it to. For an app's record of processing activities, and security questionnaires.
|
|
13
|
+
- The [Deploying to Scalingo](https://trek.etamin.studio/deploy) guide covers what a first deploy still needed: keeping Solid Cache in the app's single database, the environment variables the generated code reads, domains and their certificates, deploying from GitLab CI, and `> /dev/null` on `env-set` so secrets aren't printed.
|
|
14
|
+
- `Trek::Auditable`'s `audit_read_actions` lists actions that only read although they're not a GET, such as the chips hotwire_combobox requests with a POST, to keep them out of the audit log. See [Customizing](https://trek.etamin.studio/reference/generators/audit-log#customizing). **Upgrade note:** an app overriding `read_only_request?` for this can set `self.audit_read_actions = %i[chips]` instead.
|
|
15
|
+
- `Trek::PurgeExpiredSignInCodesJob` deletes a public account model's expired sign-in codes, which each hold an email: only a new code deleted them, so the last ones requested were kept for good. `rails g trek:public_accounts` schedules it every night in GoodJob's cron, with codes (3:45am). See [Public accounts](https://trek.etamin.studio/reference/generators/public-accounts#sessions). **Upgrade note:** in apps signing in with codes, add to `config.good_job.cron`, for each public account model (here `Member`): `purge_expired_member_sign_in_codes: { cron: "45 3 * * *", class: "Trek::PurgeExpiredSignInCodesJob", args: ["Member::SignInCode"] }`.
|
|
16
|
+
- `bin/rails trek:attachments:strip_image_metadata` strips the metadata of the images stored before `ImageUploader` stripped it on upload (`DRY_RUN=1` only lists them). Each image is re-encoded and replaced in place, so every record, page version and content editor block pointing to it keeps working. See [Image metadata](https://trek.etamin.studio/reference/uploaders#image-metadata). **Upgrade note:** once the app's `ImageUploader` strips metadata (see below), back up the bucket, or enable its versioning, then run the task once in production.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- `NotDisposableValidator` searches the disposable domains with valid_email2's `SortedDomainList`, new in valid_email2 7.2, instead of Trek's own copy of the same search, and shares valid_email2's list when the app sets `ValidEmail2.disposable_domains_lookup = :sorted_list` rather than loading a second one. Trek requires valid_email2 7.2. See [Validators](https://trek.etamin.studio/reference/validators#disposable-email-addresses). **Upgrade note:** an app that pinned valid_email2 to a Git revision for the sorted list can go back to the released gem (`~> 7.2`).
|
|
21
|
+
- A paragraph holding only line breaks (Shift+Enter) counts as empty, as a paragraph with no content does: it renders nothing (`Trek::Content::Paragraph.empty?`) instead of a blank space, a list item holding only such a paragraph is skipped, and content is cleaned of them before it is saved (`Trek::Contentable`). A line break between words stays. **Upgrade note:** existing content is cleaned the next time it is saved; apps that pruned these paragraphs before saving can drop that code.
|
|
22
|
+
- The `trek_known_users` cookie, which recognizes a browser that already signed in as a user so that only a new one emails them, is encrypted and kept 13 months after the last sign-in, instead of signed and kept 20 years: someone using the browser can no longer read who else signed in from it. Browsers recognized by the former signed cookie still are. **Upgrade note:** apps have their own copy of `app/controllers/concerns/trek/authentication.rb`: replace its `signed_in_from_this_browser?` and `remember_sign_in_from_this_browser`, and add `known_user_ids`, from Trek's (`lib/generators/trek/templates/controllers/concerns/trek/authentication.rb`). In apps with Trek's host specs, copy `spec/requests/admin/sign_in_notices_spec.rb` from Trek's templates.
|
|
23
|
+
- **Security:** the `ImageUploader` `trek:install:uploaders` copies strips an uploaded image's metadata (EXIF, with the GPS location and the camera's serial number, XMP, IPTC), which was published with the file. It re-encodes the image in its own format after applying its orientation (a JPEG or a WebP at quality 90, every frame of an animated WebP), and keeps its color profile with libvips 8.15 or later. It also accepts WebP images, besides JPEG and PNG. Thumbnails and other sizes are on by default: the derivation endpoint is enabled and mounted at `/derivations/image`, and makes every size a WebP at quality 80, without metadata. An image's sizes are deleted with it. See [Images: types and sizes](https://trek.etamin.studio/reference/uploaders#images-types-and-sizes). **Upgrade note:** apps have their own copy of `app/uploaders/image_uploader.rb`: re-run `rails g trek:install:uploaders`, which offers to replace it with Trek's, then bring back the app's own changes, and mount the endpoint in `config/routes.rb` if it's commented out: `mount ImageUploader.derivation_endpoint => "derivations/image"`. Images uploaded before keep their metadata until they're uploaded again, but their sizes don't.
|
|
24
|
+
- The generators schedule Trek's purges every night in GoodJob's cron, which they left to each app, and most never did: expired sessions and old audit log rows were kept for good. `rails g trek:install` schedules `Trek::PurgeExpiredSessionsJob` (the admin's sessions, 3am), `trek:audit_log` adds `Trek::AuditLog::PurgeJob` (4am), and `trek:public_accounts` the purge of its accounts' sessions (3:30am). Without GoodJob's initializer, the generators say what to schedule instead. See [Scheduled jobs](https://trek.etamin.studio/background-jobs#scheduled-jobs-cron). **Upgrade note:** in `config/initializers/good_job.rb`, add to `config.good_job.cron` the entries the app is missing: `purge_expired_sessions: { cron: "0 3 * * *", class: "Trek::PurgeExpiredSessionsJob" }`, `purge_audit_logs: { cron: "0 4 * * *", class: "Trek::AuditLog::PurgeJob" }` with the audit log, and `purge_expired_member_sessions: { cron: "30 3 * * *", class: "Trek::PurgeExpiredSessionsJob", args: ["Member::Session"] }` for each public account model (here `Member`). An app on another Active Job backend schedules the same jobs with it.
|
|
25
|
+
- The admin's image and sound fields upload with Uppy 6, up from Uppy 3, which brought nanoid 4 and its four advisories (three high) that `yarn npm audit` reported in every app (no nanoid 4 fixes them). The fields no longer bundle Uppy's stylesheet: it only styles Uppy's own interface, which Trek doesn't use.
|
|
26
|
+
- `rails g trek:install:postcss` adds the PostCSS packages to `devDependencies`, as the other build and lint tools, rather than to `dependencies`, and no longer adds `postcss-inline-svg`, which Trek's stylesheets don't use any more: it brought a css-what with a high advisory. **Upgrade note:** in `package.json`, move `postcss`, `postcss-flexbugs-fixes`, `postcss-import`, `postcss-modules` and `postcss-preset-env` to `devDependencies`, and run `yarn install`. Unless the app's own CSS uses `@svg-load` or `svg-load()`, remove `postcss-inline-svg` from `package.json` and its `require("postcss-inline-svg")(…)` from `postcss.config.js`.
|
|
27
|
+
- `rails g trek:scalingo` and the [Deploying to Scalingo](https://trek.etamin.studio/deploy) guide pin [trek-buildpack](https://github.com/etaminstudio/trek-buildpack) 0.1.4, up from 0.1.0. Since 0.1.0, the buildpack installs the Bundler version of `Gemfile.lock` (apps whose lockfile asked for a newer one died on start with `Could not find 'bundler'`) and forces its install past the default gem, and it now preloads jemalloc: the `libjemalloc2` of the `Aptfile` was installed but never used, as rv's Rubies aren't built with it. **Upgrade note:** on each Scalingo app, run `scalingo --app <app> env-set BUILDPACK_URL=https://github.com/etaminstudio/trek-buildpack/archive/refs/tags/v0.1.4.tar.gz`; it applies from the next deploy.
|
|
28
|
+
- Trek no longer requires `json` < 3, which made `bundle add trek` on a fresh Rails 8.1.4 app silently install Trek 2.2.0. json 3 needs Rails 8.1.4 or later: with an older Rails, the app now fails at boot saying so. **Upgrade note:** apps on Rails 8.0 or 8.1.0 to 8.1.3.1 keep the json 2 in their `Gemfile.lock`; add `gem "json", "< 3"` to the Gemfile so a `bundle update` doesn't bring json 3.
|
|
29
|
+
- `rails g trek:scalingo` comments out the `kamal` gem `rails new` adds, since a Scalingo app doesn't deploy with it, and runs `bundle install`: Kamal's SSH dependencies (`net-ssh`, `net-scp`, `net-sftp`, `sshkit`, `bcrypt_pbkdf`, `ed25519`) leave the bundle, and with them the advisories that kept failing bundler-audit. `config/deploy.yml`, `.kamal/secrets` and `bin/kamal` stay in place. **Upgrade note:** apps already on Scalingo can re-run `rails g trek:scalingo`, or comment out `gem "kamal"` by hand and run `bundle install`.
|
|
30
|
+
- `bin/rails g trek:scaffold` gives the new model a `to_s` returning its first string attribute (`title.presence || super`), which the admin shows records by: they were listed as `#<Book:0x…>` until its commented-out `to_s` was filled in. Without a string attribute, it stays a TODO. The [Getting started](https://trek.etamin.studio/getting-started#scaffold-your-first-resource) guide and the [Scaffold](https://trek.etamin.studio/reference/generators/scaffold) page now say to run the migration, and list the model's TODOs.
|
|
31
|
+
- The docs, the generators' messages and the security checks write commands as `bin/rails …`, the app's own Rails, instead of a mix of `rails g …` and `bin/rails …`.
|
|
32
|
+
|
|
33
|
+
### Removed
|
|
34
|
+
|
|
35
|
+
- DeepL: the scaffold generator no longer translates the new locale files with `DEEPL_AUTH_KEY`, Trek no longer depends on `deepl-rb`, and `rails g trek:install:translations` no longer adds it, nor a DeepL `translation:` section to `config/i18n-tasks.yml`. **Upgrade note:** apps can remove `gem "deepl-rb"` from their Gemfile, the `translation:` section from `config/i18n-tasks.yml`, and `DEEPL_AUTH_KEY` from their environment; an app that still translates with `i18n-tasks translate-missing --backend=deepl` keeps the gem and the section.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- Password managers such as Bitwarden didn't offer to save the password after signing in to the admin, until the page was reloaded: Turbo replaced the page's body, and the prompt they had added to it. The forms that take a password (the admin's sign-in and password reset, and `trek:public_accounts`' sign-in, sign-up, password reset and password change) now submit without Turbo, and load the next page in full. **Upgrade note:** add `data: { turbo: false }` to the `form_with` of `app/views/admin/user_sessions/new.html.slim` and `app/views/admin/user_password_resets/edit.html.slim`, and, in apps that ran `trek:public_accounts`, of its `sessions/new` (the password form), `registrations/new`, `password_resets/edit` and `passwords/edit` views.
|
|
40
|
+
- A `locale` param that isn't one of the app's locales (`?locale=xx`) made every controller including `Trek::Localization` answer with a 500 (`I18n::InvalidLocale`), the admin's included. It's now ignored, and the locale comes from the user or the browser as without it.
|
|
41
|
+
- The password strength meter no longer makes the form grow when its label appears, as a password is typed.
|
|
42
|
+
- An app that resolved Prism 2, as a fresh one has since rubocop-ast 1.51.0, failed at boot wherever it eager loads, in production and on CI (`uninitialized constant Prism::MissingNode`): refract, which `prosemirror` brings through Phlex, uses a node Prism 2 removed. Trek now requires Prism < 2. **Upgrade note:** if the app's `Gemfile.lock` has Prism 2 (`bundle info prism`), `bundle update trek` brings it back to 1.x.
|
|
43
|
+
- The arrows around a larger image in the content editor didn't show in host apps: their build looked for the icons in the app's own `app/assets/icons`, and left an invalid rule. The icons are now inlined in the stylesheet.
|
|
44
|
+
- The generated `.gitlab-ci.yml` ran on the `ci-ruby/node-24` image whatever Node the app pins: `rails g trek:install:ci` now picks the image of the major in `.node-version` (20, 22, 24 or 26), and falls back to Node 24, with a warning, without the file or for a major `ci-ruby` has no image for. **Upgrade note:** apps pinning another Node than 24 can set `node-<major>` in the `image:` of `.gitlab-ci.yml`.
|
|
45
|
+
- `rails g trek:public_accounts` added the account's attributes to `Current` without indenting them. **Upgrade note:** apps that ran it on Trek 2.6.0 can indent the three lines it added to `app/models/current.rb`.
|
|
46
|
+
- The sign-in concern `rails g trek:public_accounts` generates for a website (`app/controllers/concerns/<accounts>/authentication.rb`) failed the generated CI's Brakeman job (HTTP verb confusion): it now remembers the page to return to for `HEAD` requests too, as for `GET`. **Upgrade note:** apps that ran it on Trek 2.6.0 can replace `if request.get?` with `if request.get? || request.head?` in `require_<account>`.
|
|
47
|
+
- The Getting started guide and the README installed Yarn with `corepack enable`, which Node 25 and later no longer ship (`corepack: command not found`). They now install corepack first, with `npm install --global corepack`, or Yarn with mise.
|
|
48
|
+
- The admin's edit form of a page made of sections (`sectioned`) but not versioned failed with a `NameError` (`vf`). **Upgrade note:** in `app/views/admin/pages/_form.html.slim`, replace `vf.object.sections_instances` with `@object.sections_instances` in the branch for pages without versions (the second one).
|
|
49
|
+
- Docs that no longer matched the code: the Fragmentable configuration, the scaffold's form fields and route, icon keys (`trek/search`), `Trek::Search`, Sectionable, Orderable's `ordered`, the SEO fallbacks, the cryptography table and self-check levels in Security, CSP reports in Personal data, `S3_BASE_URL`, the admin's per-IP sign-in limit, the installer's linters, mailers and specs, `media-src`, `FEATURE_STORAGE`, `TREK_LOCALES`, and the json pin Rails before 8.1.4 needs.
|
|
50
|
+
- Deleting a public account left the sign-in codes waiting for its email, which hold that email: they're keyed by email, not linked to the account, so only their expiry and the nightly purge deleted them. `rails g trek:public_accounts` (with codes) now deletes them with the account. **Upgrade note:** in apps signing in with codes, add to the account model (here `Member`), after `has_many :sign_in_codes`: `after_destroy { Member::SignInCode.where(email:, purpose: "sign_in").delete_all }`.
|
|
51
|
+
- Small inaccuracies in the reference docs: `GateComponent` and the toast component's name, what `f.group` renders, the formatter's narrow no-break spaces, `User#last_activity_at`, `Current`'s attributes, `page.versions.current`, and the generators list, which now has `trek:scalingo` and `trek:upgrade:v2`.
|
|
52
|
+
- `bin/rails g trek:scaffold` left the new model's entry in `Admin::Dashboard::MODELS_IN_MENU` unindented.
|
|
53
|
+
|
|
54
|
+
## [2.6.0] - 2026-10-28
|
|
55
|
+
|
|
56
|
+
### Added
|
|
57
|
+
|
|
58
|
+
- The content editor's link, image and prompt panels give hints under their fields: what to write in an image's alternative text, credit and caption, that a link goes to a page or a URL, and what a prompt's title is for. **Upgrade note:** you can now drop your own `helpers.hint.trek/content_editor/*` translations.
|
|
59
|
+
- The content editor's link panel asks for the link's title, shown when hovering it, as its prompt panel does: Tiptap 3 keeps it on the link, where Tiptap 2 dropped it, and the site renders it.
|
|
60
|
+
- CSP violations reported to AppSignal (`Trek::CspReportsController`) tell what was blocked: they're tagged with the browser's user agent, where it happened (the source file and line) and, for an inline script, its first 40 characters, which the generated policy now asks for with `'report-sample'`. The log line gives the source and sample too. Tags are cut to 255 characters, as AppSignal silently drops longer ones. **Upgrade note:** add `:report_sample` to `policy.script_src` in `config/initializers/content_security_policy.rb` to get the samples.
|
|
61
|
+
- `rails g trek:install:good_job`, a new installer step (also runnable alone) making [GoodJob](https://github.com/bensheldon/good_job) the Active Job backend, as every Trek app was doing by hand: it swaps `solid_queue` for `good_job` in the Gemfile (Solid Cache stays), removes the Solid Queue setup `rails new` leaves behind (`config/queue.yml`, `config/recurring.yml`, `db/queue_schema.rb`, `bin/jobs`, the Puma plugin, the `queue:` database and Kamal's `SOLID_QUEUE_IN_PUMA`/`JOB_CONCURRENCY` variables), and configures the adapter (Active Job' test adapter in `config/environments/test.rb`, so specs can check what is enqueued), `:async` execution in production, the queues, cron and error reporting in `config/initializers/good_job.rb`. The dashboard is mounted at `/admin/good_job` with a menu entry in the admin, guarded by the Trek session: anyone who is not an administrator gets a 404 rather than a redirect. Two specs come with it (dashboard access per role, and the mail delivery job). Because GoodJob discards a failed job, every `deliver_later` email now goes through an installed `MailDeliveryJob` that retries five times with a growing delay, and `config/database.yml` reserves connections for the job threads on top of the web threads (`GOOD_JOB_MAX_THREADS`, which GoodJob defaults to `RAILS_MAX_THREADS`). See [Background jobs](https://trek.etamin.studio/background-jobs). **Upgrade note:** apps installed before this version can run `rails g trek:install:good_job` — it is idempotent and skips what is already in place — then add the dashboard entry to `app/views/layouts/admin.html.slim` (an item with `text: t("admin.jobs")`, `href: "/admin/good_job"`, `allowed_to: Current.user.admin?` in the settings section) and run the migration it generates. Apps already on GoodJob only need the Gemfile left alone and their `config/initializers/good_job.rb` compared with the generated one; apps still on Solid Queue must drop the `queue` database from their deploy target as well.
|
|
62
|
+
- Dashboard tiles (`Trek::Dashboard::TileComponent`) opening in a new tab (`target: "_blank"`) show an external link icon after their text, and a tile's color is the accent of what it holds (`data-accent-color`), which can use `var(--accent-*)`.
|
|
63
|
+
- Public accounts: `rails g trek:public_accounts Customer` gives the site's or the mobile app's users (customers, members…) a model of their own, apart from the admin's `User`, with its own table, sessions and sign-in, so nothing public can reach a staff account. They sign in either with a code emailed to them, which creates the account the first time, or with `--sign-in=password` with a password, the email confirmed and the password reset by a link; a website gets pages and a cookie, `--api` JSON endpoints and a JWT naming a session, so it can be revoked, and `--model-only` neither, for an app whose sign-in is its own. See [Public accounts](https://trek.etamin.studio/reference/generators/public-accounts).
|
|
64
|
+
- `Trek::Users::SignInLockout` sends its email through `sign_in_lockout_mailer` (`"AdminMailer"` by default), and `Trek::PurgeExpiredSessionsJob` takes the session model to purge (`User::Session` by default), for public accounts.
|
|
65
|
+
|
|
66
|
+
### Changed
|
|
67
|
+
|
|
68
|
+
- Trek requires the `prosemirror` gem 1.0 or later (was 0.7.1), and works with 1.1: rendering content (`formatted_content`) raised `ArgumentError` with it. `Trek::Content::Document#to_html` takes 1.1's `heading_ids: true`.
|
|
69
|
+
- `rails g trek:install` ends by listing the generators it doesn't run, to run as the app needs them: `trek:scaffold`, `trek:taxonomies`, `trek:audit_log`, `trek:public_accounts` and `trek:scalingo`.
|
|
70
|
+
- `trek:install:audit_log` and `trek:install:scalingo` are now `trek:audit_log` and `trek:scalingo`, as `trek:install` doesn't run them: `trek:install:*` is left to its own steps. The former names still work, with a deprecation warning, until Trek 3. **Upgrade note:** update the generator names in your docs and scripts.
|
|
71
|
+
- `trek:install:ruby` now pins **Ruby 4.0.9** (was 4.0.7), and the CI images (repo + generated `.gitlab-ci.yml` template) use the matching `4.0.9` tag. **Upgrade note:** existing apps can set `4.0.9` in `.ruby-version` and bump the `ci-ruby` image tag in `.gitlab-ci.yml`.
|
|
72
|
+
- Asking every user for a new password goes through its own controller, `Admin::PasswordRenewalsController#create` (`POST /admin/password_renewal`), instead of a `require_password_renewal` action of `Admin::UsersController`. **Upgrade note:** copy `app/controllers/admin/password_renewals_controller.rb` from Trek's templates (`lib/generators/trek/templates/controllers/admin/`), add `resource :password_renewal, only: :create` to the `admin` namespace of `config/routes.rb`, remove `post :require_password_renewal, on: :collection` from `resources :users` and the `require_password_renewal` action from `Admin::UsersController`, and point the button of `app/views/admin/users/index.html.slim` to `[:admin, :password_renewal]`.
|
|
73
|
+
- The new sign-in email (`AdminMailer#new_sign_in`) gives the IP address's host name next to it, as the active sessions do, looked up when the email is sent. **Upgrade note:** to get it, copy `new_sign_in` from Trek's `lib/generators/trek/templates/mailers/admin_mailer.rb`, and replace `@ip` with `@address` in `app/views/admin_mailer/new_sign_in.*`.
|
|
74
|
+
- Content is cleaned before it's saved (`Trek::Contentable`): empty paragraphs, empty list items and lists left empty are removed, as rendering already skipped them, so the stored JSON, `content_text` and searches no longer carry them. The document stays one the content editor opens, and node types or attributes the schema doesn't know are kept. The editor's JSON string is now stored as a document, which `Fragment.search` can search. **Upgrade note:** existing content is cleaned the next time it's saved; empty paragraphs authors used for spacing are removed for good. Apps that pruned empty paragraphs before saving can drop that code.
|
|
75
|
+
- The content editor's panels label their fields more explicitly: « Largeur d'affichage », « Légende de l'image », « Lien vers », « Ouvrir ce lien dans… », « Texte du lien », « Texte du bouton », and « Dépasse sur les côtés » for the wider image size (in English: "Display width", "Image caption", "Link to", "Open this link in…", "Link text", "Button text", "Extends past the sides").
|
|
76
|
+
- Trek is now developed and tested against **prosemirror 1.0**, its first stable release, which imports HTML and Markdown about a quarter faster. Trek already accepted it (`>= 0.7.1, < 2`), and doesn't use what 1.0 renames. **Upgrade note:** an app calling `Schema#parse_html`, `#parse_markdown` or `#parse_text`, or `Prosemirror::TextAlign`, renames them `#from_html`, `#from_markdown`, `#from_text` and `Prosemirror::Extensions::TextAlign` when it runs `bundle update prosemirror` (see [its changelog](https://github.com/etaminstudio/prosemirror/blob/main/CHANGELOG.md)).
|
|
77
|
+
- Failed form submissions answer with `:unprocessable_content` (422), Rack's name for it since 3.1, instead of the deprecated `:unprocessable_entity`, in `Trek::ResourceController`, the sign-in controller and the generated specs, which printed a deprecation warning in every run. **Upgrade note:** replace `:unprocessable_entity` with `:unprocessable_content` in the app's own controllers and specs to silence the warning.
|
|
78
|
+
- **Security:** the content editor runs on **Tiptap 3** (was 2), which fixes `mergeAttributes()` turning an own `__proto__` key into DOM attributes ([GHSA-cp6q-959q-f8rh](https://github.com/advisories/GHSA-cp6q-959q-f8rh)). Its floating menu uses Floating UI instead of Tippy. The editor behaves as before: no underline, and no empty paragraph added after a final block. **Upgrade note:** run `yarn up trek`, and update the app's own Tiptap extensions, if any, to Tiptap 3 (see [Upgrade from Tiptap v2](https://tiptap.dev/docs/guides/upgrade-tiptap-v2)).
|
|
79
|
+
- `Trek::Form::ImageFieldComponent` (`f.image_field`) shows two icons over its thumbnail, on hover and focus, opening the original image in a new tab or downloading it, instead of a « See original » button under « Replace » and « Remove », which wrapped onto two lines in French.
|
|
80
|
+
|
|
81
|
+
### Fixed
|
|
82
|
+
|
|
83
|
+
- `Trek::TypographyFormatter` broke content saved from the content editor: given the editor's JSON string, it formatted it as plain text, and the non-breaking spaces it added before colons made the JSON invalid. It now parses the document, and formats its text nodes. **Upgrade note:** an app that added `:content` to `format_attributes` may hold records whose content no longer parses (`formatted_content` raises `JSON::ParserError`), which the editor can't open either: restore them from a backup.
|
|
84
|
+
- `Trek::TypographyFormatter` no longer adds a space before a colon, semicolon, `!`, `?`, `%`, `€` or `$` inside a word: times (`10:30`), URLs (`https://…?a=1`) and ratios (`3:1`) are left alone, and one space goes before a group of signs (`Quoi ?!`). Apostrophes and the space after `«` now work next to accented letters (`l’été`, `« Été »`). Spaces earlier versions put inside a word (`10 :30`, `https ://`) are removed. **Upgrade note:** formatted titles and content are repaired the next time they're saved.
|
|
85
|
+
- `content_text` ran the content's paragraphs and lines together (`Line oneLine two`), which shows in the excerpts of the admin's fragments index: it now separates blocks with a blank line, and hard breaks with a newline (`Prosemirror::Document#to_text`).
|
|
86
|
+
- Reordering a list in the admin (`Trek::Reorderable`) could leave records out of place: it saved them one at a time while acts_as_list, and closure_tree for the trees ordered with `numeric_order`, renumbered the other records at each save. A list numbered from 1, acts_as_list's default, lost a record on most moves, as the list posts positions from 0. The posted order is now applied as a whole: in an `acts_as_list_no_update` block, from the list's `top_of_list`, or with closure_tree's `prepend_sibling` and `append_sibling` for a tree. Records missing from the list (deleted meanwhile, or left out by `reorderable_objects`) are skipped. **Upgrade note:** you can now drop your own `reorder` actions written to work around it.
|
|
87
|
+
- Adding a call to action from the content editor failed with `NoMethodError: undefined method 'color'`: the prompt panel's response read a `color` that `Trek::ContentEditor::Prompt` never had, and the panel has no field for. Prompts no longer have a color: the editor's block, the panel and `Trek::Content::PromptsBlock` drop it, and the site's link loses its `data-color`. A color already stored in content stays in the JSON, unrendered. **Upgrade note:** an app styling prompts with `[data-color]`, or reading `@color` in its own `PromptsBlock`, can drop that code.
|
|
88
|
+
- **Security:** the content editor showed image and call-to-action blocks by writing their attributes into HTML: an alternative text, caption or button text containing `"` or `<` broke the block, or injected markup into the admin. They are now built as DOM nodes, their texts as text.
|
|
89
|
+
- The content editor's toolbar buttons show the styles and the block where the cursor is right after a click: the bold, italic and heading buttons marked their icon instead of the button until the cursor moved.
|
|
90
|
+
|
|
3
91
|
## [2.5.0] - 2026-10-25
|
|
4
92
|
|
|
5
93
|
### Changed
|
data/Gemfile
CHANGED
|
@@ -24,8 +24,13 @@ end
|
|
|
24
24
|
group :test do
|
|
25
25
|
gem "bcrypt", "~> 3.1"
|
|
26
26
|
gem "capybara", "~> 3.38"
|
|
27
|
+
# System specs: a headless Chrome driven through its DevTools protocol, and the server it browses
|
|
28
|
+
gem "cuprite", "~> 0.19"
|
|
29
|
+
# The dummy app's API accounts (trek:public_accounts --api)
|
|
30
|
+
gem "jwt", "~> 3.1"
|
|
27
31
|
gem "oaken", "~> 1.0"
|
|
28
32
|
gem "pg", "~> 1.5"
|
|
33
|
+
gem "puma", "~> 8.0"
|
|
29
34
|
gem "simplecov", "~> 0.22.0"
|
|
30
35
|
gem "simplecov-cobertura", "~> 3.0"
|
|
31
36
|
end
|