|
1 | 1 | { |
2 | 2 | lib, |
| 3 | + nodejs, |
3 | 4 | buildNpmPackage, |
4 | 5 | fetchFromGitHub, |
5 | | - makeWrapper, |
6 | 6 | redocly, |
7 | 7 | testers, |
8 | 8 | }: |
9 | 9 |
|
10 | 10 | buildNpmPackage rec { |
11 | 11 | pname = "redocly"; |
12 | | - version = "1.29.0"; |
| 12 | + version = "1.34.0"; |
13 | 13 |
|
14 | 14 | src = fetchFromGitHub { |
15 | 15 | owner = "Redocly"; |
16 | 16 | repo = "redocly-cli"; |
17 | 17 | rev = "@redocly/cli@${version}"; |
18 | | - hash = "sha256-Oa4R4R7Obg26DKWZkccqjIcrD35pBw1AYIPe2/KN8f4="; |
| 18 | + hash = "sha256-1iyE0LYbVEleCdSw6fWvIHqCkWMEZrjK6tum+qytcCY="; |
19 | 19 | }; |
20 | 20 |
|
21 | | - npmDepsHash = "sha256-V0NklVsPRqRJ479nIMWqs/sXciXOm6LAlIh3YcPPDEc="; |
| 21 | + npmDepsHash = "sha256-TIsVjdohsmvAAn9xQeeD5pu4CjXtYlD7bmKeDp113Lc="; |
22 | 22 |
|
23 | 23 | npmBuildScript = "prepare"; |
24 | 24 |
|
25 | | - nativeBuildInputs = [ makeWrapper ]; |
26 | | - |
27 | 25 | postBuild = '' |
28 | 26 | npm --prefix packages/cli run copy-assets |
29 | 27 | ''; |
30 | 28 |
|
31 | 29 | postInstall = '' |
32 | | - rm $out/lib/node_modules/@redocly/cli/node_modules/@redocly/{cli,openapi-core} |
| 30 | + rm $out/lib/node_modules/@redocly/cli/node_modules/@redocly/{cli,openapi-core,respect-core} |
33 | 31 | cp -R packages/cli $out/lib/node_modules/@redocly/cli/node_modules/@redocly/cli |
34 | 32 | cp -R packages/core $out/lib/node_modules/@redocly/cli/node_modules/@redocly/openapi-core |
35 | | -
|
36 | | - mkdir $out/bin |
37 | | - makeWrapper $out/lib/node_modules/@redocly/cli/node_modules/@redocly/cli/bin/cli.js \ |
38 | | - $out/bin/redocly \ |
39 | | - --set-default REDOCLY_TELEMETRY off \ |
40 | | - --set-default REDOCLY_SUPPRESS_UPDATE_NOTICE true |
| 33 | + cp -R packages/respect-core $out/lib/node_modules/@redocly/cli/node_modules/@redocly/respect-core |
| 34 | +
|
| 35 | + # Create a wrapper script to force the correct command name (Nodejs uses argv[1] for command name) |
| 36 | + mkdir -p $out/bin |
| 37 | + cat <<EOF > $out/bin/redocly |
| 38 | + #!${lib.getBin nodejs}/bin/node |
| 39 | + // Override argv[1] to show "redocly" instead of "cli.js" |
| 40 | + process.argv[1] = 'redocly'; |
| 41 | +
|
| 42 | + // Set environment variables directly |
| 43 | + process.env.REDOCLY_TELEMETRY = process.env.REDOCLY_TELEMETRY || "off"; |
| 44 | + process.env.REDOCLY_SUPPRESS_UPDATE_NOTICE = process.env.REDOCLY_SUPPRESS_UPDATE_NOTICE || "true"; |
| 45 | +
|
| 46 | + require('$out/lib/node_modules/@redocly/cli/node_modules/@redocly/cli/bin/cli.js'); |
| 47 | + EOF |
| 48 | + chmod +x $out/bin/redocly |
41 | 49 | ''; |
42 | 50 |
|
43 | 51 | passthru = { |
44 | | - tests.version = testers.testVersion { |
45 | | - package = redocly; |
46 | | - }; |
| 52 | + tests.version = testers.testVersion { package = redocly; }; |
47 | 53 | }; |
48 | 54 |
|
49 | 55 | meta = { |
|
0 commit comments