2024-01-02 11:29:13 +00:00
|
|
|
{ lib
|
|
|
|
, buildNpmPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
2024-05-15 15:35:15 +00:00
|
|
|
, redocly
|
|
|
|
, testers
|
2024-01-02 11:29:13 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildNpmPackage rec {
|
2024-05-15 15:35:15 +00:00
|
|
|
pname = "redocly";
|
|
|
|
version = "1.12.0";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Redocly";
|
|
|
|
repo = "redocly-cli";
|
|
|
|
rev = "@redocly/cli@${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-KfNwBRGDFNMsba+yjwUHiiO2BJbIl4pW1b3cvLBe+lk=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
npmDepsHash = "sha256-I3cxMw9zOZb9sfP8UUoHc1UJ0RpDqVn9D29arSdNob4=";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
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
|
2024-01-25 14:12:00 +00:00
|
|
|
makeWrapper $out/lib/node_modules/@redocly/cli/node_modules/@redocly/cli/bin/cli.js \
|
2024-05-15 15:35:15 +00:00
|
|
|
$out/bin/redocly \
|
2024-01-25 14:12:00 +00:00
|
|
|
--set-default REDOCLY_TELEMETRY off \
|
|
|
|
--set-default CI true # Silence update messages
|
2024-01-02 11:29:13 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
# Symlink for backwards compatibility. Remove after 24.05.
|
|
|
|
ln -s $out/bin/redocly $out/bin/redocly-cli
|
2024-01-02 11:29:13 +00:00
|
|
|
'';
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
passthru = {
|
|
|
|
tests.version = testers.testVersion {
|
|
|
|
package = redocly;
|
|
|
|
};
|
|
|
|
};
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
meta = {
|
2024-05-15 15:35:15 +00:00
|
|
|
description = "Makes OpenAPI easy. Lint/validate to any standard, generate beautiful docs, and more";
|
2024-01-02 11:29:13 +00:00
|
|
|
homepage = "https://github.com/Redocly/redocly-cli";
|
|
|
|
license = lib.licenses.mit;
|
2024-05-15 15:35:15 +00:00
|
|
|
mainProgram = "redocly";
|
2024-01-02 11:29:13 +00:00
|
|
|
maintainers = with lib.maintainers; [ szlend ];
|
|
|
|
};
|
|
|
|
}
|