From 5d00432b5dffbfc64e549334ff6a9b1a2f54d479 Mon Sep 17 00:00:00 2001 From: Jason Meller Date: Tue, 12 Sep 2023 12:17:32 -0400 Subject: [PATCH] Add lockb support for Bun --- lib/install/bun/.gitattributes | 2 ++ lib/install/bun/install.rb | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 lib/install/bun/.gitattributes diff --git a/lib/install/bun/.gitattributes b/lib/install/bun/.gitattributes new file mode 100644 index 0000000..11c69b3 --- /dev/null +++ b/lib/install/bun/.gitattributes @@ -0,0 +1,2 @@ +# See https://bun.sh/docs/install/lockfile +*.lockb diff=lockb diff --git a/lib/install/bun/install.rb b/lib/install/bun/install.rb index 9fc69a4..0381e83 100644 --- a/lib/install/bun/install.rb +++ b/lib/install/bun/install.rb @@ -18,3 +18,11 @@ package_json["scripts"] ||= {} package_json["scripts"]["build"] = "bun bun.config.js" File.write("package.json", JSON.pretty_generate(package_json)) + +say "Add ability to diff lockb to .gitattributes" +if Rails.root.join(".gitattributes").exist? + append_to_file ".gitattributes", "\n# See https://bun.sh/docs/install/lockfile\n*.lockb diff=lockb\n" +else + copy_file "#{__dir__}/.gitattributes", ".gitattributes" +end +say %(Run `git config diff.lockb.textconv bun && git config diff.lockb.binary true` to enable pretty diffs for Bun's .lockb file), :green