develar / app-builder

Generic helper tool to build app in a distributable format
MIT License
123 stars 62 forks source link

app-builder node-dep-tree should return node_modules shape or dependency tree ? #105

Closed fabienr closed 4 months ago

fabienr commented 9 months ago

Ran into difficulties to build an electron app because npm ci hoist dependencies without making any links (looks like pnpm from what I read but did not try it myself). app-builder node-dep-tree return a dependency tree which reflect module depends but not where they reside on the filesystem. electron-builder use this tree to copy all depends from a project to a dist bundle asar.

One solution is to also hoist the depends thus json output match node_modules shape instead of the dependency tree. What are your opinion, should electron-builder handle hoisted module itself or is it something all app-builder consumers need ? Perhaps a new command node-dep-paths ?

Please find a quick diff, with this I'm able to use electron-builder. See (https://github.com/electron-userland/electron-builder/issues/8068). patch-pkg_node-modules_nodeModuleCollector_go.patch

mmaietta commented 8 months ago

Probably would be useful for all app-builder consumers. I've put app-builder in an alpha release stage, so we could theoretically change the API since breaking changes will now be allowed for an app-builder 5.0.0