anaisbetts / grunt-build-atom-shell

Grunt task to build Electron and rebuild node modules
MIT License
122 stars 11 forks source link

Rebuilding native modules causes issues with native modules used in grunt tasks #29

Open maxkorp opened 9 years ago

maxkorp commented 9 years ago

In my case, we're trying to use https://github.com/bwin/grunt-asar for packaging up our application contents, but when the build-atom-shell task runs, it rebuilds that task as well. Is there a way with npm to call rebuild only for dependencies, and not devdependencies? That might resolve the issue.

maxkorp commented 9 years ago

Hrm, apparently not https://github.com/npm/npm/issues/5952https://github.com/npm/npm/issues/5952

However I'm not sure that would be ideal anyways. As I mentioned in #26, I have a separate module that gets prepared for build elsewhere. Currently, once that's done, I just copy it in it's ready-to-build state into node_modules. That works, but if we only did dependencies, I wouldn't be able to do that anymore.

Perhaps an optional config parameter for nativeModulesToRebuild or something? and if it's null, just rebuild all like it currently does? I imagine it would still recurse. I'd be happy to try putting that in (I'm no good with Coffeescript, or RX.js but I don't think that would stop me) if it would be welcome.

anaisbetts commented 9 years ago

Hm, in Atom proper, the build folder gets its own package.json / node_modules, this should work. It'd be Hard(tm) to build some kind of filter, we don't have much control over this at all - we just ask npm to rebuild the module.

maxkorp commented 9 years ago

That's one way to handle it, and it's certainly not bad, although it might be a bit cleaner if we can handle the same folder solution. npm rebuild can take one or more specific modules to rebuild, so we could say if nativeModulesToRebuild or whatever is specified, we can just call npm rebuild moduleA moduleD