From 021cf22198cab65225416bc5651b625b51f2862c Mon Sep 17 00:00:00 2001 From: Mike Seese Date: Sun, 24 Sep 2017 15:54:19 -0400 Subject: [PATCH 1/5] use 64 bit instead --- packages/client-app/build/tasks/package-task.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client-app/build/tasks/package-task.js b/packages/client-app/build/tasks/package-task.js index 509fb6dc9..9b0488421 100644 --- a/packages/client-app/build/tasks/package-task.js +++ b/packages/client-app/build/tasks/package-task.js @@ -164,7 +164,7 @@ module.exports = (grunt) => { 'app-category-type': "public.app-category.business", 'tmpdir': tmpdir, 'arch': { - 'win32': 'ia32', + 'win32': 'x64', }[platform], 'icon': { darwin: path.resolve(grunt.config('appDir'), 'build', 'resources', 'mac', 'nylas.icns'), From 00a19ac4b52f28f391e2075b60bcb632630490aa Mon Sep 17 00:00:00 2001 From: Mike Seese Date: Sun, 24 Sep 2017 15:54:32 -0400 Subject: [PATCH 2/5] add windows installer task back --- .../build/create-signed-windows-installer.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 packages/client-app/build/create-signed-windows-installer.js diff --git a/packages/client-app/build/create-signed-windows-installer.js b/packages/client-app/build/create-signed-windows-installer.js new file mode 100644 index 000000000..d8dcd984a --- /dev/null +++ b/packages/client-app/build/create-signed-windows-installer.js @@ -0,0 +1,29 @@ +/* eslint import/no-dynamic-require:0 */ +/** + * NOTE: Due to path issues, this script must be run outside of grunt + * directly from a powershell command. + */ +const path = require('path') +const createWindowsInstaller = require('electron-winstaller').createWindowsInstaller + +const appDir = path.join(__dirname, ".."); +const version = require(path.join(appDir, 'package.json')).version; + +const config = { + usePackageJson: false, + outputDirectory: path.join(appDir, 'dist'), + appDirectory: path.join(appDir, 'dist', 'nylas-win32-x64'), + loadingGif: path.join(appDir, 'build', 'resources', 'win', 'loading.gif'), + iconUrl: 'http://edgehill.s3.amazonaws.com/static/nylas.ico', + description: "Nylas Mail", + version: version, + title: "nylas", + authors: 'Nylas Inc.', + setupIcon: path.join(appDir, 'build', 'resources', 'win', 'nylas.ico'), + setupExe: 'NylasMailSetup.exe', + exe: 'nylas.exe', + name: 'NylasMail', +} +console.log(config); +console.log("---> Starting") +createWindowsInstaller(config, console.log, console.error) From 1a543beea7567bd28311ff17de81672534f5d677 Mon Sep 17 00:00:00 2001 From: Mike Seese Date: Sun, 24 Sep 2017 15:54:48 -0400 Subject: [PATCH 3/5] initial windows documentation --- docs/guide/contributing/installation.md | 40 +++++++++++++++++++++---- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/docs/guide/contributing/installation.md b/docs/guide/contributing/installation.md index 3b803e9a6..6f86ab639 100644 --- a/docs/guide/contributing/installation.md +++ b/docs/guide/contributing/installation.md @@ -11,17 +11,37 @@ If you are looking to simply install Nylas-Mail on your system (and are not look ```bash export NODE_VERSION=6.9 CC=gcc-4.8 CXX=g++-4.8 DEBUG="electron-packager:*" INSTALL_TARGET=client ``` -1. [Follow the common instructions](#common-linux-and-macos) +1. [Follow the common instructions](#common) ## Mac OS 1. Download the latest XCode from the App Store then run the following to install CLI tools ```bash xcode-select --install ``` -1. [Follow the common instructions](#common-linux-and-macos) - -## Common (Linux and MacOS) -1. Install Node.js version **6.9** (suggested using [NVM](https://github.com/creationix/nvm/blob/master/README.md#install-script)) +1. [Follow the common instructions](#common) + +## Windows +1. Download and install Visual Studio 2013. The Community Edition works and is free with a Dev Essentials account; once you have a Dev Essentials account, you can access a download at https://my.visualstudio.com/Downloads?q=Visual%20Studio%202013%20with%20Update%205 +1. Due to the way Windows filesystem is built, it is likely you'll need to run Command Prompt as administrator. We have seen issues with rename/symlink permissions. +1. Set the following environment variables: + ```bash + set NODE_VERSION=6.9 + set DEBUG=electron-windows-installer:*,electron-packager:* + set SIGN_BUILD=false + set INSTALL_TARGET=client + + set npm_config_arch=x64 + set npm_config_target_arch=x64 + set npm_config_msvs_version=2013 + + npm config set arch x64 + npm config set target_arch x64 + npm config set msvs_version 2013 + ``` +1. [Follow the common instructions; please follow for **Windows Developers Only** notes](#common) + +## Common +1. Install Node.js version **6.9** (suggested using [NVM](https://github.com/creationix/nvm/blob/master/README.md#install-script) or the Windows version of [NVM Windows](https://github.com/coreybutler/nvm-windows/releases)) * If using nvm, prepend all the coming `npm` commands with the following to use the correct NPM version: ```bash nvm exec 6.9 @@ -31,6 +51,10 @@ If you are looking to simply install Nylas-Mail on your system (and are not look git clone our-repo-link ``` * The repo link can be found on the main page of this repository, simply click the green "Clone or download button", and copy its contents over the "our-repo-link" in the above command. + * **Windows Devleopers Only**: Windows has issues with long paths. It is recommended that this repo is cloned to the root directory of a disk drive (not necessarily C:): + ```bash + git clone out-repo-link C:\nylas-mail + ``` 1. Install the necessary node packages using: ```bash npm install @@ -48,4 +72,8 @@ If you are looking to simply install Nylas-Mail on your system (and are not look * If the above command threw an error, run the following and make sure your **node version is 6.9**: ```bash node -v - ``` + ``` + * **Windows developers Only**: This step is required for Windows. However, to create an installer binary, you must execute another command: + ```bash + node packages\client-app\build\create-signed-windows-installer.js + ``` \ No newline at end of file From eca47d3a989315534c9f29dc377df0894b97e9a4 Mon Sep 17 00:00:00 2001 From: Mike Seese Date: Sun, 24 Sep 2017 16:11:40 -0400 Subject: [PATCH 4/5] add some additional notes --- docs/guide/contributing/installation.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/guide/contributing/installation.md b/docs/guide/contributing/installation.md index 6f86ab639..eb6408301 100644 --- a/docs/guide/contributing/installation.md +++ b/docs/guide/contributing/installation.md @@ -22,6 +22,8 @@ If you are looking to simply install Nylas-Mail on your system (and are not look ## Windows 1. Download and install Visual Studio 2013. The Community Edition works and is free with a Dev Essentials account; once you have a Dev Essentials account, you can access a download at https://my.visualstudio.com/Downloads?q=Visual%20Studio%202013%20with%20Update%205 +1. Download and install Python 2.7 (v3.x.x is not supported) - https://www.python.org/downloads/windows/ +1. Add Python 2.7 directory to the PATH Environment Variable (see https://www.java.com/en/download/help/path.xml) 1. Due to the way Windows filesystem is built, it is likely you'll need to run Command Prompt as administrator. We have seen issues with rename/symlink permissions. 1. Set the following environment variables: ```bash @@ -55,6 +57,15 @@ If you are looking to simply install Nylas-Mail on your system (and are not look ```bash git clone out-repo-link C:\nylas-mail ``` +1. Navigate to the nylas-mail directory: (may be different if you cloned it somewhere else) + ```bash + cd nylas-mail + ``` +1. Make sure you don't have any Lerna-caused remnants using: + ```bash + git status + ``` + and making sure you have no unexpected issues/changes with `package.json` like files. If a previous `npm install` failed prematurely, these files may need to be reset. Otherwise, you'll have missing packages. This seems to be most prevalent doing Windows builds. You'll likely see a modified `package.json` file as well as an untracked Lerna backup file. 1. Install the necessary node packages using: ```bash npm install @@ -73,7 +84,7 @@ If you are looking to simply install Nylas-Mail on your system (and are not look ```bash node -v ``` - * **Windows developers Only**: This step is required for Windows. However, to create an installer binary, you must execute another command: + * **Windows Developers Only**: The `npm run build-client` step is required; however it won't build a Windows installer binary. To create an installer binary, you must execute an additional command: ```bash node packages\client-app\build\create-signed-windows-installer.js ``` \ No newline at end of file From 477e54fba68c3fa08ec154fa4008fc0c307627b6 Mon Sep 17 00:00:00 2001 From: Mike Seese Date: Sun, 24 Sep 2017 16:34:21 -0400 Subject: [PATCH 5/5] make cross platform package.json commands --- package.json | 8 ++++---- scripts/run-client-app.js | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 scripts/run-client-app.js diff --git a/package.json b/package.json index ebd2f446a..a2f50b93f 100644 --- a/package.json +++ b/package.json @@ -44,10 +44,10 @@ "scripts": { "start": "npm run client", "test": "npm run test-client && npm run test-cloud", - "client": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --dev", - "benchmark": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --dev --benchmark", - "test-client": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --test", - "test-client-window": "packages/client-app/node_modules/.bin/electron packages/client-app --enable-logging --test=window", + "client": "node scripts/run-client-app --enable-logging --dev", + "benchmark": "node scripts/run-client-app --enable-logging --dev --benchmark", + "test-client": "node scripts/run-client-app --enable-logging --test", + "test-client-window": "node scripts/run-client-app --enable-logging --test=window", "test-client-junit": "", "lint-client": "grunt lint --gruntfile=packages/client-app/build/Gruntfile.js --base=./", "build-client": "grunt build-client --gruntfile=packages/client-app/build/Gruntfile.js --base=./", diff --git a/scripts/run-client-app.js b/scripts/run-client-app.js new file mode 100644 index 000000000..8f5a03b67 --- /dev/null +++ b/scripts/run-client-app.js @@ -0,0 +1,15 @@ +const path = require("path"); +const childProcess = require("child_process"); + +var electronPath = path.join("packages", "client-app", "node_modules", ".bin", "electron"); +var clientPath = path.join("packages", "client-app"); +var args = process.argv; +args = args.slice(2); +args.unshift(clientPath); + +command = electronPath; +for(var i = 0; i < args.length; i++) { + command += " " + args[i]; +} + +childProcess.exec(command); \ No newline at end of file