I've made some progress on packaging an electron app and come across an interesting question...
In order to create the node_module bundles, I need to have "husky" and "playwright" installed. I think playwright is needed for tests, but let's ignore that for a moment.
The node_module bundles are uploaded as sources, which isn't automated. Is there a rule that would compel us to package the tools required to generate the bundles?
In order to create the node_module bundles, I need to have "husky" and "playwright" installed. I think playwright is needed for tests, but let's ignore that for a moment.
There is the nodejs-packaging-bundler script (installed via rpm of the same name) that should semi-automate creating the nodejs_module tarballs for you. See the nodejs-packaging README [1] on how to use it.
Is there a rule that would compel us to package the tools required to generate the bundles?
Generally speaking, that would be the preferred approach in Fedora. OTOH, given that the nodejs ecosystem usually expects everything to be bundled in local node_modules, and the permanent exception to bundling nodejs rpms have, you can just bundle them with your app if you are not too interested in also providing and maintaining them for others to use.
On Mon, Oct 20, 2025 at 2:58 AM Jan Stanek jstanek@redhat.com wrote:
In order to create the node_module bundles, I need to have "husky" and
"playwright" installed. I think playwright is needed for tests, but let's ignore that for a moment.
There is the nodejs-packaging-bundler script (installed via rpm of the same name) that should semi-automate creating the nodejs_module tarballs for you. See the nodejs-packaging README [1] on how to use it.
Right, I'm using that. But podman desktop's package.json needs husky in a "prepare" step, and playwright in a "postinstall" step. Both modules are listed as devDepedencies, but npm pack fails if they are not available in the user's PATH before running nodejs-packaging-bundler
https://github.com/podman-desktop/podman-desktop/blob/main/package.json#L111...
Is there a rule that would compel us to package the tools required to generate the bundles?
Generally speaking, that would be the preferred approach in Fedora. OTOH, given that the nodejs ecosystem usually expects everything to be bundled in local node_modules, and the permanent exception to bundling nodejs rpms have, you can just bundle them with your app if you are not too interested in also providing and maintaining them for others to use.
Bundling them won't work because they're required to create the bundle. :)
On Wed, Oct 22, 2025 at 4:44 AM Gordon Messmer gmessmer@redhat.com wrote:
Right, I'm using that. But podman desktop's package.json needs husky in a "prepare" step, and playwright in a "postinstall" step. Both modules are listed as devDepedencies, but npm pack fails if they are not available in the user's PATH before running nodejs-packaging-bundler
https://github.com/podman-desktop/podman-desktop/blob/main/package.json#L111...
Bundling them won't work because they're required to create the bundle. :)
Ah, I see. In that case packaging the tools as rpms would probably be the way to go; either that or patching the package in a way that would remove the usage of the tools. Not sure if that's viable in your case; I managed to get rid of husky in case of nodejs-undici, as there it was only used to set up git hooks (which were not necessary for the build): https://src.fedoraproject.org/rpms/nodejs-undici/blob/rawhide/f/undici-sourc...
Hopefully packaging those tools won't be a too deep of a rabbit hole. Good luck!
On Wed, Oct 22, 2025 at 2:54 AM Jan Stanek jstanek@redhat.com wrote:
Hopefully packaging those tools won't be a too deep of a rabbit hole. Good luck!
husky and playwright were straightforward, but podman-desktop needs vite, and both of them require rollup... and I haven't really figured out how to package rollup yet.
I've opened https://src.fedoraproject.org/rpms/nodejs-packaging/pull-request/18 and could use some feedback. podman-desktop requires pnpm to build, and I'm not sure if it would be preferable to have one bundler script that can run whichever tool is needed, or if it would be better to have separate scripts. I also wanted to ask if npm should "--ignore-scripts" when building the node_modules folders. I know that some source gathering scripts exclude specific scripts, but it seems like any scripts should run in the build phase rather than when gathering node_modules.
At least rollup ends up trying to build rust modules while bundling modules, which is obviously the wrong thing to do.
On Tue, Nov 4, 2025 at 5:16 AM Gordon Messmer gmessmer@redhat.com wrote:
I've opened https://src.fedoraproject.org/rpms/nodejs-packaging/pull-request/18 and could use some feedback. podman-desktop requires pnpm to build, and I'm not sure if it would be preferable to have one bundler script that can run whichever tool is needed, or if it would be better to have separate scripts. I also wanted to ask if npm should "--ignore-scripts" when building the node_modules folders. I know that some source gathering scripts exclude specific scripts, but it seems like any scripts should run in the build phase rather than when gathering node_modules.
The script exists to make our work easier, so if you can extend it without it being too convoluted, I will likely accept the changes. Unfortunately here I suffer from not actually having any JS projects under my belt, nor really having to package anything that would require anything other than npm, so my insight is limited. So use your best judgement and we can discuss the particulars once I can give the PR a proper read over.
Ditto for the `--ignore-scripts` – from the face value it seems reasonable, no idea how much this will break things.
nodejs@lists.fedoraproject.org