@zalom/plastic 1.0.0-beta.38 → 1.0.0-beta.39
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.
- package/package.json +1 -1
- package/scripts/dashboard.rb +12 -2
package/package.json
CHANGED
package/scripts/dashboard.rb
CHANGED
|
@@ -704,6 +704,16 @@ end
|
|
|
704
704
|
# CLI
|
|
705
705
|
# ---------------------------------------------------------------------------
|
|
706
706
|
|
|
707
|
+
# JSON.pretty_generate renders empty arrays/objects as multi-line ("[\n\n ]") on
|
|
708
|
+
# some json gem versions and single-line ("[]") on others, so the same payload
|
|
709
|
+
# serializes differently across environments. Collapse both to the single-line
|
|
710
|
+
# form so dashboard JSON output is byte-identical everywhere. The \n requirement
|
|
711
|
+
# in each pattern is what makes this safe: a raw newline is illegal inside a JSON
|
|
712
|
+
# string, so neither pattern can ever match inside string content.
|
|
713
|
+
def canonical_pretty_json(payload)
|
|
714
|
+
JSON.pretty_generate(payload).gsub(/\[\s*\n\s*\]/, "[]").gsub(/\{\s*\n\s*\}/, "{}")
|
|
715
|
+
end
|
|
716
|
+
|
|
707
717
|
def main(argv)
|
|
708
718
|
json = argv.delete("--json")
|
|
709
719
|
data = argv.delete("--data")
|
|
@@ -715,7 +725,7 @@ def main(argv)
|
|
|
715
725
|
|
|
716
726
|
if data
|
|
717
727
|
payload = mode == "project" ? render_data_project(records, slug) : render_data_global(records)
|
|
718
|
-
puts
|
|
728
|
+
puts canonical_pretty_json(payload)
|
|
719
729
|
return 0
|
|
720
730
|
end
|
|
721
731
|
|
|
@@ -729,7 +739,7 @@ def main(argv)
|
|
|
729
739
|
# per-scope boards (keeping the all-scopes auto-mode contract stable).
|
|
730
740
|
payload[:store_health] = store_health(slug) if mode == "project"
|
|
731
741
|
payload[:store_health] = store_health(:global) if mode == "continue"
|
|
732
|
-
puts
|
|
742
|
+
puts canonical_pretty_json(payload)
|
|
733
743
|
return 0
|
|
734
744
|
end
|
|
735
745
|
|