forked from nativefier/nativefier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix failing to global-sudo-install due to postinstall script (fix nat…
…ivefier#923) As documented in nativefier#923 (comment) , - nativefier#923 is caused by installing placeholder app deps at nativefier *install* time, with yarn (8.0.2) or npm (8.0.3). This is new in Nativefier 8.x, for the motivations behind it, see nativefier#898 (comment) - During testing, I did test global installs, but never to a system / non-user-writable path (my `$npm_config_prefix` is set to `"$HOME/.node_modules"`) - But without such a config and when installing globally to a non-user-writable/system path with `sudo npm i -g nativefier`, - Installation of nativefier core works... - ... but then `postinstall` tries to do its job of installing app deps, and fails in various OS-dependent ways, but all about access rights. I suspect that, although main nativefier install runs as `su` with access rights to system paths, `postinstall` scripts are run *out* of `su`. That would make sense for security reasons: out of hook scripts, npm knows exactly what will be touched in your filesystem: it's the static contents of the published tarball; a postinstall script with sudo rights could do nasty dynamic stuff. So, although I don't see any mention of that in [npm-scripts docs / hooks](https://docs.npmjs.com/misc/scripts#hook-scripts) and I haven't dug npm/cli's code, I can understand it. So, reverting back to `webpack`ing the placeholder app, as done pre-8.0.
- Loading branch information
Showing
9 changed files
with
67 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
target: 'node', | ||
entry: './src/main.ts', | ||
devtool: 'source-map', // https://webpack.js.org/configuration/devtool/ | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
use: 'ts-loader', // https://webpack.js.org/guides/typescript/ | ||
exclude: /node_modules/, | ||
}, | ||
], | ||
}, | ||
// Don't mock __dirname; https://webpack.js.org/configuration/node/#root | ||
node: { | ||
__dirname: false, | ||
}, | ||
// Prevent bundling of certain imported packages and instead retrieve these | ||
// external deps at runtime. This is what we want for electron, placed in the | ||
// app by electron-packager. https://webpack.js.org/configuration/externals/ | ||
externals: { | ||
electron: 'commonjs electron', | ||
}, | ||
resolve: { | ||
extensions: [ '.ts', '.js' ], | ||
}, | ||
output: { | ||
filename: 'main.js', | ||
path: path.resolve(__dirname, 'lib'), | ||
}, | ||
mode: 'none' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters