Snapping a multi-package Node.js app

Hello, I have a Node CLI app which contains of several packages.

It’s a monorepo, and after building I have a couple of npm packages: libraries and the cli. CLI depends on those libraries. All of them aren’t published to the npm yet during the build.

If I use those libraries as parts with npm plugin, then the cli part fails as deps are not in the repo.

What would be the best way to implement this? Use nil plugin and do everything myself?

[update] It does what I need if I manually install them with nil plugin. But how to get Node.js into the snap in this case? stage-snaps are described as runtime dependencies, but they aren’t packed with the snap.

Would it be possible to show us the snapcraft.yaml, stage-snaps should work but I’d assume the nil plugin is interfering or the overrides you’re using aren’t comprehensive enough.

Personally I’m not a fan of the nil plugin. You can actually make your own implementation of plugins locally and I happen to have one that bundles a NodeJS application (using the node snap) that you could probably borrow from. Take a look at the snapcraft.yaml and plugin here for some inspiration. Hopefully it should be fairly clear what’s actually going on and you should be able to borrow from it for your use case here.

Thanks, I’ve retried the nil plugin and it actually works just fine with stage-snaps. I don’t know what was the issue, but I was getting 800KB snaps :smile: