about summary refs log tree commit diff
path: root/pkgs/by-name/re/redocly/package.nix
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2024-05-03 00:13:16 +0000
committerGitHub <noreply@github.com>2024-05-03 00:13:16 +0000
commit26d2f291dffdcb7e5f40896be3fc3bc72538dbd0 (patch)
tree5eab6c80968fb769f5433bc2fa6b96f102d17701 /pkgs/by-name/re/redocly/package.nix
parent2918b2c876b74d0ba5e333676ee86228f51c24e8 (diff)
parent172094c8c1f83ee7f6d7dd10e64fdc7da0e4ac3b (diff)
Merge master into haskell-updates
Diffstat (limited to 'pkgs/by-name/re/redocly/package.nix')
-rw-r--r--pkgs/by-name/re/redocly/package.nix58
1 files changed, 58 insertions, 0 deletions
diff --git a/pkgs/by-name/re/redocly/package.nix b/pkgs/by-name/re/redocly/package.nix
new file mode 100644
index 0000000000000..eb1b0715d4069
--- /dev/null
+++ b/pkgs/by-name/re/redocly/package.nix
@@ -0,0 +1,58 @@
+{ lib
+, buildNpmPackage
+, fetchFromGitHub
+, makeWrapper
+, redocly
+, testers
+}:
+
+buildNpmPackage rec {
+  pname = "redocly";
+  version = "1.12.0";
+
+  src = fetchFromGitHub {
+    owner = "Redocly";
+    repo = "redocly-cli";
+    rev = "@redocly/cli@${version}";
+    hash = "sha256-KfNwBRGDFNMsba+yjwUHiiO2BJbIl4pW1b3cvLBe+lk=";
+  };
+
+  npmDepsHash = "sha256-I3cxMw9zOZb9sfP8UUoHc1UJ0RpDqVn9D29arSdNob4=";
+
+  npmBuildScript = "prepare";
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  postBuild = ''
+    npm --prefix packages/cli run copy-assets
+  '';
+
+  postInstall = ''
+    rm $out/lib/node_modules/@redocly/cli/node_modules/@redocly/{cli,openapi-core}
+    cp -R packages/cli $out/lib/node_modules/@redocly/cli/node_modules/@redocly/cli
+    cp -R packages/core $out/lib/node_modules/@redocly/cli/node_modules/@redocly/openapi-core
+
+    mkdir $out/bin
+    makeWrapper $out/lib/node_modules/@redocly/cli/node_modules/@redocly/cli/bin/cli.js \
+      $out/bin/redocly \
+      --set-default REDOCLY_TELEMETRY off \
+      --set-default CI true # Silence update messages
+
+    # Symlink for backwards compatibility. Remove after 24.05.
+    ln -s $out/bin/redocly $out/bin/redocly-cli
+  '';
+
+  passthru = {
+    tests.version = testers.testVersion {
+      package = redocly;
+    };
+  };
+
+  meta = {
+    description = "Makes OpenAPI easy. Lint/validate to any standard, generate beautiful docs, and more";
+    homepage = "https://github.com/Redocly/redocly-cli";
+    license = lib.licenses.mit;
+    mainProgram = "redocly";
+    maintainers = with lib.maintainers; [ szlend ];
+  };
+}