dream2nix icon indicating copy to clipboard operation
dream2nix copied to clipboard

Doesn't work with package-lock.json version 3

Open xyven1 opened this issue 11 months ago • 4 comments

Within the same project, if I npm install with npm 7 or 8, dream2nix works. If I npm install with npm 9 (which uses new package-lock.json version 3, instead of 2) dream2nix has the following error:

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/1xwpagjg133h2dg7bbflkzd6wa59dgca-dnm0vx1rml6nl8j5plg28wkhdcl7w5z8-source/ui
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "d2nPatchPhase" }
d2nPatchPhase
WARNING: Dependency @mdi/font wanted but not available. Ignoring.
WARNING: Dependency core-js wanted but not available. Ignoring.
WARNING: Dependency pinia wanted but not available. Ignoring.
WARNING: Dependency roboto-fontface wanted but not available. Ignoring.
WARNING: Dependency socket.io-client wanted but not available. Ignoring.
WARNING: Dependency vue wanted but not available. Ignoring.
WARNING: Dependency vue-router wanted but not available. Ignoring.
WARNING: Dependency vuetify wanted but not available. Ignoring.
WARNING: Dependency webfontloader wanted but not available. Ignoring.
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
Symlinking transitive executables to /build/package/.bin
@nix { "action": "setPhase", "phase": "buildPhase" }
building

> [email protected] build
> vue-tsc --noEmit && vite build

sh: line 1: vue-tsc: command not found

Other than package-lock version, nothing about the project changed.

xyven1 avatar Jul 10 '23 21:07 xyven1

Yes, support for them hasn't been implemented yet.

phaer avatar Jul 10 '23 21:07 phaer

Ok. Thanks for the quick response. What does the pathway for implementing them look like?

xyven1 avatar Jul 10 '23 21:07 xyven1

The way to move forward would be to implement a drv-parts module similar to the ones existing in v1/nix/modules/drv-parts.

The existing nodjs-package-lock translator there has a lot of legacy stuff in it which makes it unsuitable to build on top of.

Also lock file v3 is quite different from v1, therefore starting from scratch seems like a good idea.

The package lock v3 format already offers a lot of useful information like the exact path under node_modules for each dependency.

Building a new module that just parses the lock, fetches stuff, then builds the node_modules in a single derivation would be a good first start.

If you are interested in helping out, let me know, then I can provide some guidance and also pair up with you, if you like.

DavHau avatar Jul 10 '23 23:07 DavHau

Yeah, I might be interested in giving that a shot, but I think doing it as a pair would be best. Lmk if you're still interested. Just email me at [email protected]

xyven1 avatar Jul 12 '23 14:07 xyven1