diff --git a/lua/mason-registry/dprint/init.lua b/lua/mason-registry/dprint/init.lua new file mode 100644 index 000000000..aeaa94798 --- /dev/null +++ b/lua/mason-registry/dprint/init.lua @@ -0,0 +1,31 @@ +local Pkg = require "mason-core.package" +local github = require "mason-core.managers.github" +local std = require "mason-core.managers.std" +local _ = require "mason-core.functional" +local platform = require "mason-core.platform" + +return Pkg.new { + name = "dprint", + desc = [[A pluggable and configurable code formatting platform written in Rust.]], + homepage = "https://dprint.dev/", + languages = {}, + categories = { Pkg.Cat.Formatter }, + ---@async + ---@param ctx InstallContext + install = function(ctx) + github + .unzip_release_file({ + repo = "dprint/dprint", + asset_file = _.coalesce( + _.when(platform.is.mac_arm64, "dprint-aarch64-apple-darwin.zip"), + _.when(platform.is.mac_x64, "dprint-x86_64-apple-darwin.zip"), + _.when(platform.is.linux_arm64_gnu, "dprint-aarch64-unknown-linux-gnu.zip"), + _.when(platform.is.linux_x64_gnu, "dprint-x86_64-unknown-linux-gnu.zip"), + _.when(platform.is.win_x64, "dprint-x86_64-pc-windows-msvc.zip") + ), + }) + .with_receipt() + std.chmod("+x", { "dprint" }) + ctx:link_bin("dprint", platform.is.win and "dprint.exe" or "dprint") + end, +} diff --git a/lua/mason-registry/index.lua b/lua/mason-registry/index.lua index 9fff906f1..ddebe9dfb 100644 --- a/lua/mason-registry/index.lua +++ b/lua/mason-registry/index.lua @@ -56,6 +56,7 @@ return { djlint = "mason-registry.djlint", ["dockerfile-language-server"] = "mason-registry.dockerfile-language-server", ["dot-language-server"] = "mason-registry.dot-language-server", + dprint = "mason-registry.dprint", ["editorconfig-checker"] = "mason-registry.editorconfig-checker", efm = "mason-registry.efm", ["elixir-ls"] = "mason-registry.elixir-ls",