summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-08-27 13:04:39 +0300
committerAndrej Mihajlov <and@mullvad.net>2018-08-27 14:28:26 +0300
commitfbf561034ee6e1ff78a34cd0acf277ff1a6fa11a (patch)
treef56c79bffbbd77038f6a29d3b8ebbc9b63e2885f /gui
parentc7cc855e1d081f76ac5bc5c68ab7ea773f1f9c4b (diff)
downloadmullvadvpn-fbf561034ee6e1ff78a34cd0acf277ff1a6fa11a.tar.xz
mullvadvpn-fbf561034ee6e1ff78a34cd0acf277ff1a6fa11a.zip
Unpatch yarn on postinstall
Diffstat (limited to 'gui')
-rw-r--r--gui/package.json1
-rw-r--r--gui/unpatch-yarn.js24
2 files changed, 25 insertions, 0 deletions
diff --git a/gui/package.json b/gui/package.json
index eccc37a3ea..c6eed545c5 100644
--- a/gui/package.json
+++ b/gui/package.json
@@ -4,6 +4,7 @@
"packages/*"
],
"scripts": {
+ "postinstall": "node unpatch-yarn.js",
"flow": "flow",
"lint": "eslint \"packages/**/*.js\"",
"format": "yarn run private:format --write",
diff --git a/gui/unpatch-yarn.js b/gui/unpatch-yarn.js
new file mode 100644
index 0000000000..0bf85629ac
--- /dev/null
+++ b/gui/unpatch-yarn.js
@@ -0,0 +1,24 @@
+// This is a companion script that reverts the effect of preinstall script in
+// `\gui\packages\yarn-fixes`.
+//
+// The symlink to `\gui\node_modules\node_modules` that fixes the bug, described in
+// https://github.com/yarnpkg/yarn/issues/4564, must be removed after node modules installation,
+// because circular symlinks cause scripts like electron-builder to crash.
+
+const path = require('path');
+const fs = require('fs');
+
+if (process.platform !== 'win32') {
+ return;
+}
+
+const symlinkPath = path.join(__dirname, 'node_modules/node_modules');
+
+try {
+ console.log('Removing a symlink to node_modules/node_modules');
+ fs.unlinkSync(symlinkPath);
+} catch (error) {
+ if (error.code !== 'ENOENT') {
+ throw error;
+ }
+}