about summary refs log tree commit diff
path: root/pkgs/development/tools/react-static/default.nix
blob: ea21f3ca3e4cf3c095b1087b05d43f46da870505 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{ lib
, mkYarnPackage
, fetchFromGitHub
, fetchYarnDeps
}:

mkYarnPackage rec {
  pname = "react-static";
  version = "7.6.2";

  src = fetchFromGitHub {
    owner = "react-static";
    repo = "react-static";
    rev = "v${version}";
    hash = "sha256-dlYmD0vgEqWxYf7E0VYstZMAuNDGvQP7xDgHo/wmlUs=";
  };

  packageJSON = ./package.json;

  offlineCache = fetchYarnDeps {
    yarnLock = "${src}/yarn.lock";
    hash = "sha256-SNnJPUzv+l2HXfA6NKYpJvn/DCX3a42JQ3N0+XYKbd8=";
  };

  buildPhase = ''
    runHook preBuild

    yarn --cwd deps/react-static/packages/react-static --offline build

    runHook postBuild
  '';

  doDist = false;

  installPhase = ''
    runHook preInstall

    mkdir -p "$out/lib/node_modules"
    mv deps/react-static/packages/react-static "$out/lib/node_modules"
    mv node_modules "$out/lib/node_modules/react-static"

    ln -s "$out/lib/node_modules/react-static/bin" "$out"

    runHook postInstall
  '';

  meta = {
    changelog = "https://github.com/react-static/react-static/blob/${src.rev}/CHANGELOG.md";
    description = "Progressive static site generator for React";
    homepage = "https://github.com/react-static/react-static";
    license = lib.licenses.mit;
    mainProgram = "react-static";
    maintainers = with lib.maintainers; [ ];
  };
}