159e378cbb
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
59 lines
1.6 KiB
Nix
59 lines
1.6 KiB
Nix
{ lib
|
|
, buildNpmPackage
|
|
, fetchFromGitHub
|
|
, makeWrapper
|
|
, redocly
|
|
, testers
|
|
}:
|
|
|
|
buildNpmPackage rec {
|
|
pname = "redocly";
|
|
version = "1.18.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "Redocly";
|
|
repo = "redocly-cli";
|
|
rev = "@redocly/cli@${version}";
|
|
hash = "sha256-Y09tGm3Sje8gd+6tUyBTCt7HjL2CQ/vo/ExLDnywvcQ=";
|
|
};
|
|
|
|
npmDepsHash = "sha256-WzMFKMW/YyAH3ZoOeIcXIum15cJmPGp96xSYb9QCaWI=";
|
|
|
|
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 = {
|
|
changelog = "https://redocly.com/docs/cli/changelog/";
|
|
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 ];
|
|
};
|
|
}
|