about summary refs log tree commit diff
path: root/pkgs/by-name/au
diff options
context:
space:
mode:
authorPyrox2024-06-25 17:37:35 -0400
committerPyrox2024-07-05 13:51:29 -0400
commit88ca48b76aa619c56e87eb25c05e9fd09ae55c9e (patch)
tree6634318292a9113c62ce393b86254c33196545be /pkgs/by-name/au
parentfad88a16616ab9eb29f099944fa86758bd9f5ff4 (diff)
nodePackages.autoprefixer: Remove from node-packages
Moves to pkgs/by-name.
Diffstat (limited to 'pkgs/by-name/au')
-rw-r--r--pkgs/by-name/au/autoprefixer/package.nix62
-rw-r--r--pkgs/by-name/au/autoprefixer/tests/simple-execution.nix25
2 files changed, 87 insertions, 0 deletions
diff --git a/pkgs/by-name/au/autoprefixer/package.nix b/pkgs/by-name/au/autoprefixer/package.nix
new file mode 100644
index 000000000000..816b37a36b67
--- /dev/null
+++ b/pkgs/by-name/au/autoprefixer/package.nix
@@ -0,0 +1,62 @@
+{
+  lib,
+  stdenv,
+  nodejs,
+  pnpm_9,
+  fetchFromGitHub,
+  callPackage,
+  nix-update-script
+}: stdenv.mkDerivation (finalAttrs: {
+  pname = "autoprefixer";
+  version = "10.4.19";
+
+  src = fetchFromGitHub {
+    owner = "postcss";
+    repo = "autoprefixer";
+    rev = finalAttrs.version;
+    hash = "sha256-Br0z573QghkYHLgF9/OFp8FL0bIW2frW92ohJnHhgHE=";
+  };
+
+  nativeBuildInputs = [
+    nodejs
+    pnpm_9.configHook
+  ];
+
+  pnpmDeps = pnpm_9.fetchDeps {
+    inherit (finalAttrs) pname version src;
+    hash = "sha256-sGcqM87xR9XTL/MUO7fGpI1cPK7EgJNpeYwBmqVNB6I=";
+  };
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir $out
+    mv bin/ $out
+    mv lib/ $out
+    mv node_modules/ $out
+    mv data/ $out
+    mv package.json $out
+
+    runHook postInstall
+  '';
+
+  postFixup = ''
+    patchShebangs $out/bin/autoprefixer
+  '';
+
+  passthru = {
+    tests = {
+      simple-execution = callPackage ./tests/simple-execution.nix { };
+    };
+    updateScript = nix-update-script { };
+  };
+
+  meta = {
+    description = "Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website";
+    homepage = "https://github.com/postcss/autoprefixer";
+    changelog = "https://github.com/postcss/autoprefixer/releases/tag/${finalAttrs.version}";
+    license = lib.licenses.mit;
+    mainProgram = "autoprefixer";
+    maintainers = with lib.maintainers; [ pyrox0 ];
+  };
+})
diff --git a/pkgs/by-name/au/autoprefixer/tests/simple-execution.nix b/pkgs/by-name/au/autoprefixer/tests/simple-execution.nix
new file mode 100644
index 000000000000..c889795a2ef5
--- /dev/null
+++ b/pkgs/by-name/au/autoprefixer/tests/simple-execution.nix
@@ -0,0 +1,25 @@
+{ runCommand, autoprefixer }:
+
+let
+  inherit (autoprefixer) packageName version;
+in
+
+runCommand "${packageName}-tests" { meta.timeout = 60; }
+  ''
+    # get version of installed program and compare with package version
+    claimed_version="$(${autoprefixer}/bin/autoprefixer --version | awk '{print $2}')"
+    if [[ "$claimed_version" != "${version}" ]]; then
+      echo "Error: program version does not match package version ($claimed_version != ${version})"
+      exit 1
+    fi
+
+    # run dummy commands
+    ${autoprefixer}/bin/autoprefixer --help > /dev/null
+    ${autoprefixer}/bin/autoprefixer --info > /dev/null
+
+    # Testing the actual functionality is done in the test for postcss
+    # because autoprefixer is a postcss plugin
+
+    # needed for Nix to register the command as successful
+    touch $out
+  ''