summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/js/json2ts/package.nix
blob: 55078689549d607b516510661509e4d0bc6ed5d0 (plain)
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
{
  buildNpmPackage,
  fetchFromGitHub,
  lib,
  jq,
}:
buildNpmPackage {
  pname = "json2ts";
  version = "15.0.2";
  src = fetchFromGitHub {
    owner = "bcherny";
    repo = "json-schema-to-typescript";
    rev = "118d6a8e7a5a9397d1d390ce297f127ae674a623";
    hash = "sha256-ldAFfw3E0A0lIJyDSsshgPRPR7OmV/FncPsDhC3waT8=";
  };

  nativeBuildInputs = [ jq ];
  npmDepsHash = "sha256-kLKau4SBxI9bMAd7X8/FQfCza2sYl/+0bg2LQcOQIJo=";

  # forceConsistentCasingInFileNames: false is needed for typescript on darwin
  # https://www.typescriptlang.org/tsconfig/#forceConsistentCasingInFileNames
  postConfigure = ''
    jq '.compilerOptions.forceConsistentCasingInFileNames = false' tsconfig.json > temp.json
    mv temp.json tsconfig.json
  '';

  meta = {
    mainProgram = "json2ts";
    description = "Compile JSON Schema to TypeScript type declarations";
    homepage = "https://github.com/bcherny/json-schema-to-typescript";
    changelog = "https://github.com/bcherny/json-schema-to-typescript/blob/master/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ hsjobeki ];
    platforms = lib.platforms.all;
  };
}