Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix yarn workspaces on Windows #369

Merged
merged 5 commits into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dist-assets/windows/installer.nsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!include stdutils.nsh
!include winver.nsh

!addplugindir "${PROJECT_DIR}\windows\nsis-plugins\bin\Win32-Release"
!addplugindir "${BUILD_RESOURCES_DIR}\..\windows\nsis-plugins\bin\Win32-Release"

#
# NOTES
Expand Down Expand Up @@ -55,12 +55,12 @@
!macro ExtractDriver

SetOutPath "$TEMP\driver"
File "${PROJECT_DIR}\dist-assets\binaries\windows\driver\*"
File "${BUILD_RESOURCES_DIR}\binaries\windows\driver\*"

${If} ${IsWin7}
File "${PROJECT_DIR}\dist-assets\binaries\windows\driver\ndis5\*"
File "${BUILD_RESOURCES_DIR}\binaries\windows\driver\ndis5\*"
${Else}
File "${PROJECT_DIR}\dist-assets\binaries\windows\driver\ndis6\*"
File "${BUILD_RESOURCES_DIR}\binaries\windows\driver\ndis6\*"
${EndIf}

!macroend
Expand Down
4 changes: 2 additions & 2 deletions gui/packages/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"dependencies": {
"@mullvad/components": "0.1.0",
"babel-runtime": "^6.26.0",
"chai-as-promised": "^7.1.1",
"connected-react-router": "^4.3.0",
"d3-geo-projection": "^2.3.2",
"electron-log": "^2.2.8",
Expand Down Expand Up @@ -47,10 +46,11 @@
"babel-preset-react": "^6.24.1",
"browser-sync": "^2.23.6",
"chai": "^4.1.0",
"chai-as-promised": "^7.1.1",
"chai-spies": "^1.0.0",
"cross-env": "^5.1.3",
"electron": "^2.0.2",
"electron-builder": "^20.27.1",
"electron-builder": "^20.28",
"electron-devtools-installer": "^2.2.1",
"electron-mocha": "^6.0.4",
"enzyme": "^3.2.0",
Expand Down
6 changes: 5 additions & 1 deletion gui/packages/mobile/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ try {

try {
console.log('Adding a symlink to react-native');
fs.symlinkSync(sourcePath, symlinkPath);

// Symlinks require elevated permissions on Windows. Use junction instead.
const type = process.platform === 'win32' ? 'junction' : undefined;

fs.symlinkSync(sourcePath, symlinkPath, type);
console.log('Done');
} catch (error) {
console.error('Cannot symlink react-native: ' + error.message);
Expand Down
8 changes: 8 additions & 0 deletions gui/packages/yarn-fixes/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"private": true,
"name": "yarn-fixes",
"version": "0.1.0",
"scripts": {
"preinstall": "node ./patch-yarn.js"
}
}
31 changes: 31 additions & 0 deletions gui/packages/yarn-fixes/patch-yarn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Yarn 1.9.4 has a path lookup bug on Windows, when it looks for the binaries referenced in
// scripts under '\gui\node_modules\node_modules' instead of '\gui\node_modules'.
// This patch adds a junction between those two to keep that house of cards from falling apart.
// GitHub issue: https://github.com/yarnpkg/yarn/issues/4564

const path = require('path');
const fs = require('fs');

if (process.platform !== 'win32') {
return;
}

const sourcePath = path.resolve(path.join(__dirname, '../../node_modules'));
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;
}
}

try {
console.log('Applying yarn workspaces patch for node_modules/node_modules');
fs.symlinkSync(sourcePath, symlinkPath, 'junction');
console.log('Done');
} catch (error) {
console.error('Cannot symlink node_modules/node_modules: ' + error.message);
}
92 changes: 51 additions & 41 deletions gui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -772,35 +772,35 @@ anymatch@^2.0.0:
micromatch "^3.1.4"
normalize-path "^2.1.1"

[email protected].1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-2.1.1.tgz#02c6adfbfa3c09404a23ff7874d2cab5a8fcb9ca"
[email protected].2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-2.1.2.tgz#528ce8e543aa595210c9595f91bdf5638cecd79b"

app-builder-lib@20.27.1, app-builder-lib@~20.27.0:
version "20.27.1"
resolved "https://registry.yarnpkg.com/app-builder-lib/-/app-builder-lib-20.27.1.tgz#02d5da95cc68256ec3812999e9686d7f6dfdfcc1"
app-builder-lib@20.28.2, app-builder-lib@~20.28.0:
version "20.28.2"
resolved "https://registry.yarnpkg.com/app-builder-lib/-/app-builder-lib-20.28.2.tgz#5e126190acc17f53d9b2f3e3f5a99f07c35263f3"
dependencies:
"7zip-bin" "~4.0.2"
app-builder-bin "2.1.1"
app-builder-bin "2.1.2"
async-exit-hook "^2.0.1"
bluebird-lst "^1.0.5"
builder-util "6.0.0"
builder-util "6.1.2"
builder-util-runtime "4.4.1"
chromium-pickle-js "^0.2.0"
debug "^3.1.0"
ejs "^2.6.1"
electron-osx-sign "0.4.10"
electron-publish "20.27.0"
electron-publish "20.28.0"
fs-extra-p "^4.6.1"
hosted-git-info "^2.7.1"
is-ci "^1.1.0"
is-ci "^1.2.0"
isbinaryfile "^3.0.3"
js-yaml "^3.12.0"
lazy-val "^1.0.3"
minimatch "^3.0.4"
normalize-package-data "^2.4.0"
plist "^3.0.1"
read-config-file "3.1.0"
read-config-file "3.1.2"
sanitize-filename "^1.6.1"
semver "^5.5.0"
temp-file "^3.1.3"
Expand Down Expand Up @@ -1962,22 +1962,22 @@ [email protected], builder-util-runtime@^4.4.1:
fs-extra-p "^4.6.1"
sax "^1.2.4"

builder-util@6.0.0, builder-util@~6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-6.0.0.tgz#5f4941c096778758d8c186ef95eaa0e8b536cab8"
builder-util@6.1.2, builder-util@~6.1.0:
version "6.1.2"
resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-6.1.2.tgz#c96db6b33f9f60603c0ccd298dd25bba1eb3596a"
dependencies:
"7zip-bin" "~4.0.2"
app-builder-bin "2.1.1"
app-builder-bin "2.1.2"
bluebird-lst "^1.0.5"
builder-util-runtime "^4.4.1"
chalk "^2.4.1"
debug "^3.1.0"
fs-extra-p "^4.6.1"
is-ci "^1.1.0"
is-ci "^1.2.0"
js-yaml "^3.12.0"
lazy-val "^1.0.3"
semver "^5.5.0"
source-map-support "^0.5.6"
source-map-support "^0.5.8"
stat-mode "^0.2.2"
temp-file "^3.1.3"

Expand Down Expand Up @@ -2168,6 +2168,10 @@ ci-info@^1.0.0:
version "1.1.3"
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.3.tgz#710193264bb05c77b8c90d02f5aaf22216a667b2"

ci-info@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.4.0.tgz#4841d53cad49f11b827b648ebde27a6e189b412f"

circular-json@^0.3.1:
version "0.3.3"
resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66"
Expand Down Expand Up @@ -2654,13 +2658,13 @@ [email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/discontinuous-range/-/discontinuous-range-1.0.0.tgz#e38331f0844bba49b9a9cb71c771585aab1bc65a"

dmg-builder@5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/dmg-builder/-/dmg-builder-5.2.0.tgz#93d0c327fdd536794d8b7cf4fb16d1748ed8d9cf"
dmg-builder@5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/dmg-builder/-/dmg-builder-5.3.0.tgz#1b902c2438fe5ed8202987caa20efffdac057fcd"
dependencies:
app-builder-lib "~20.27.0"
app-builder-lib "~20.28.0"
bluebird-lst "^1.0.5"
builder-util "~6.0.0"
builder-util "~6.1.0"
fs-extra-p "^4.6.1"
iconv-lite "^0.4.23"
js-yaml "^3.12.0"
Expand Down Expand Up @@ -2773,20 +2777,20 @@ ejs@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.6.1.tgz#498ec0d495655abc6f23cd61868d926464071aa0"

electron-builder@^20.27.1:
version "20.27.1"
resolved "https://registry.yarnpkg.com/electron-builder/-/electron-builder-20.27.1.tgz#f3405280b5c5c5b2c7c0e8c6ac4c0d6b63375573"
electron-builder@^20.28:
version "20.28.2"
resolved "https://registry.yarnpkg.com/electron-builder/-/electron-builder-20.28.2.tgz#5ca19a117e9ee9c966ab4231958fe7463e598e62"
dependencies:
app-builder-lib "20.27.1"
app-builder-lib "20.28.2"
bluebird-lst "^1.0.5"
builder-util "6.0.0"
builder-util "6.1.2"
builder-util-runtime "4.4.1"
chalk "^2.4.1"
dmg-builder "5.2.0"
dmg-builder "5.3.0"
fs-extra-p "^4.6.1"
is-ci "^1.1.0"
is-ci "^1.2.0"
lazy-val "^1.0.3"
read-config-file "3.1.0"
read-config-file "3.1.2"
sanitize-filename "^1.6.1"
update-notifier "^2.5.0"
yargs "^12.0.1"
Expand Down Expand Up @@ -2839,12 +2843,12 @@ [email protected]:
minimist "^1.2.0"
plist "^2.1.0"

electron-publish@20.27.0:
version "20.27.0"
resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-20.27.0.tgz#0f44befa800b94458c78a8f63a4bc9109c5b5b10"
electron-publish@20.28.0:
version "20.28.0"
resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-20.28.0.tgz#226ba6ac5729e6b2f46d4b347281f17f8aa7f4a4"
dependencies:
bluebird-lst "^1.0.5"
builder-util "~6.0.0"
builder-util "~6.1.0"
builder-util-runtime "^4.4.1"
chalk "^2.4.1"
fs-extra-p "^4.6.1"
Expand Down Expand Up @@ -4123,12 +4127,18 @@ is-callable@^1.1.1, is-callable@^1.1.3:
version "1.1.4"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75"

is-ci@^1.0.10, is-ci@^1.1.0:
is-ci@^1.0.10:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5"
dependencies:
ci-info "^1.0.0"

is-ci@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.0.tgz#3f4a08d6303a09882cef3f0fb97439c5f5ce2d53"
dependencies:
ci-info "^1.3.0"

is-data-descriptor@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56"
Expand Down Expand Up @@ -6202,9 +6212,9 @@ reactxp@^1.3.3:
subscribableevent "^1.0.0"
synctasks "^0.3.3"

[email protected].0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/read-config-file/-/read-config-file-3.1.0.tgz#d433283c76f32204d6995542e4a04723db9e8308"
[email protected].2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/read-config-file/-/read-config-file-3.1.2.tgz#9b299cb7a2bcec1511a4c22e71620df0a2e3b896"
dependencies:
ajv "^6.5.2"
ajv-keywords "^3.2.0"
Expand Down Expand Up @@ -6910,9 +6920,9 @@ source-map-support@^0.4.15, source-map-support@^0.4.2:
dependencies:
source-map "^0.5.6"

source-map-support@^0.5.6:
version "0.5.6"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.6.tgz#4435cee46b1aab62b8e8610ce60f788091c51c13"
source-map-support@^0.5.8:
version "0.5.9"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.9.tgz#41bc953b2534267ea2d605bccfa7bfa3111ced5f"
dependencies:
buffer-from "^1.0.0"
source-map "^0.6.0"
Expand Down