1{
2 buildNpmPackage,
3 fetchFromGitHub,
4 lib,
5 jq,
6}:
7buildNpmPackage {
8 name = "json2ts";
9 version = "15.0.2";
10 src = fetchFromGitHub {
11 owner = "bcherny";
12 repo = "json-schema-to-typescript";
13 rev = "118d6a8e7a5a9397d1d390ce297f127ae674a623";
14 hash = "sha256-ldAFfw3E0A0lIJyDSsshgPRPR7OmV/FncPsDhC3waT8=";
15 };
16
17 nativeBuildInputs = [ jq ];
18 npmDepsHash = "sha256-kLKau4SBxI9bMAd7X8/FQfCza2sYl/+0bg2LQcOQIJo=";
19
20 # forceConsistentCasingInFileNames: false is needed for typescript on darwin
21 # https://www.typescriptlang.org/tsconfig/#forceConsistentCasingInFileNames
22 postConfigure = ''
23 jq '.compilerOptions.forceConsistentCasingInFileNames = false' tsconfig.json > temp.json
24 mv temp.json tsconfig.json
25 '';
26
27 meta = with lib; {
28 mainProgram = "json2ts";
29 description = "Compile JSON Schema to TypeScript type declarations";
30 homepage = "https://github.com/bcherny/json-schema-to-typescript";
31 changelog = "https://github.com/bcherny/json-schema-to-typescript/blob/master/CHANGELOG.md";
32 license = licenses.mit;
33 maintainers = with maintainers; [ hsjobeki ];
34 platforms = platforms.all;
35 };
36}