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 +4 -4
- data/.node-version +1 -1
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +1 -1
- data/app/controllers/concerns/trek/localization.rb +13 -1
- data/app/models/concerns/trek/users/invitable.rb +8 -0
- data/config/i18n-tasks.yml +21 -0
- data/config/locales/trek.en.yml +8 -0
- data/config/locales/trek.fr.yml +15 -0
- data/lib/generators/trek/install/authentication_generator.rb +2 -10
- data/lib/generators/trek/install/locales_generator.rb +12 -6
- data/lib/generators/trek/install/ruby_generator.rb +1 -1
- data/lib/generators/trek/install/yarn_generator.rb +4 -5
- data/lib/generators/trek/templates/.gitlab-ci.yml +1 -1
- data/lib/trek/version.rb +1 -1
- data/package.json +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5a1b779a620ab9d8286b2f42d3164cef475a04d2696e765951e33ef4ac351036
|
|
4
|
+
data.tar.gz: 1485275e1fe7f5bdc5f1d8785de59d8c8e39410bcafe05732e148abf17c4634a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e9492dd289b327e48cd06f9f8d3abd5962c1cf19319bb2fb0bc94bbafc35a1438fef67b80134a56e13400410ffa0504b41518ebe9ad7ca450de4ce2ef35826b
|
|
7
|
+
data.tar.gz: c2b8ecb84e9944bd1477b90b1d98731a8b7403459071de88911b8676eff237c987a04873fb978b486a56e73a676ad35358a4b0dbfa16a8e6ff16d30f6af0d278
|
data/.node-version
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
@@ -10,13 +10,25 @@ module Trek
|
|
|
10
10
|
|
|
11
11
|
def set_locale
|
|
12
12
|
old_locale = I18n.locale
|
|
13
|
-
I18n.locale =
|
|
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}"
|
data/config/locales/trek.en.yml
CHANGED
|
@@ -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:
|
data/config/locales/trek.fr.yml
CHANGED
|
@@ -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
|
-
|
|
20
|
-
|
|
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
|
-
|
|
27
|
+
if invalid.any?
|
|
28
|
+
say "Ignoring unavailable locales: #{invalid.join(", ")}", :yellow
|
|
29
|
+
@locales -= invalid
|
|
30
|
+
end
|
|
24
31
|
|
|
25
|
-
|
|
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 YarnGenerator < Rails::Generators::Base
|
|
8
|
-
YARN_VERSION = "
|
|
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
|
|
data/lib/trek/version.rb
CHANGED
data/package.json
CHANGED
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.
|
|
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
|