From 9db1e30da8c4af649f23ceb1f40a59109d82575b Mon Sep 17 00:00:00 2001 From: aMOPel Date: Thu, 5 Jun 2025 14:56:55 +0200 Subject: [PATCH] fix for the readme cli build test --- .../javascript.section.md | 28 +++++++++++++++++++ .../build-deno-package/external/default.nix | 6 +++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/doc/languages-frameworks/javascript.section.md b/doc/languages-frameworks/javascript.section.md index a925546d3944..d3458f85b435 100644 --- a/doc/languages-frameworks/javascript.section.md +++ b/doc/languages-frameworks/javascript.section.md @@ -911,6 +911,34 @@ Related options: : _Default:_ `[ "--allow-scripts" "--frozen" "--cached-only" ]` for `buildDenoPackage` : _Default:_ `[ "--allow-scripts" "--frozen" ]` for `buildDenoDeps` (`"--cached-only"` is filtered out) +::: {.tip} +If you receive and error like this: + +``` +error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it. +``` + +This can happen due to the `deno install` command deducing different packages, than what the actual package needs. + +To fix this, add the entrypoint to the install flags: + +```nix +{ buildDenoPackage, nix-gitignore }: +buildDenoPackage { + pname = "myPackage"; + version = "0.1.0"; + denoDepsHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + src = nix-gitignore.gitignoreSource [ ] ./.; + binaryEntrypointPath = "main.ts"; + denoInstallFlags = [ + "--entrypoint" + "" + ]; +} +``` + +::: + #### Private registries {#javascript-buildDenoPackage-private-registries} There are currently 2 options, which enable the use of private registries in a `buildDenoPackage` derivation. diff --git a/pkgs/test/build-deno-package/external/default.nix b/pkgs/test/build-deno-package/external/default.nix index 815912799a86..975da1de869d 100644 --- a/pkgs/test/build-deno-package/external/default.nix +++ b/pkgs/test/build-deno-package/external/default.nix @@ -3,13 +3,17 @@ readma-cli-linux = buildDenoPackage rec { pname = "readma-cli"; version = "2.11.0"; - denoDepsHash = "sha256-uh+yaT8oPMD0FRENH4LaoCsvbWmQ0j+xPbAL3e4Mfws="; + denoDepsHash = "sha256-xh+kP3yZvqzVXqypS3YFsIBmU/bp4YiNxvpK3/KlxAA="; src = fetchFromGitHub { owner = "elcoosp"; repo = "readma"; rev = "${version}"; hash = "sha256-FVQTn+r7Ztj02vNvqFZIRIsokWeo1tPfFYffK2tvxjA="; }; + denoInstallFlags = [ + "--entrypoint" + "./cli/mod.ts" + ]; binaryEntrypointPath = "./cli/mod.ts"; targetSystem = "x86_64-linux"; };