2023-12-08 00:27:37 +03:00
|
|
|
{ lib
|
|
|
|
, buildNpmPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
2024-05-02 08:26:28 +03:00
|
|
|
, redocly
|
|
|
|
, testers
|
2023-12-08 00:27:37 +03:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildNpmPackage rec {
|
2024-04-14 21:52:35 +03:00
|
|
|
pname = "redocly";
|
2024-07-02 05:08:43 +03:00
|
|
|
version = "1.17.0";
|
2023-12-08 00:27:37 +03:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Redocly";
|
|
|
|
repo = "redocly-cli";
|
|
|
|
rev = "@redocly/cli@${version}";
|
2024-07-02 05:08:43 +03:00
|
|
|
hash = "sha256-6aPNgqem3nG+rPJmxMyjqYPm5mE+93h/uXKCuiUeLxI=";
|
2023-12-08 00:27:37 +03:00
|
|
|
};
|
|
|
|
|
2024-07-02 05:08:43 +03:00
|
|
|
npmDepsHash = "sha256-J+nlY+FKZqwhj4JyuyReW/UoAMX/eouuOAZ2WCzW2VA=";
|
2023-12-08 00:27:37 +03:00
|
|
|
|
|
|
|
npmBuildScript = "prepare";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
2023-12-12 20:26:10 +03:00
|
|
|
postBuild = ''
|
|
|
|
npm --prefix packages/cli run copy-assets
|
|
|
|
'';
|
|
|
|
|
2023-12-08 00:27:37 +03:00
|
|
|
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
|
2024-01-21 14:06:28 +03:00
|
|
|
makeWrapper $out/lib/node_modules/@redocly/cli/node_modules/@redocly/cli/bin/cli.js \
|
2024-05-02 08:26:28 +03:00
|
|
|
$out/bin/redocly \
|
2024-01-21 14:06:28 +03:00
|
|
|
--set-default REDOCLY_TELEMETRY off \
|
|
|
|
--set-default CI true # Silence update messages
|
2023-12-08 00:27:37 +03:00
|
|
|
|
2024-05-02 08:26:28 +03:00
|
|
|
# Symlink for backwards compatibility. Remove after 24.05.
|
|
|
|
ln -s $out/bin/redocly $out/bin/redocly-cli
|
2023-12-08 00:27:37 +03:00
|
|
|
'';
|
|
|
|
|
2024-05-02 08:26:28 +03:00
|
|
|
passthru = {
|
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = redocly;
|
|
|
|
};
|
|
|
|
};
|
2023-12-08 00:27:37 +03:00
|
|
|
|
|
|
|
meta = {
|
2024-05-02 08:26:28 +03:00
|
|
|
description = "Makes OpenAPI easy. Lint/validate to any standard, generate beautiful docs, and more";
|
2023-12-08 00:27:37 +03:00
|
|
|
homepage = "https://github.com/Redocly/redocly-cli";
|
|
|
|
license = lib.licenses.mit;
|
2024-05-02 08:26:28 +03:00
|
|
|
mainProgram = "redocly";
|
2023-12-08 00:27:37 +03:00
|
|
|
maintainers = with lib.maintainers; [ szlend ];
|
|
|
|
};
|
|
|
|
}
|