!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

203 Members
58 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
14 Nov 2023
@lily:lily.flowersLily Fosteridk how yarn or yarn2nix does peer dep handling13:50:00
@joepie91:pixie.town@joepie91:pixie.townyarn 1.x treats peer dependencies as optional dependencies; it does not automatically install them, and just produce a warning if they are missing. this is what used to be the behaviour of npm as well. I don't know if newer Yarn versions have changed this13:51:37
@joepie91:pixie.town@joepie91:pixie.town * yarn 1.x treats peer dependencies as optional dependencies; it does not automatically install them, and just produces a warning if they are missing. this is what used to be the behaviour of npm as well. I don't know if newer Yarn versions have changed this13:51:43
@lily:lily.flowersLily Foster
In reply to @joepie91:pixie.town
yarn 1.x treats peer dependencies as optional dependencies; it does not automatically install them, and just produce a warning if they are missing. this is what used to be the behaviour of npm as well. I don't know if newer Yarn versions have changed this
but it otherwise does the circular resolution okay? i figure it's probably a yarn2nix bug anyway (there seems to be no shortage of those, unfortunately...)
13:52:32
@joepie91:pixie.town@joepie91:pixie.townI think circular dependencies are undefined behaviour in JS modules?13:54:36
@joepie91:pixie.town@joepie91:pixie.town not sure how Yarn handles those in general actually 13:54:45
@joepie91:pixie.town@joepie91:pixie.towntypical peer dependency use would involve one 'primary' package and a bunch of eg. plugin packages that peer-depend on that primary package; I've never really seen peer dependencies used outside of plugin architectures like that13:55:23
@joepie91:pixie.town@joepie91:pixie.townso that wouldn't be circular, exactly13:55:43
@lily:lily.flowersLily Fosteryeah i suppose they're not designed to be circular, but i thought they were designed to be used in scenarios that otherwise might be circular, like plugin deps13:57:30
@lily:lily.flowersLily Fosteridk i need coffee anyway and brain is not working well yet13:57:45
@lily:lily.flowersLily Foster(i'd definitely trust your judgement way more than my own on this anyway)13:58:46
@szucsitg:matrix.orgszucsitgI checked the code they really cross-referenced the project while not even declaring the module in package.json 🙄🤦‍♂️13:59:51
@joepie91:pixie.town@joepie91:pixie.town

perhaps there are circular plugin architecures, but usually it's more something like

const thing = require("thing");
const thingPluginA = require("thing-plugin-a);
const thingPluginB = require("thing-plugin-b");

let instance = thing({ plugins: thingPluginA, thingPluginB });

and so both the "core" package and the plugin packages are loaded from the application code, the plugins don't load the core and the core doesn't load the plugins, the peer dependency constraint just serves to give people a warning if they have an incompatible core and plugins in the same project

14:02:22
@joepie91:pixie.town@joepie91:pixie.town *

perhaps there are circular plugin architecures, but usually it's more something like

const thing = require("thing");
const thingPluginA = require("thing-plugin-a");
const thingPluginB = require("thing-plugin-b");

let instance = thing({ plugins: thingPluginA, thingPluginB });

and so both the "core" package and the plugin packages are loaded from the application code, the plugins don't load the core and the core doesn't load the plugins, the peer dependency constraint just serves to give people a warning if they have an incompatible core and plugins in the same project

14:02:28
@keiichi:matrix.org@keiichi:matrix.org

I wonder if it's possible to just install a list of dependencies https://github.com/svanderburg/node2nix#adding-unspecified-dependencies , like having a package.json

 [
  "floomatic"
]

npm update doesn't work so I think not. My original issue is that right now I need to use export NODE_PATH="${pulumiSdks}/lib/node_modules/PKG_NAME/lib/modules" while my package has 0 source code, it's just a compilation of dependencies (same package.json as my original)

14:09:55
15 Nov 2023
@kranzes:matrix.org@kranzes:matrix.org joined the room.12:41:52
@grahamc:nixos.org@grahamc:nixos.orgchanged room power levels.16:10:49
@grahamc:nixos.org@grahamc:nixos.org left the room.16:10:49
@qyliss:fairydust.space@qyliss:fairydust.space joined the room.17:38:27
@keiichi:matrix.org@keiichi:matrix.orgIt's funny how no one seems to be using typescript https://www.reddit.com/r/Nix/comments/x7tdxd/building_typescript_node_apps_with_nix/ https://www.reddit.com/r/NixOS/comments/16xlbk2/looking_for_help_to_use_nixos_in_a_typescript/17:41:43
@qyliss:fairydust.space@qyliss:fairydust.space left the room.17:48:57
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.18:12:40
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.18:12:40
@c0ba1t:matrix.orgCobalt
In reply to @keiichi:matrix.org
It's funny how no one seems to be using typescript https://www.reddit.com/r/Nix/comments/x7tdxd/building_typescript_node_apps_with_nix/ https://www.reddit.com/r/NixOS/comments/16xlbk2/looking_for_help_to_use_nixos_in_a_typescript/
We do use typescript, it's just compiled to JS in the build step. Otherwise, ts-node from nuxpkgs works too
19:11:41
16 Nov 2023
@adis:blad.is@adis:blad.is joined the room.05:13:13
@keiichi:matrix.org@keiichi:matrix.org

think I kinda managed to package my typescript program with buildNpmPackage but on run I get

$ jkops --help
Error: Cannot find module '/nix/store/z4dmxdr8v12cy6fzk723f0p9gyr7rxi4-jkops-1.0.0/lib/node_modules/jkops/node_modules/@aws-sdk/util-utf8-browser/dist-cjs/index.js'. Please verify that the package.json has a valid "main" entry
   at tryPackage (node:internal/modules/cjs/loader:438:19)
   at Function.Module._findPath (node:internal/modules/cjs/loader:680:18)
   at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
   at Function.Module._load (node:internal/modules/cjs/loader:922:27)
   at Module.require (node:internal/modules/cjs/loader:1143:19)
   at require (node:internal/modules/cjs/helpers:119:18)
   at Object.<anonymous> (/nix/store/z4dmxdr8v12cy6fzk723f0p9gyr7rxi4-jkops-1.0.0/lib/node_modules/jkops/node_modules/@aws-crypto/util/src/convertToBuffer.ts:5:1)
   at Module._compile (node:internal/modules/cjs/loader:1256:14)
   at Object.Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
   at Module.load (node:internal/modules/cjs/loader:1119:32)

usually I can manage this kind of issues with a bit of NODE_PATH shenaningan but the files dont seem to even exist in fd -uL dist-cjs/index.js /nix/store/z4dmxdr8v12cy6fzk723f0p9gyr7rxi4-jkops-1.0.0/. I can share the package{-lock}.json if it helps.

09:51:55

Show newer messages


Back to Room ListRoom Version: 6