about summary refs log tree commit diff
path: root/pkgs/development/tools/yarn2nix-moretea/yarn2nix
AgeCommit message (Collapse)AuthorFilesLines
2024-06-17yarn2nix: avoid appearing to include srcPhilip Taron1-19/+9
This expression didn't actually include src, but it looked like it did. Make it like others by using a fileset (for instance, #319883)
2024-04-01treewide: point wiki links to official wikiJulien Malka1-1/+1
2023-07-11mkYarnPackage: use provided pnameSandro Jäckel1-24/+25
Before it was unexpectedly overwritten to the name in package.json which breaks meta.mainProgram and through that nix run nixpkgs#prettierd
2023-07-11yarn2nix: cleanupsSandro Jäckel1-6/+6
2023-04-11mkYarnPackage: fix uncopied resolutions fieldGuillaume Desforges1-3/+11
Yarn only uses the "resolutions" field in the top-level package.json file of a workspace. While it has been taken into account for mkYarnWorkspace (9801e6e53dc321e860c822f7f3c370e76d218a42), it has not been fixed for mkYarnPackage yet, which also uses the yarn workspace mechanism under the hood. A bit of care was needed because we don't want to introduce any IFD.
2023-02-06Merge pull request #206773 from SuperSandro2000/cleanup-unused-bindingsfigsoda1-1/+1
treewide: cleanup some unused bindings
2023-02-07treewide: cleanup some unused bindingsSandro Jäckel1-1/+1
2023-01-19yarn2nix: add easy yarn & nodejs pkg overridesMel Bourgeois1-3/+9
Projects often require a specific major version of NodeJS, and sometimes a specific yarn version. Since yarn2nix utilities are accessed from nixpkgs now, there is no simple way to override versions of nodejs and yarn without complex solutions like an overlay. This adds `yarn` and `nodejs` as optional attribute arguments to `mkYarnModules`, `mkYarnPackage`, and `mkYarnWorkspace`. They default to the same versions that are currently being used, and the nodejs input to yarn is overridden so that it will match if only `nodejs` is overridden by the user. These arguments will also cascade from `mkYarnWorkspace` -> `mkYarnPackage` -> `mkYarnModules`, making per-package overrides very simple.
2022-12-18Merge pull request #197185 from Smona/handle-multiple-integrity-hashesRyan Lahfa11-675/+759
yarn2nix: Handle lockfile entries with multiple integrity hashes
2022-11-23mkYarnPackage: fix metaNaïm Favier1-6/+5
Correctly inherit meta attributes from `package.json`.
2022-11-09yarn2nix: allow running scriptsSandro Jäckel1-3/+3
2022-10-30yarn2nix: limit ssri parsing to supported algorithmsMel Bourgeois3-532/+544
Nix supports md5, sha1, sha256, and sha512 hashes. The first two are deprecated, but many npm packages provide only a sha1, so we have to allow that one. This commit continues to leverage `ssri` for reliable integrity string parsing and algorithm selection, but limits it to only supported hash algorithms. It also switches the hash representation in the generated nix file to base64, since that format is supported by nix (suggested by jtojnar). This saves a little disk space and computation. Finally, it adds a .prettierignore file, since prettier called with the arguments in the format command currently tries to format node_modules.
2022-10-26yarn2nix: format codeMel Bourgeois8-159/+179
2022-10-26yarn2nix: Handle lockfile entries with multiple integrity hashesMel Bourgeois4-289/+341
Some NPM packages provide multiple integrity hashes with different algorithms. These are space separated, like below: ``` tar@^4: version "4.4.19" resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.19.tgz#2e4d7263df26f2b914dee10c825ab132123742f3" integrity "sha1-Lk1yY98m8rkU3uEMglqxMhI3QvM= sha512-a20gEsvHnWe0ygBY8JbxoM4w3SJdhc7ZAuxkLqh+nvNQN2IOt0B5lLgM490X5Hl8FF0dl0tOf2ewFYAlIFgzVA==" ``` Currently, yarn2nix isn't able to handle these lockfile entries, producing an error like `error: hash 'Lk1yY98m8rkU3uEMglqxMhI3QvM= sha512' has wrong length for hash type 'sha1'`. This is because it isn't aware that spaces could separate multiple hashes. This commit uses the official Standard Subresource Integrity package from npm to parse the integrity line, and pick the best available algorithm. It also replaced many of the local yarn2nix entries with sha512, even ones that don't include it in the lockfile. Not sure how that happened, but it works in practice! The addition of `ssri` may also reduce signs and symptoms of depression.
2022-07-24yarn2nix: change yarnFlags to append by defaultSandro Jäckel1-3/+3
The main usecase for this variable is to append --production to yarn which now got a whole lot easier because you no longer need to repeat the defaults.
2022-05-31yarn2nix: allow setting doDist by calling packagesSumner Evans1-1/+1
2022-05-03yarn2nix: extend NixOS/nix#5128 workaround to 2.4+Naïm Favier1-1/+2
The issue was not fixed in later versions, so we need the workaround for all versions greater than `2.4pre`.
2022-04-01config.allowAliases: Define as optionRobert Hensing1-1/+1
This simplifies usages and makes the default value consistent. In a few cases, the default value was interpreted to be `false`, but this is useless, because virtually nobody will explicitly set `allowAliases = true;`.
2022-03-24Merge pull request #128119 from Simspace/yarn2nix-preserve-resolutionsSilvan Mosberger1-4/+8
yarn2nix: preserve top-level package.json resolutions field in workspace
2022-03-23yarn2nix: preserve top-level package.json resolutions field in workspaceRichard Wallace1-4/+8
The `package.json` produced when building node_modules for a workspace ignores the `resolutions` from the project `package.json`. This results in dependencies being resolved in a way that conflicts with the `yarn.lock` file. To fix this, we need to preserve the `resolutions`.
2022-03-05yarn2nix: support new yarn workspace jsonThomas Baggaley1-1/+1
2022-01-28yarn2nix: Add support for nativeBuildInputs in pkgConfigJan Tojnar1-4/+10
2021-12-09Merge pull request #119522 from AmineChikhaoui/yarn2nix-use-integrity-fieldJan Tojnar2-5/+5
yarn2nix: use yarn lockfile integrity field whenever possible
2021-12-04yarn2nix: use yarn lockfile integrity field whenever possibleAmineChikhaoui2-5/+5
Whenever available use the SRI hashes from the integrity field to create the fetchurl calls instead of entirely relying on the `resolved` sha1 which may or may not exist with recent yarn versions. Related issues: - https://github.com/nix-community/yarn2nix/issues/125 - https://github.com/NixOS/nixpkgs/issues/77238
2021-12-02lib/meta: add getLicenseFromSpdxId functionShamrock Lee1-11/+14
Move function spdxLicense, internally used in yarn2nix to lib/meta.nix, and rename to getLicenseFromSpdxId A similar function is implemented in poetry2nix, but the one originally in yarn2nix seems beter. since it falls back to an license-like attrset for mismatched case instead of a plain string
2021-10-31yarn2nix: add nix-prefetch-git to PATHYureka1-0/+6
2021-10-31yarn2nix: no sha1 for github tarballsYureka1-1/+1
Since b27d18a412b we fetch packages with codeload.github.com tarballs as resolved field with fetchgit. The sha1 of the tarball is irrelevant, instead nix-prefetch-git will be used to determine the expected fetchgit FOD hash. Fixes #143828
2021-10-20fetchYarnDeps, mkYarnModules: verify the FOD hash is up-to-dateYureka1-1/+6
2021-10-20mkYarnModules: allow passing custom offlineCacheYureka1-3/+3
2021-10-14yarn2nix: fix running without --no-patchYureka1-1/+1
2021-10-10yarn2nix: fix "rev is not defined" (#141207)Yuka1-1/+1
Must have slipped in when incorporating comments on #136922
2021-10-10yarn2nix: workaround for NixOS/nix#5128Yureka1-2/+4
2021-10-08yarn2nix: handle codeload.github.com uris in IFD mode (#136922)Yuka2-5/+15
2021-09-26yarn2nix: run `nix-prefetch-git` with `--fetch-submodules`Maximilian Bosch1-1/+1
`pkgs.fetchgit` uses `fetchSubmodules = true;` by default, however `nix-prefetch-git` doesn't. This means that hashes for a Git repository with fetched submodules will be wrong in `yarn.nix`. Considering that this got unnoticed before, it seems as if this case is an exception to a certain degree. An exemplary problem is the last `hedgedoc` update[1] where `js-sequence-diagrams` - a Git repo with submodules - from upstream's package.json caused a hash mismatch. This got unnoticed because `nix-build --check` doesn't seem to reveal these issues for fixed-output derivations. [1] https://github.com/NixOS/nixpkgs/pull/139238
2021-08-22yarn2nix: replace simple mkDerivation with runCommandLocalFelix Buehler1-16/+11
2021-08-16yarn2nix: deprecate phasesFelix Buehler1-1/+2
2021-08-15treewide: runCommandNoCC -> runCommand in generated codeRobert Hensing1-1/+1
This has been synonymous for ~5y. Note that many of these runCommand bindings are unused, but that's ok for generated code.
2021-08-15yarn2nix-moretea: Generate runCommand instead of -NoCCRobert Hensing1-2/+2
This has been synonymous for ~5y.
2021-06-09Merge pull request #101521 from egasimus/patch-2Sandro1-0/+2
2021-06-02yarn2nix: set `name` to `${pname}-${version}` by defaultMaximilian Bosch1-1/+1
2021-01-01yarn2nix: improve naming regexeslassulus1-2/+2
Originally submitted in https://github.com/nix-community/yarn2nix/pull/128
2021-01-01yarn2nix: yarn updatelassulus2-1185/+1501
2020-12-30yarn2nix: Handle codeload.github.com tarballslassulus1-1/+9
This was submitted originally in https://github.com/nix-community/yarn2nix/pull/130
2020-12-13mkYarnPackage: allow overriding versionGabriel Ebner1-1/+1
2020-12-08yarn2nix: expose yarnPostBuildAdam Avramov1-0/+2
The way I see it, there's no point in the argument being there if it can't be used. Right now its lack currently prevents a workaround for an issue I can't wrap my head around - first encountered [here](https://logs.nix.samueldr.com/nixos-dev/2019-08-28#2532857;).
2020-10-09yarn2nix-moretea: re-add support for `git://` URLs from `yarn.lock`Maximilian Bosch1-1/+1
@lheckemann already added it to `yarn2nix` a while ago[1], but it seems as it was forgotten to include when adding `yarn2nix` sources to `nixpkgs` itself. Without this patch, you cannot add dependencies to your `package.json` with URLs like `git://github.com/.../` as building the expression would fail like this: ``` curl: (1) Protocol "git" not supported or disabled in libcurl error: cannot download git___github.com_sstur_nodeftpd.git from any mirror ``` Co-authored-by: Linus Heckemann <git@sphalerite.org> [1] https://github.com/nix-community/yarn2nix/pull/141
2020-07-10yarn2nix: Don't pass yarnNix to mkDerivation (#92856)Silvan Mosberger1-2/+2
The generated yarnNix file doesn't need to be part of the mkDerivation. And doing so prevents other platforms from reproducibly instantiating it. With this change you can e.g. do darwinPkgs.yarn2nix.mkYarnPackage { # ... yarnNix = pkgs.yarn2nix.mkYarnNix { yarnLock = ./yarn.lock; }; } Which is a darwin derivation, but can still be instantiated reproducibly on Linux.
2019-11-22yarn2nix-moretea: v1.0.0-36-g3f2dbb0 -> v1.0.0-39-g9e7279e (#73911)Milan1-1/+6
Includes the following upstream commits: - Fix for package.json without a version (moretea/yarn2nix#113) - Don't access package.json via filtered src (moretea/yarn2nix#115) - remove redundant rec (moretea/yarn2nix#119)
2019-08-28treewide: remove redundant recvolth1-1/+1
2019-07-25yarn2nix-moretea: init at 2019-04-10WilliButz13-0/+8841