From 77893192bdfda3e7a239ba70d89c7124fac05dbd Mon Sep 17 00:00:00 2001 From: Vishwas Shashidhar Date: Tue, 5 Jun 2018 16:32:51 +0530 Subject: [PATCH] update documentation and package configuration --- .gitignore | 1 + DEV_SETUP.md | 102 ++++++++++++++++++++++++++++++ PULL_REQUEST_TEMPLATE.md | 7 +- README.md | 58 +---------------- js/menus/menuTemplate.js | 1 + package.json | 27 +++++--- tests/jest_unit.json | 6 ++ tests/spectron/jest_spectron.json | 3 +- 8 files changed, 136 insertions(+), 69 deletions(-) create mode 100644 DEV_SETUP.md create mode 100644 tests/jest_unit.json diff --git a/.gitignore b/.gitignore index 78d6e2d3..7d0a2cbf 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ installer/win/Symphony-x86-cache installer/win/Symphony-x86-SetupFiles package-lock.json library +*.log \ No newline at end of file diff --git a/DEV_SETUP.md b/DEV_SETUP.md new file mode 100644 index 00000000..63551aa2 --- /dev/null +++ b/DEV_SETUP.md @@ -0,0 +1,102 @@ +## Prerequisites + +### General +- You'll need a set of binaries for swift search to work. To get these binaries, please contact the project maintainers +- Without these binaries, you'll not be able to build the app + +### Windows +- NodeJS version >= 8.9.4 (corresponds to electron 2.0.2) +- Microsoft Visual Studio 2015 Community or Paid (C++ and .NET/C# development tools) +- Python >= 2.7.1 +- Dot Net 3.5 SP1 +- [Advanced Installer](https://www.advancedinstaller.com/) + +#### Notes +- C++ tools are required to recompile node modules +- Dot NET/C# tools required to compile screen-snippet module +- Open 'Developer Command Prompt for VS2015'. This sets paths to visual studio build tools +- Advanced installer is required to create msi installer + +### Mac +- Xcode command line tools. Or better, XCode latest version +- NodeJS version >= 8.9.4 (corresponds to electron 2.0.2) +- [Sudre Packages](http://s.sudre.free.fr/Software/Packages/about.html) + +#### Notes +- Ensure you have accepted the XCode license agreement +- Sudre packages is used to create a .pkg installer file + +## Run demo: +- npm install +- npm run demo-win (for windows) +- npm run demo-mac (for mac osx) + +## Build Instructions: + +### Mac +- npm install +- npm run dev (to run locally) +- to build mac app: + * npm run unpacked-mac + * The distributable is created in the `dist/mac` directory +- to build mac package (installer): + * npm run packages-mac + * The .pkg file will be generated in the `installer/mac/build` directory + +### Windows +- npm install +- npm run dev (to run locally) +- To build windows unpacked exe: + * npm run unpacked-win + * The distributable is created in the `dist/win-unpacked` directory +- To build windows 32 bit unpacked exe (installer): + * npm run unpacked-win-x86 + * The distributable is created in the `dist/win-ia32-unpacked` directory +- To create msi (installer): + * Run the advanced installer script located in `installer/win` directory + * There are two configuration files one each for 64-bit and 32-bit + +#### MSI command line options: +- To install for all users (admin required): msiexec.exe /i Symphony-x64.msi ALLUSERS=1 +- To install per user: msiexec.exe /i Symphony-x64.msi ALLUSERS="" +- To change default pod url: msiexe.exe /i Symphony-x64.msi POD_URL=my.symphony.com +- To change auto start: msiexe.exe /i Symphony-x64.msi AUTO_LAUNCH=true (or false) - if not specified default it true. +- To change minimize on close: msiexe.exe /i Symphony-x64.msi MINIMIZE_ON_CLOSE=true (or false) - if not specified default is true. +- Any of the above options can be chained together, for example: msiexe.exe /i Symphony-x64.msi MINIMIZE_ON_CLOSE=true AUTO_START=false POD_URL=my.symphony.com +- The available values for various settings in the installer is listed below + * POD_URL (String) + * ALWAYS_ON_TOP (Boolean) + * AUTO_LAUNCH (Boolean) + * MINIMIZE_ON_CLOSE (Boolean) + * BRING_TO_FRONT (Boolean) + * MEDIA (Boolean) + * LOCATION (Boolean) + * NOTIFICATIONS (Boolean) + * MIDI_SYSEX (Boolean) + * FULL_SCREEN (Boolean) + * POINTER_LOCK (Boolean) + * OPEN_EXTERNAL (Boolean) + +## Start URL +- To change the start url (i.e., pod url), edit config/Symphony.config and change 'url' variable. if no protocol provided, then https will be added. +- The installer will include file config/Symphony.config next to executable. Changes in this file will effect all users. + +## Tests and Code Coverage +- [Jest framework](http://facebook.github.io/jest/) is used to run tests +- Use `npm test` to run unit tests +- Use `npm run spectron-test` to run UI tests +- Code coverage reports are placed in [coverage](./coverage) directory +- To check the test run report, see the [dist](./dist) directory +- See the [tests](./tests) directory to find all the unit tests +- See the [spectron](./tests/spectron) directory to find all the unit tests + +## Logging +- Local logging is enabled for dev environments using the module [electron-log](https://www.npmjs.com/package/electron-log) +- On macOS, the logs are stored under `~/Library/Logs//log.log` +- On Windows, the logs are stored under `%USERPROFILE%\AppData\Roaming\\log.log` +- Remote logging is enabled for local and production cases and are sent to the backend server via the remote objects + +## Misc notes +- If desiring to run against server without proper cert use cmd line option: --ignore-certificate-errors +- To start additional instance with custom data directory (if you want seperate user) use cmd line options: --multiInstance --userDataPath=`` +- If directory doesn't exist, it will be created \ No newline at end of file diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index b8d68726..1d7c4c91 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -26,7 +26,6 @@ other_pr_dev | [link]() ## Open Questions if any and Todos -- [ ] Unit-Tests -- [ ] Documentation -- [ ] Automation-Tests -When solved, check the box and explain the answer. +- [] Unit-Tests +- [] Documentation +- [] Automation-Tests \ No newline at end of file diff --git a/README.md b/README.md index c76894cf..23cdceaf 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## About: -SymphonyElectron is a desktop client of the Symphony Communication Platform built for macOS, Windows 10 and Windows 7. +SymphonyElectron is a desktop client of the Symphony Communication Platform built for macOS, Windows 10 and Windows 7. We've built this using the popular [electron](https://github.com/electron/electron) framework to support cross platform desktop apps loaded in a chromium container ## Project Goals: @@ -16,58 +16,6 @@ Our goal is to improve the performance and development agility of Symphony's des In order to achieve those goals Symphony is participating and working in close collaboration with the [Foundation Desktop Wrapper Working Group](https://symphonyoss.atlassian.net/wiki/display/WGDWAPI/Working+Group+-+Desktop+Wrapper+API) -## Windows Dev Env -- NodeJS version >= 7.4.0 (corresponds to electron 1.6.7) -- install Microsoft Visual Studio 2015 with both C++ and .NET/C# development tools. Free community versions works. -- also make sure .NET3.5SP1 is installed. -- note: C++ tools needed to recompile node modules -- note: .NET/C# tools needed to compile screen-snippet -- open 'Developer Command Prompt for VS2015' - this sets paths to visual studio build tools +## Development Setup & Running -## Mac Dev Env -- need to install xcode command line tools. -- NodeJS version >= 7.4.0 (corresponds to electron 1.6.7) - needed to run tests locally - -## Run demo: -- npm install -- npm run demo-win (for windows) -- npm run demo-mac (for mac osx) - -## Build Instructions: -- npm install -- to run locally: npm run dev -- to build mac pkg: - * npm run unpacked-mac - * install software to build .pkg: http://s.sudre.free.fr/Software/Packages/about.html - * /usr/local/bin/packagesbuild -v installer/mac/symphony-mac-packager.pkgproj - * The .pkg file will output in directory: installer/mac/build -- to build win msi: npm run unpacked-win (for 64 bit) and use 'advanced installer' .aip file in installer/ dir - -## msi command line options: -- to install for all users (admin required): msiexec.exe /i Symphony-x64.msi ALLUSERS=1 -- to install per user: msiexec.exe /i Symphony-x64.msi ALLUSERS="" -- to change default pod url: msiexe.exe /i Symphony-x64.msi POD_URL=my.symphony.com -- to change auto start: msiexe.exe /i Symphony-x64.msi AUTO_START=true (or false) - if not specified default it true. -- to change minimize on close: msiexe.exe /i Symphony-x64.msi MINIMIZE_ON_CLOSE=true (or false) - if not specified default is true. -- any of the above options can be chained together, for example: msiexe.exe /i Symphony-x64.msi MINIMIZE_ON_CLOSE=true AUTO_START=false POD_URL=my.symphony.com - -## Start URL -- To change the start url (i.e., pod url), edit config/Symphony.config and change 'url' variable. if no protocol provided, then https will be added. -- The installer will include file config/Symphony.config next to executable. Changes in this file will effect all users. - -## Tests and Code Coverage -- jest framework is used to run tests: http://facebook.github.io/jest/ -- to run tests and get code coverage report: npm test -- code coverage reports are placed in dir: converage -- tests are located in dir: tests - -## Logging -- Local logging is enabled for dev environments using the module [electron-log](https://www.npmjs.com/package/electron-log) -- On macOS, the logs are stored under `~/Library/Logs//log.log` -- On Windows, the logs are stored under `%USERPROFILE%\AppData\Roaming\\log.log` -- Remote logging is enabled for local and production cases and are sent to the backend server via the remote objects - -## Misc notes -- If desiring to run against server without proper cert use cmd line option: --ignore-certificate-errors -- To start additional instance with custom data directory (if you want seperate user) use cmd line options: --multiInstance --userDataPath= - - if directory doesn't exist, it will be created +Read [Dev Setup](./DEV_SETUP.md) \ No newline at end of file diff --git a/js/menus/menuTemplate.js b/js/menus/menuTemplate.js index 404907de..99ebd817 100644 --- a/js/menus/menuTemplate.js +++ b/js/menus/menuTemplate.js @@ -153,6 +153,7 @@ const template = [{ const crashesDirectory = electron.crashReporter.getCrashesDirectory(); let source = isMac ? crashesDirectory + '/completed' : crashesDirectory; + // TODO: Add support to get diagnostic reports from ~/Library/Logs/DiagnosticReports if (!fs.existsSync(source) || fs.readdirSync(source).length === 0 && focusedWindow && !focusedWindow.isDestroyed()) { electron.dialog.showMessageBox(focusedWindow, {type: 'error', title: 'Failed!', message: 'No crashes available to share'}); return; diff --git a/package.json b/package.json index a7a750ed..ba2a4eae 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,14 @@ "author": "Symphony", "main": "js/main.js", "scripts": { - "dev": "npm run prebuild && cross-env ELECTRON_DEV=true electron .", + "lint": "eslint --ext .js js/", + "prebuild": "npm run rebuild && npm run browserify-preload", + "browserify-preload": "browserify -o js/preload/_preloadMain.js -x electron --insert-global-vars=__filename,__dirname js/preload/preloadMain.js --exclude electron-spellchecker", + "rebuild": "electron-rebuild -f", + "dev": "npm run prebuild && && npm run set-dev-env && electron .", + "pretest": "npm run lint && npm rebuild --build-from-source ", + "test": "npm run pretest && cross-env ELECTRON_QA=true jest --config tests/jest_unit.json --runInBand && npm run rebuild", + "spectron-test": "npm run pretest && cross-env ELECTRON_QA=true jest --config tests/spectron/jest_spectron.json --runInBand && npm run rebuild", "demo-win": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file:///demo/index.html", "demo-mac": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file://$(pwd)/demo/index.html", "search-win": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file:///demo/search.html", @@ -15,19 +22,20 @@ "unpacked-mac": "npm run prebuild && npm run test && build --mac --dir", "packed-mac": "npm run unpacked-mac && packagesbuild -v installer/mac/symphony-mac-packager.pkgproj", "unpacked-win": "npm run prebuild && npm run test && build --win --x64 --dir", - "unpacked-win-x86": "npm run prebuild && npm run test && build --win --ia32 --dir", - "prebuild": "npm run rebuild && npm run browserify-preload", - "browserify-preload": "browserify -o js/preload/_preloadMain.js -x electron --insert-global-vars=__filename,__dirname js/preload/preloadMain.js --exclude electron-spellchecker", - "rebuild": "electron-rebuild -f", - "test": "npm run lint && npm rebuild --build-from-source && cross-env ELECTRON_QA=true && jest --verbose --testPathPattern test && npm run rebuild", - "spectron-test": "npm rebuild --build-from-source && jest --config tests/spectron/jest_spectron.json --runInBand && npm run rebuild", - "lint": "eslint --ext .js js/", - "rename-exe": "cd dist/win-unpacked && ren Symphony.exe Symphony-Electron.exe" + "unpacked-win-x86": "npm run prebuild && npm run test && build --win --ia32 --dir" }, "jest": { "collectCoverage": true, "transformIgnorePatterns": [] }, + "jest-html-reporter": { + "pageTitle": "Symphony Electron Test Result", + "includeFailureMsg": true, + "includeConsoleLog": true, + "theme": "lightTheme", + "outputPath": "./dist/jest_test_report.html", + "sort": "status" + }, "build": { "asarUnpack": [ "node_modules/@paulcbetts/cld/build/Release/cld.node" @@ -100,6 +108,7 @@ "eslint-plugin-react": "6.10.3", "glob": "7.1.2", "jest": "19.0.2", + "jest-html-reporter": "^2.3.0", "ncp": "2.0.0", "robotjs": "0.4.7", "spectron": "3.7.2" diff --git a/tests/jest_unit.json b/tests/jest_unit.json new file mode 100644 index 00000000..f3b331c2 --- /dev/null +++ b/tests/jest_unit.json @@ -0,0 +1,6 @@ +{ + "testMatch": ["**/*.test.js"], + "verbose": true, + "testResultsProcessor": "./node_modules/jest-html-reporter" + } + \ No newline at end of file diff --git a/tests/spectron/jest_spectron.json b/tests/spectron/jest_spectron.json index abd4d921..a9e551e4 100644 --- a/tests/spectron/jest_spectron.json +++ b/tests/spectron/jest_spectron.json @@ -1,4 +1,5 @@ { "testMatch": ["**/*.spectron.js"], - "verbose": true + "verbose": true, + "testResultsProcessor": "./node_modules/jest-html-reporter" }