Skip to content

Commit f5dc269

Browse files
committed
Sorts previews.json output by lookup_path for stable order
Lookbook.previews follows filesystem glob order, which differs between macOS and Linux whenever two previews share a name across statuses (e.g. beta/heading and open_project/heading). Every upstream sync regenerated on macOS was getting immediately followed by a CI "Generating static files" autocommit reordering the same two entries back to Linux's order. Sorting explicitly by lookup_path removes the platform dependency, so local and CI regeneration produce the same file.
1 parent 4b04446 commit f5dc269

3 files changed

Lines changed: 2428 additions & 2423 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@openproject/primer-view-components": patch
3+
---
4+
5+
Sort `static/previews.json` entries by `lookup_path` so the output order is deterministic across platforms, instead of following `Lookbook.previews`' filesystem glob order (which differs between macOS and Linux for previews sharing the same name across statuses, e.g. `beta/heading` and `open_project/heading`).

lib/primer/static/generate_previews.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Static
1010
module GeneratePreviews
1111
class << self
1212
def call
13-
Lookbook.previews.filter_map do |preview|
13+
Lookbook.previews.sort_by(&:lookup_path).filter_map do |preview|
1414
next if preview.preview_class == Primer::FormsPreview
1515
next if Primer::Accessibility.ignore_preview?(preview.preview_class)
1616

0 commit comments

Comments
 (0)