Commit Graph

41 Commits

Author SHA1 Message Date
Winter
ac35d7ea86
prefetch-npm-deps: look up hashes from cache when fixing up lockfiles 2023-04-30 10:29:46 -04:00
Winter
7efebca89c
prefetch-npm-deps: fix reproducibility
v1 lockfiles can contain multiple references to the same version of a
package, and these references can contain different `integrity` values,
such as one having SHA-1 and SHA-512, while another just has SHA-512.

Given that HashMap iteration order isn't defined, this causes
reproducibility issues, as a different integrity value could be chosen
each time.

Thanks to @lilyinstarlight for discovering this issue originally, as well
as the idea for the sorting-based implementation.
2023-04-28 18:09:39 -04:00
Winter
faa3de1bf5
prefetch-npm-deps: fix clippy lint 2023-04-06 11:32:47 -04:00
Winter
e1d64c1941
prefetch-npm-deps: throw better error when unsupported git service is used
See https://github.com/NixOS/nixpkgs/pull/206476#discussion_r1058689383.
2023-04-06 11:32:47 -04:00
Winter
7e247e6fec
prefetch-npm-deps: download dev deps for git deps with install scripts
Git dependencies with install scripts are built isolated from the main
package, so their development dependencies are required.

To take advantage of this, #206477 is needed.
2023-04-06 11:32:39 -04:00
Winter
3e68a27822
prefetch-npm-deps: refactor
This splits prefetch-npm-deps into multiple files, as well as making a
few small changes along the way, such as going from a `HashMap` to a `Vec`
as the container for packages, to deduplicate them more efficently.
2023-04-06 11:32:23 -04:00
github-actions[bot]
507feca606
Merge master into staging-next 2023-02-20 12:01:32 +00:00
Yureka
20539ac23d prefetch-npm-deps: add nix to PATH
Fixes "No such file or directory" error when running prefetch-npm-deps
in its default mode (print hashes, for update scripts etc),
in an environment that doesn't have a `nix` binary (for `nix hash`).
2023-02-20 01:20:56 -05:00
Artturin
4e3dcf364e treewide: makeSetupHook deps -> propagatedBuildInputs 2023-02-07 21:02:00 +02:00
Artturin
b36d9696c5 treewide: fix error: attribute 'runtimeShell' missing 2022-12-22 20:50:27 +02:00
Winter
865387061f npmHooks.npmBuildHook: fix diagnostic
Single quotes must be used when using graves in a quote, else Bash will interpret it as a command to run.

Thanks to Dimitri for catching this (8e651111b7 (commitcomment-92100762)).
2022-12-19 18:47:09 -05:00
Lily Foster
669f019379 npmHooks.npmConfigHook: make diagnostic match prefetch-npm-deps
This updates the diagnostic message for a missing package-lock.json to
match what fetchNpmDeps currently says
2022-12-19 18:47:09 -05:00
Winter
7ab5323cfb npmHooks.npmInstallHook: pass --no-save to prune 2022-11-25 15:47:05 -05:00
Sandro Jäckel
fde0382efd buildNpmPackage: forward pre/postPatch to fetchNpmDeps 2022-11-25 15:47:05 -05:00
Sandro
84477691f7 fetchNpmDeps: allow package-json.lock symlinks, update hint 2022-11-25 15:47:05 -05:00
Lily Foster
b023946d2b prefetch-npm-deps: fix hash stability
GNU tar will apparently silently include mtime of files if --mtime is
passed with an unrecognized date format. This led to hash instability
from those mtimes and this fixes it to force all mtimes to epoch
timestamp 0.
2022-11-23 20:52:08 -05:00
Winter
009a234bdd prefetch-npm-deps: repack hosted git deps
Previously, we stored the tarballs from the hosted Git providers directly in the cache. However, as we've seen with `fetchFromGitHub` etc, these files may change subtly.

Given this, this commit repacks the dependencies before storing them in the cache.
2022-11-21 15:00:08 -05:00
Winter
091d039b12 prefetch-npm-deps: deduplicate dependencies when parsing lockfile
A `package-lock.json` file can contain multiple instances of the same dependency, which caused unnecessary downloads and duplicate index entries in the generated cache.
2022-11-21 15:00:08 -05:00
Winter
b117b359db prefetch-npm-deps: move tests to separate file 2022-11-21 15:00:08 -05:00
Winter
3d5f77f496 npmHooks.npmConfigHook: sugget specifying legacy peer deps option for all commands 2022-11-21 15:00:08 -05:00
Winter
93334f5234 npmHooks.npmInstallHook: pass install flags to prune 2022-11-21 15:00:08 -05:00
Winter
80ecb954e9 npmHooks.npmConfigHook: add diagnostic for when dependencies aren't provided 2022-11-21 15:00:08 -05:00
Winter
c0e7124bcc npmHooks.npmConfigHook: add some missing quotes around variable assignments 2022-11-21 15:00:08 -05:00
Winter
68d5b19fca npmHooks.npmConfigHook: also patch shebangs after rebuilding 2022-11-21 15:00:08 -05:00
Winter
8e651111b7 npmHooks.npmBuildHook: mention dontNpmBuild if script fails to run 2022-11-21 15:00:08 -05:00
Winter
c6903a01e7 prefetch-npm-deps: add etherpad-lite v1.8.18 as a test 2022-11-21 15:00:08 -05:00
Winter
03a7739d75 prefetch-npm-deps: skip bundled dependencies in v1 lockfiles 2022-11-21 15:00:08 -05:00
Winter
276982bd5e prefetch-npm-deps: add support for hosted git shorthands 2022-11-21 15:00:08 -05:00
Winter
cc5756b171 prefetch-npm-deps: add support for link dependencies in v2 lockfiles 2022-11-21 15:00:08 -05:00
Artturin
341e6fd558 splice.nix: start deprecating nativeDrv and crossDrv 2022-11-19 00:04:54 +02:00
Winter
16722903aa buildNpmPackage: init 2022-11-09 10:35:59 -05:00
Yureka
aa3dc6440e
fetchYarnDeps: support passing src attribute (#193047) 2022-10-02 22:41:31 +02:00
Chuang Zhu
e3e091672f
fetchYarnDeps: support hash in pkg.integrity (#177255) 2022-06-15 20:13:41 +02:00
Robert Hensing
c071530ca5 testers.invalidateFetcherByDrvHash: Move from top-level 2022-05-05 12:08:50 +02:00
Yureka
c420487e0b fetchYarnDeps: support more url types 2021-12-30 11:13:25 +01:00
Yureka
842a0d94cb fetchYarnDeps: use fakeSha256 if no hash is given 2021-10-29 02:43:42 +09:00
Yureka
1565ab9717 prefetch-yarn-deps: ignore file: dependencies 2021-10-29 02:43:42 +09:00
Yureka
6c99b3d0b7 prefetch-yarn-deps: support git:// dependencies 2021-10-29 02:43:42 +09:00
Yuka
49a5b293b9
prefetch-yarn-deps: add nix dependency (#142664)
fixes "Error: spawn nix-hash ENOENT"
2021-10-23 19:13:34 +02:00
Yureka
84e02be598 fetchYarnDeps, mkYarnModules: verify the FOD hash is up-to-date 2021-10-20 11:39:16 +02:00
Yureka
d6e0195ccd prefetch-yarn-deps, fetchYarnDeps: init 2021-10-20 11:39:16 +02:00