From 25951e7097d9e02c45dd9872bab3e283b98f8543 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Sun, 3 Mar 2019 00:51:54 +0000 Subject: [PATCH] Trying to fix Windows 32-bit build --- ElectronClient/app/electronRebuild.js | 50 ++++++++++++++++++++++++++ ElectronClient/app/package-lock.json | 52 +++++++++++++++++++-------- ElectronClient/app/package.json | 2 +- joplin.sublime-project | 3 +- 4 files changed, 91 insertions(+), 16 deletions(-) create mode 100644 ElectronClient/app/electronRebuild.js diff --git a/ElectronClient/app/electronRebuild.js b/ElectronClient/app/electronRebuild.js new file mode 100644 index 000000000..ae3d5b0b4 --- /dev/null +++ b/ElectronClient/app/electronRebuild.js @@ -0,0 +1,50 @@ +const execCommand = function(command) { + const exec = require('child_process').exec + + console.info('Running: ' + command); + + return new Promise((resolve, reject) => { + let childProcess = exec(command, (error, stdout, stderr) => { + if (error) { + if (error.signal == 'SIGTERM') { + resolve('Process was killed'); + } else { + reject(error); + } + } else { + resolve(stdout.trim()); + } + }); + }); +} + +const isLinux = () => { + return process && process.platform === 'linux'; +} + +const isWindows = () => { + return process && process.platform === 'win32'; +} + +const isMac = () => { + return process && process.platform === 'darwin'; +} + +async function main() { + // electron-rebuild --arch ia32 && electron-rebuild --arch x64 + + let exePath = __dirname + '/node_modules/.bin/electron-rebuild'; + if (isWindows()) exePath += '.cmd'; + + if (isWindows()) { + console.info(await execCommand(['node', '"' + exePath + '"', '--arch ia32'].join(' '))); + console.info(await execCommand(['node', '"' + exePath + '"', '--arch x64'].join(' '))); + } else { + console.info(await execCommand(['node', '"' + exePath + '"'].join(' '))); + } +} + +main().catch((error) => { + console.error(error); + process.exit(1); +}); \ No newline at end of file diff --git a/ElectronClient/app/package-lock.json b/ElectronClient/app/package-lock.json index 6bd538461..9c74638b3 100644 --- a/ElectronClient/app/package-lock.json +++ b/ElectronClient/app/package-lock.json @@ -464,13 +464,15 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true + "dev": true, + "optional": true }, "is-glob": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, + "optional": true, "requires": { "is-extglob": "^1.0.0" } @@ -2912,7 +2914,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -2930,11 +2933,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2947,15 +2952,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3058,7 +3066,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3068,6 +3077,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3080,17 +3090,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -3107,6 +3120,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -3179,7 +3193,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -3189,6 +3204,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -3264,7 +3280,8 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -3294,6 +3311,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3311,6 +3329,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3349,11 +3368,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.0.2", - "bundled": true + "bundled": true, + "optional": true } } }, @@ -3459,13 +3480,15 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true + "dev": true, + "optional": true }, "is-glob": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, + "optional": true, "requires": { "is-extglob": "^1.0.0" } @@ -5294,7 +5317,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true + "dev": true, + "optional": true }, "is-glob": { "version": "2.0.1", diff --git a/ElectronClient/app/package.json b/ElectronClient/app/package.json index 1e53793ed..525d31554 100644 --- a/ElectronClient/app/package.json +++ b/ElectronClient/app/package.json @@ -8,7 +8,7 @@ "pack": "node_modules/.bin/electron-builder --dir", "dist": "node_modules/.bin/electron-builder", "publish": "build -p always", - "postinstall": "node compile.js && node compile-package-info.js && node ../../Tools/copycss.js --copy-fonts && electron-rebuild --arch ia32 && electron-rebuild --arch x64", + "postinstall": "node compile.js && node compile-package-info.js && node ../../Tools/copycss.js --copy-fonts && node electronRebuild.js", "compile": "node compile.js && node compile-package-info.js && node ../../Tools/copycss.js --copy-fonts" }, "repository": { diff --git a/joplin.sublime-project b/joplin.sublime-project index 3e635e780..542da5c56 100644 --- a/joplin.sublime-project +++ b/joplin.sublime-project @@ -63,7 +63,8 @@ "_releases", "ReactNativeClient/lib/csstojs", "Clipper/joplin-webclipper/popup/build", - "Clipper/joplin-webclipper/dist" + "Clipper/joplin-webclipper/dist", + "ReactNativeClient/lib/rnInjectedJs", ], "path": "." }