From 3eea28e98228f17e9ac15db099b66b9f1260b906 Mon Sep 17 00:00:00 2001 From: polyfloyd Date: Tue, 26 Aug 2025 20:46:47 +0200 Subject: [PATCH] doc/javascript: Warn against the use of mkYarnPackage --- doc/languages-frameworks/javascript.section.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/languages-frameworks/javascript.section.md b/doc/languages-frameworks/javascript.section.md index 41c2a414a8fe..811b0687bbdd 100644 --- a/doc/languages-frameworks/javascript.section.md +++ b/doc/languages-frameworks/javascript.section.md @@ -15,13 +15,13 @@ Searching online for prior art can be helpful if you are running into solved pro ### Github {#javascript-finding-examples-github} -- Searching Nix files for `mkYarnPackage`: -- Searching just `flake.nix` files for `mkYarnPackage`: +- Searching Nix files for `yarnConfigHook`: +- Searching just `flake.nix` files for `yarnConfigHook`: ### Gitlab {#javascript-finding-examples-gitlab} -- Searching Nix files for `mkYarnPackage`: -- Searching just `flake.nix` files for `mkYarnPackage`: +- Searching Nix files for `yarnConfigHook`: +- Searching just `flake.nix` files for `yarnConfigHook`: ## Tools overview {#javascript-tools-overview} @@ -668,7 +668,8 @@ To install the package `yarnInstallHook` uses both `npm` and `yarn` to cleanup p #### yarn2nix {#javascript-yarn2nix} -WARNING: The `yarn2nix` functions have been deprecated in favor of `yarnConfigHook`, `yarnBuildHook` and `yarnInstallHook` (for Yarn v1) and `yarn-berry_*.*` tooling (Yarn v3 and v4). Documentation for `yarn2nix` functions still appears here for the sake of the packages that still use them. See also a tracking issue [#324246](https://github.com/NixOS/nixpkgs/issues/324246). +> [!WARNING] +> The `yarn2nix` functions have been deprecated in favor of `yarnConfigHook`, `yarnBuildHook` and `yarnInstallHook` (for Yarn v1) and `yarn-berry_*.*` tooling (Yarn v3 and v4). Documentation for `yarn2nix` functions still appears here for the sake of the packages that still use them. See also a tracking issue [#324246](https://github.com/NixOS/nixpkgs/issues/324246). ##### Preparation {#javascript-yarn2nix-preparation} @@ -687,6 +688,9 @@ If the downloaded files contain the `package.json` and `yarn.lock` files they ca ##### mkYarnPackage {#javascript-yarn2nix-mkYarnPackage} +> [!WARNING] +> The `mkYarnPackage` functions have been deprecated in favor of `yarnConfigHook`, `yarnBuildHook` and `yarnInstallHook` (for Yarn v1) and `yarn-berry_*.*` tooling (Yarn v3 and v4). Documentation for `mkYarnPackage` functions still appears here for the sake of the packages that still use them. See also a tracking issue [#324246](https://github.com/NixOS/nixpkgs/issues/324246). + `mkYarnPackage` will by default try to generate a binary. For packages only generating static assets (Svelte, Vue, React, Webpack, ...), you will need to explicitly override the build step with your instructions. It's important to use the `--offline` flag. For example if you script is `"build": "something"` in `package.json` use: