trek 0.1.25 → 0.1.26

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71867750da0cef4ae1928a4245e69742d7d32c6614c54da4d107f992da5e0e23
4
- data.tar.gz: 71cb0d0b2ce4098030705245aaf92b50eefec11b4491bc0180e145eeb2f6a8e3
3
+ metadata.gz: 5a1b779a620ab9d8286b2f42d3164cef475a04d2696e765951e33ef4ac351036
4
+ data.tar.gz: 1485275e1fe7f5bdc5f1d8785de59d8c8e39410bcafe05732e148abf17c4634a
5
5
  SHA512:
6
- metadata.gz: 0e3a672cb3ebf8abee38d436832d92d3cc5c8bd5502f37344bda47275d4bd090a7326920cd823ed84e30990cd9feb453dddc2e62bfc1d43967de230498fd8287
7
- data.tar.gz: aa4c5e9ee652804fc0361b8ac9e459863f67ff42441484e26fd8387312d8ba70517809b04d81fb68d9b9cab0ea6e6c7a27b943486c80c94b1544678841806fab
6
+ metadata.gz: 6e9492dd289b327e48cd06f9f8d3abd5962c1cf19319bb2fb0bc94bbafc35a1438fef67b80134a56e13400410ffa0504b41518ebe9ad7ca450de4ce2ef35826b
7
+ data.tar.gz: c2b8ecb84e9944bd1477b90b1d98731a8b7403459071de88911b8676eff237c987a04873fb978b486a56e73a676ad35358a4b0dbfa16a8e6ff16d30f6af0d278
data/.node-version CHANGED
@@ -1 +1 @@
1
- 22.21.1
1
+ 24.18.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.26] - 2026-07-02
4
+
5
+ ### Changed
6
+
7
+ - `Trek::Localization` now resolves the request locale through an overridable `locale_for_request` method (still `params` → `current_user` → `headers` by default). Apps that need another source can override it and fall back to the default chain with `super` instead of forking the whole concern — e.g. `def locale_for_request = Current.event&.locale.presence || super`. No behavior change for existing consumers.
8
+ - `trek:install:authentication` no longer injects `generates_token_for` declarations into the generated `User`: `:password_reset` (15 min) is provided automatically by Rails' `has_secure_password`, and `:invite` (1 week) now lives in the `Trek::Users::Invitable` concern (which owns the rest of the invite behaviour). **Upgrade note:** existing apps can delete both `generates_token_for` blocks from their `User` — Rails and the concern provide them; customise the reset window via `has_secure_password reset_token: { expires_in: … }` if needed.
9
+ - `trek:install:ruby` now pins **Ruby 4.0.5** (was 4.0.0), and the CI images (repo + generated `.gitlab-ci.yml` template) use the matching `4.0.5` tag. **Upgrade note:** existing apps can set `4.0.5` in `.ruby-version` and bump the `ci-ruby` image tag in `.gitlab-ci.yml`.
10
+ - `trek:install:yarn` now installs **Yarn 4.17.0** (was 3.8.7) and no longer imports the `interactive-tools` plugin, whose `upgrade-interactive` command is built into Yarn 4. Yarn 4 is also what supports the minimal-age-gate exception below. **Upgrade note:** existing apps can upgrade with `yarn set version 4.17.0` followed by `yarn install`, and drop the now-redundant `interactive-tools` plugin.
11
+ - Bumped **Node to 24.18.0** (was 22.21.1) in `.node-version` and the CI images (repo + generated `.gitlab-ci.yml` template, now `ci-ruby/node-24`). **Upgrade note:** existing apps can set `24.18.0` in `.node-version` and bump the `ci-ruby/node-*` image in `.gitlab-ci.yml`.
12
+ - CI now runs `i18n-tasks missing -t diff` (config in `config/i18n-tasks.yml`) so a base-locale key with no translation in another locale fails the build. (Full `health` isn't used: as an engine, Trek's keys are consumed by host apps and many components/templates use relative keys that only resolve there.)
13
+
14
+ ### Fixed
15
+
16
+ - Added the missing French translations that fell back to English: `admin.dialog_component.{title,text}` (the confirmation dialog shown on every destroy action) and `admin.{pages,fragments}.{show.intro,reorder.success,search.alert}`. Also added the English `admin.section`/`admin.sections` flash messages that previously existed only in French. (#194)
17
+ - `trek:install:yarn` now exempts the `@etaminstudio` scope from Yarn's minimal-age gate (`npmMinimalAgeGate: 0` under `npmScopes.etaminstudio` in the generated `.yarnrc.yml`), so a freshly published `@etaminstudio/trek` release installs without being quarantined; the gate still applies to public packages. **Upgrade note:** existing apps can add `npmMinimalAgeGate: 0` under `npmScopes.etaminstudio` in their `.yarnrc.yml`.
18
+ - `trek:install:locales` no longer generates an invalid `config/initializers/locales.rb` (`I18n.available_locales = [:]` / `I18n.default_locale = :`) when passed no or blank locales. A blank option/env now falls back to the default (`en, fr`), blank entries are dropped, and the list can never end up empty. (#169)
19
+
3
20
  ## [0.1.25] - 2026-07-01
4
21
 
5
22
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trek (0.1.25)
4
+ trek (0.1.26)
5
5
  action_policy (~> 0.6)
6
6
  actioncable
7
7
  acts_as_list (~> 1.1)
@@ -10,13 +10,25 @@ module Trek
10
10
 
11
11
  def set_locale
12
12
  old_locale = I18n.locale
13
- I18n.locale = locale_from_params || locale_from_current_user || locale_from_headers
13
+ I18n.locale = locale_for_request
14
14
 
15
15
  yield
16
16
  ensure
17
17
  I18n.locale = old_locale
18
18
  end
19
19
 
20
+ # The locale a request is answered in. Overridable seam: an app can prepend
21
+ # its own source (e.g. the locale of the event a request belongs to) and
22
+ # fall back to this default chain with `super`, rather than forking the
23
+ # whole concern:
24
+ #
25
+ # def locale_for_request
26
+ # Current.event&.locale.presence || super
27
+ # end
28
+ def locale_for_request
29
+ locale_from_params || locale_from_current_user || locale_from_headers
30
+ end
31
+
20
32
  def locale_from_params
21
33
  params[:locale]
22
34
  end
@@ -9,6 +9,14 @@ module Trek
9
9
  attribute :send_invite, :boolean
10
10
 
11
11
  after_create :send_invite_email, if: :send_invite
12
+
13
+ # Invite links last a week and invalidate once the password is set
14
+ # (password_salt), so a used invite can't be replayed. A distinct,
15
+ # longer-lived purpose than :password_reset. Assumes the including model
16
+ # has has_secure_password.
17
+ generates_token_for :invite, expires_in: 1.week do
18
+ password_salt&.last(10)
19
+ end
12
20
  end
13
21
 
14
22
  private
@@ -0,0 +1,21 @@
1
+ # i18n-tasks config for the Trek engine.
2
+ #
3
+ # Trek ships translations for host apps, so the usual "unused key" and code
4
+ # scan checks don't apply here (keys are used by generated apps, and many
5
+ # components/templates use relative keys that only resolve in the host). What
6
+ # we do want to guard is locale parity: every key present in the base locale
7
+ # must be translated in the others. `i18n-tasks missing -t diff` enforces that.
8
+ base_locale: en
9
+ locales:
10
+ - en
11
+ - fr
12
+
13
+ data:
14
+ read:
15
+ - config/locales/trek.%{locale}.yml
16
+
17
+ # The gendered resource-label variants (f/m/m_alt) only exist in locales whose
18
+ # models declare a gender; English always resolves to `n` (see i18n_model_gender),
19
+ # so it intentionally omits them.
20
+ ignore_missing:
21
+ - "admin.actions.*_resource.{f,m,m_alt}"
@@ -155,6 +155,14 @@ en:
155
155
  search_component:
156
156
  search: Search
157
157
  search_user: Search for a user with an email
158
+ section:
159
+ destroy:
160
+ confirm: Are you sure you want to delete this section? This operation is irreversible.
161
+ sections:
162
+ create:
163
+ success: Section added
164
+ update:
165
+ success: Section updated
158
166
  seo: SEO
159
167
  settings: Settings
160
168
  user_password_resets:
@@ -86,6 +86,9 @@ fr:
86
86
  index:
87
87
  intro: Accès rapide aux fonctions-clés d'administration de votre appli
88
88
  title: Raccourcis
89
+ dialog_component:
90
+ text: Cette action est irréversible.
91
+ title: Êtes-vous sûr·e ?
89
92
  errors:
90
93
  message:
91
94
  one: 1 erreur détectée
@@ -106,6 +109,12 @@ fr:
106
109
  intro: Gestion des fragments de contenu utilisés sur le site
107
110
  new:
108
111
  intro: Ajout d'un fragment de contenu au site
112
+ reorder:
113
+ success: Fragments réorganisés
114
+ search:
115
+ alert: Fragment non trouvé avec ce titre
116
+ show:
117
+ intro: Fragment
109
118
  update:
110
119
  success: Fragment mis à jour
111
120
  navigation: Navigation
@@ -122,6 +131,12 @@ fr:
122
131
  intro: Gestion des pages du site
123
132
  new:
124
133
  intro: Ajout d'une page au site
134
+ reorder:
135
+ success: Pages réorganisées
136
+ search:
137
+ alert: Page non trouvée avec ce titre
138
+ show:
139
+ intro: Page
125
140
  update:
126
141
  success: Page mise à jour
127
142
  panels:
@@ -66,18 +66,10 @@ module Trek
66
66
  def user_model_injection
67
67
  <<-RUBY
68
68
  has_secure_password
69
+ # Token purposes: :password_reset (15 min) comes from has_secure_password;
70
+ # :invite (1 week) comes from Trek::Users::Invitable.
69
71
  has_many :user_sessions, dependent: :destroy
70
72
 
71
- # Both tokens invalidate once the password changes (password_salt). Invites
72
- # get a longer window than a password reset, so they are a distinct purpose.
73
- generates_token_for :password_reset, expires_in: 15.minutes do
74
- password_salt&.last(10)
75
- end
76
-
77
- generates_token_for :invite, expires_in: 1.week do
78
- password_salt&.last(10)
79
- end
80
-
81
73
  scope :privileged, -> { where(role: Trek::Users::Roles::PRIVILEGED_ROLES) }
82
74
 
83
75
  RUBY
@@ -12,18 +12,24 @@ module Trek
12
12
 
13
13
  source_root File.expand_path("../templates", __dir__)
14
14
 
15
+ DEFAULT_LOCALES = "en, fr".freeze
16
+
15
17
  class_option :locales, type: :string,
16
- desc: "Comma-separated locales to enable, e.g. en,fr (default: en)"
18
+ desc: "Comma-separated locales to enable, e.g. en,fr (default: en, fr)"
17
19
 
18
20
  def set_locales
19
- raw = options[:locales] || ENV["TREK_LOCALES"] || "en"
20
- @locales = raw.split(",").map(&:strip)
21
+ # `.presence` so a blank option/env (e.g. an empty answer) falls back
22
+ # to the default instead of producing an empty, invalid initializer.
23
+ raw = options[:locales].presence || ENV["TREK_LOCALES"].presence || DEFAULT_LOCALES
24
+ @locales = raw.split(",").map(&:strip).reject(&:blank?)
21
25
 
22
26
  invalid = @locales.reject { |locale| valid_locales?(locale) }
23
- return if invalid.empty?
27
+ if invalid.any?
28
+ say "Ignoring unavailable locales: #{invalid.join(", ")}", :yellow
29
+ @locales -= invalid
30
+ end
24
31
 
25
- say "Ignoring unavailable locales: #{invalid.join(", ")}", :yellow
26
- @locales -= invalid
32
+ # Never leave the list empty — that would generate `[:]` / `:`.
27
33
  @locales = ["en"] if @locales.empty?
28
34
  end
29
35
 
@@ -5,7 +5,7 @@ module Trek
5
5
  module Generators
6
6
  module Install
7
7
  class RubyGenerator < Rails::Generators::Base
8
- RUBY_VERSION = "4.0.0"
8
+ RUBY_VERSION = "4.0.5"
9
9
 
10
10
  include Trek::Generators::Helpers
11
11
 
@@ -5,7 +5,7 @@ module Trek
5
5
  module Generators
6
6
  module Install
7
7
  class YarnGenerator < Rails::Generators::Base
8
- YARN_VERSION = "3.8.7"
8
+ YARN_VERSION = "4.17.0"
9
9
 
10
10
  include Trek::Generators::Helpers
11
11
 
@@ -41,10 +41,6 @@ module Trek
41
41
  end
42
42
  end
43
43
 
44
- def add_interactive_tools_plugin
45
- run "yarn plugin import interactive-tools"
46
- end
47
-
48
44
  # The default bin/setup (generated by `rails new -j esbuild`) runs
49
45
  # `yarn install --check-files`, but `--check-files` is not a valid flag
50
46
  # under Yarn berry (the version we pin above), so it breaks `bin/setup`
@@ -67,6 +63,9 @@ module Trek
67
63
  npmScopes:
68
64
  etaminstudio:
69
65
  npmRegistryServer: "https://git.etaminstud.io/api/v4/packages/npm"
66
+ # Our own registry — skip Yarn's minimal-age gate so a freshly
67
+ # published Trek release installs without the quarantine delay.
68
+ npmMinimalAgeGate: 0
70
69
  YAML
71
70
  end
72
71
 
@@ -20,7 +20,7 @@ stages:
20
20
 
21
21
  # Defaults
22
22
  default:
23
- image: registry.git.etaminstud.io/devops/ci-ruby/node-22:4.0.0
23
+ image: registry.git.etaminstud.io/devops/ci-ruby/node-24:4.0.5
24
24
 
25
25
  services:
26
26
  - postgres:16
data/lib/trek/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Trek
4
- VERSION = "0.1.25"
4
+ VERSION = "0.1.26"
5
5
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etaminstudio/trek",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "A modern CMS for Ruby on Rails",
5
5
  "main": "app/javascript/trek.js",
6
6
  "repository": {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trek
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.25
4
+ version: 0.1.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohamed Bengrich
@@ -730,6 +730,7 @@ files:
730
730
  - app/views/trek/shared/_resource_heading.html.slim
731
731
  - app/views/trek/shared/_resource_index_heading.html.slim
732
732
  - config/brakeman.ignore
733
+ - config/i18n-tasks.yml
733
734
  - config/locales/trek.en.yml
734
735
  - config/locales/trek.fr.yml
735
736
  - docs/.vitepress/config.mjs