{"action":"created","issue":{"url":"https://api.github.com/repos/pubref/rules_node/issues/55","repository_url":"https://api.github.com/repos/pubref/rules_node","labels_url":"https://api.github.com/repos/pubref/rules_node/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/pubref/rules_node/issues/55/comments","events_url":"https://api.github.com/repos/pubref/rules_node/issues/55/events","html_url":"https://github.com/pubref/rules_node/issues/55","id":293883076,"number":55,"title":"Solution for running/packaging native modules for Electron","user":{"login":"jondo2010","id":135094,"avatar_url":"https://avatars0.githubusercontent.com/u/135094?v=4","gravatar_id":"","url":"https://api.github.com/users/jondo2010","html_url":"https://github.com/jondo2010","followers_url":"https://api.github.com/users/jondo2010/followers","following_url":"https://api.github.com/users/jondo2010/following{/other_user}","gists_url":"https://api.github.com/users/jondo2010/gists{/gist_id}","starred_url":"https://api.github.com/users/jondo2010/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jondo2010/subscriptions","organizations_url":"https://api.github.com/users/jondo2010/orgs","repos_url":"https://api.github.com/users/jondo2010/repos","events_url":"https://api.github.com/users/jondo2010/events{/privacy}","received_events_url":"https://api.github.com/users/jondo2010/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-02-02T13:09:16Z","updated_at":"2018-02-03T20:38:42Z","closed_at":null,"author_association":"NONE","body":"While attempting to integrate my Electron app using `rules_node`, I've run into a roadblock with dependent modules that have a native build portion, in particular `grpc`.\r\n\r\nAt first I thought I could patch the call to `yarn` with some flag telling it to \"build/install for Electron\", which would result in a `yarn_modules` repository specifically built for Electron, but it seems this is not possible.\r\n\r\nDo you have any ideas about how this could be implemented?"},"comment":{"url":"https://api.github.com/repos/pubref/rules_node/issues/comments/362852417","html_url":"https://github.com/pubref/rules_node/issues/55#issuecomment-362852417","issue_url":"https://api.github.com/repos/pubref/rules_node/issues/55","id":362852417,"user":{"login":"pcj","id":50580,"avatar_url":"https://avatars3.githubusercontent.com/u/50580?v=4","gravatar_id":"","url":"https://api.github.com/users/pcj","html_url":"https://github.com/pcj","followers_url":"https://api.github.com/users/pcj/followers","following_url":"https://api.github.com/users/pcj/following{/other_user}","gists_url":"https://api.github.com/users/pcj/gists{/gist_id}","starred_url":"https://api.github.com/users/pcj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcj/subscriptions","organizations_url":"https://api.github.com/users/pcj/orgs","repos_url":"https://api.github.com/users/pcj/repos","events_url":"https://api.github.com/users/pcj/events{/privacy}","received_events_url":"https://api.github.com/users/pcj/received_events","type":"User","site_admin":false},"created_at":"2018-02-03T20:38:42Z","updated_at":"2018-02-03T20:38:42Z","author_association":"CONTRIBUTOR","body":"OK I think I have this working.  Here's what the `yarn_modules` rule looks like now:\r\n\r\n```python\r\nyarn_modules(\r\n    name = \"yarn_modules\",\r\n    deps = {\r\n        \"electron\": \"1.8.2-beta.4\",\r\n        \"electron-rebuild\": \"1.7.3\",\r\n        \"grpc\": \"^1.8.4\"\r\n    },\r\n    post_install = [\"{node}\", \"node_modules/electron-rebuild/lib/src/cli.js\"],\r\n)\r\n```\r\n\r\n1. Need to require electron-rebuild\r\n2. Need to invoke a post-install command to rebuild native libs.  The `{node}` pseudo-syntax will replace the actual path of the node exe bazel is using.\r\n\r\nAlso, electron-rebuild pulls in rxjs, to which @gregmagolan added a `BUILD.bazel` file fairly recently (first time I've seen a bazel build file in an npm module!).  This causes issues with package boundaries, so I added in a built-in post-install step to remove those from the installed node_modules tree.\r\n\r\nI'll push up a PR, let me know what you think."}}
{"actor":{"display_login":"pcj"}}