Unverified Commit a5ca2074 authored by Phani Rithvij's avatar Phani Rithvij Committed by GitHub
Browse files

dprint-plugins: init (#369415)

parent aa162703
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
{ lib, fetchurl }:
let
  mkDprintPlugin =
    {
      url,
      hash,
      pname,
      version,
      description,
      initConfig,
      updateUrl,
      license ? lib.licenses.mit,
      maintainers ? [ lib.maintainers.phanirithvij ],
    }:
    fetchurl {
      inherit hash url;
      name = "${pname}-${version}.wasm";
      meta = {
        inherit
          description
          license
          maintainers
          ;
      };
      passthru = {
        updateScript = ./update-plugins.py;
        inherit initConfig updateUrl;
      };
    };
  inherit (lib)
    filterAttrs
    mapAttrs'
    nameValuePair
    removeSuffix
    ;
  files = filterAttrs (
    name: type: type == "regular" && name != "default.nix" && lib.hasSuffix ".nix" name
  ) (builtins.readDir ./.);
  plugins = mapAttrs' (
    name: _:
    nameValuePair (removeSuffix ".nix" name) (import (./. + "/${name}") { inherit mkDprintPlugin; })
  ) files;
in
plugins // { inherit mkDprintPlugin; }
+21 −0
Original line number Diff line number Diff line
{ mkDprintPlugin }:
mkDprintPlugin {
  description = "Biome (JS/TS) wrapper plugin.";
  hash = "sha256-+zY+myazFAUxeNuWFigkvF4zpKBs+jzVYQT09jRWFKI=";
  initConfig = {
    configExcludes = [ "**/node_modules" ];
    configKey = "biome";
    fileExtensions = [
      "ts"
      "tsx"
      "js"
      "jsx"
      "cjs"
      "mjs"
    ];
  };
  pname = "dprint-plugin-biome";
  updateUrl = "https://plugins.dprint.dev/dprint/biome/latest.json";
  url = "https://plugins.dprint.dev/biome-0.7.1.wasm";
  version = "0.7.1";
}
+14 −0
Original line number Diff line number Diff line
{ mkDprintPlugin }:
mkDprintPlugin {
  description = "Dockerfile code formatter.";
  hash = "sha256-gsfMLa4zw8AblOS459ZS9OZrkGCQi5gBN+a3hvOsspk=";
  initConfig = {
    configExcludes = [ ];
    configKey = "dockerfile";
    fileExtensions = [ "dockerfile" ];
  };
  pname = "dprint-plugin-dockerfile";
  updateUrl = "https://plugins.dprint.dev/dprint/dockerfile/latest.json";
  url = "https://plugins.dprint.dev/dockerfile-0.3.2.wasm";
  version = "0.3.2";
}
+14 −0
Original line number Diff line number Diff line
{ mkDprintPlugin }:
mkDprintPlugin {
  description = "JSON/JSONC code formatter.";
  hash = "sha256-Sw+HkUb4K2wrLuQRZibr8gOCR3Rz36IeId4Vd4LijmY=";
  initConfig = {
    configExcludes = [ "**/*-lock.json" ];
    configKey = "json";
    fileExtensions = [ "json" ];
  };
  pname = "dprint-plugin-json";
  updateUrl = "https://plugins.dprint.dev/dprint/json/latest.json";
  url = "https://plugins.dprint.dev/json-0.19.4.wasm";
  version = "0.19.4";
}
+14 −0
Original line number Diff line number Diff line
{ mkDprintPlugin }:
mkDprintPlugin {
  description = "Jupyter notebook code block formatter.";
  hash = "sha256-877CEZbMlj9cHkFtl16XCnan37SeEGUL3BHaUKUv8S4=";
  initConfig = {
    configExcludes = [ ];
    configKey = "jupyter";
    fileExtensions = [ "ipynb" ];
  };
  pname = "dprint-plugin-jupyter";
  updateUrl = "https://plugins.dprint.dev/dprint/jupyter/latest.json";
  url = "https://plugins.dprint.dev/jupyter-0.1.5.wasm";
  version = "0.1.5";
}
Loading