diff --git a/package.json b/package.json index 474ef09..5b9ffe7 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,11 @@ "appId": "im.riot.app", "electronVersion": "7.1.3", "files": [ - "node_modules/**", + "package.json", + { + "from": ".hak/hakModules", + "to": "node_modules" + }, "src/**" ], "extraResources": [ diff --git a/scripts/hak/fetch.js b/scripts/hak/fetch.js index 7714ad0..27727cc 100644 --- a/scripts/hak/fetch.js +++ b/scripts/hak/fetch.js @@ -105,7 +105,15 @@ async function fetch(hakEnv, moduleInfo) { }); // also extract another copy to the output directory at this point - // nb. we do not yarn install in the output copy + // nb. we do not yarn install in the output copy: we could install in + // production mode to get only runtime dependencies and not devDependencies, + // but usually native modules come with dependencies that are needed for + // building/fetching the native modules (eg. node-pre-gyp) rather than + // actually used at runtime: we do not want to bundle these into our app. + // We therefore just install no dependencies at all, and accept that any + // actual runtime dependencies will have to be added to the main app's + // dependencies. We can't tell what dependencies are real runtime deps + // and which are just used for native module building. await mkdirp(moduleInfo.moduleOutDir); await tar.x({ file: tarballFile, diff --git a/scripts/hak/index.js b/scripts/hak/index.js index cfb75c0..3c02880 100644 --- a/scripts/hak/index.js +++ b/scripts/hak/index.js @@ -76,7 +76,7 @@ async function main() { moduleHakDir: path.join(prefix, 'hak', dep), moduleDotHakDir: path.join(hakEnv.dotHakDir, dep), moduleBuildDir: path.join(hakEnv.dotHakDir, dep, 'build'), - moduleOutDir: path.join(hakEnv.dotHakDir, dep, 'out'), + moduleOutDir: path.join(hakEnv.dotHakDir, 'hakModules', dep), nodeModuleBinDir: path.join(hakEnv.dotHakDir, dep, 'build', 'node_modules', '.bin'), depPrefix: path.join(hakEnv.dotHakDir, dep, 'opt'), scripts: {},