Skip to content

Commit

Permalink
antora-lunr-extension: init at 1.0.0-alpha.8
Browse files Browse the repository at this point in the history
  • Loading branch information
trueNAHO committed Oct 29, 2024
1 parent 8844453 commit d50a28e
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
63 changes: 63 additions & 0 deletions pkgs/by-name/an/antora-lunr-extension/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
antora,
buildNpmPackage,
fetchFromGitLab,
lib,
nix-update-script,
}:
buildNpmPackage rec {
pname = "antora-lunr-extension";
version = "1.0.0-alpha.8";

src = fetchFromGitLab {
hash = "sha256-GplCwhUl8jurD4FfO6/T3Vo1WFjg+rtAjWeIh35unk4=";
owner = "antora";
repo = pname;
rev = "v${version}";
};

npmDepsHash = "sha256-EtjZL6U/uSGSYSqtuatCkdWP0NHxRuht13D9OaM4x00=";

# Prevent tests from failing because they are fetching data at runtime.
postPatch = ''
substituteInPlace package.json --replace '"_mocha"' '""'
'';

# Pointing $out to $out/lib/node_modules/@antora/lunr-extension simplifies
# Antora's extension option usage from
#
# --extension ${pkgs.antora-lunr-extension}/lib/node_modules/@antora/lunr-extension
#
# to
#
# --extension ${pkgs.antora-lunr-extension}
postInstall = ''
directory="$(mktemp --directory)"
mv "$out/"{.,}* "$directory"
mv "$directory/lib/node_modules/@antora/lunr-extension/"{.,}* "$out"
'';

passthru = {
tests.run = antora.tests.run.override {
antora-lunr-extension-test = true;
};

updateScript = nix-update-script { };
};

meta = {
description = "Antora extension adding offline, full-text search powered by Lunr";
homepage = "https://gitlab.com/antora/antora-lunr-extension";
license = lib.licenses.mpl20;

longDescription = ''
This Antora extension is intended to be passed to `antora`'s `--extension`
flag or injected into the [`antora.extensions`
key](https://docs.antora.org/antora/3.1/extend/enable-extension).
'';

maintainers = [ lib.maintainers.naho ];
platforms = lib.platforms.all;
};
}
5 changes: 4 additions & 1 deletion pkgs/by-name/an/antora/test/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
antora,
antora-lunr-extension,
antora-lunr-extension-test ? false,
antora-ui-default,
gitMinimal,
lib,
stdenvNoCC,
}:
stdenvNoCC.mkDerivation {
name = "${antora.pname}-test";
name = "${antora.pname}${lib.optionalString antora-lunr-extension-test "-${antora-lunr-extension.pname}"}-test";
src = ./minimal_working_example;

postPatch =
Expand Down Expand Up @@ -43,6 +45,7 @@ stdenvNoCC.mkDerivation {
antora ${
lib.cli.toGNUCommandLineShell { } {
cache-dir = "$(mktemp --directory)";
extension = if antora-lunr-extension-test then antora-lunr-extension else false;
to-dir = placeholder "out";
ui-bundle-url = "${antora-ui-default}/ui-bundle.zip";
}
Expand Down

0 comments on commit d50a28e

Please sign in to comment.