From cc669077409877062fb0c25b2c21402fe6369a5d Mon Sep 17 00:00:00 2001 From: Vishwas Shashidhar Date: Fri, 23 Aug 2019 13:38:51 +0530 Subject: [PATCH] refactoring - refactor package file - move build config to yaml - move demo directory to src - remove shell path - rename jest config file --- electron-builder.yml | 52 +++++++++++++++++++ jest.config.json => jest-config.json | 2 +- package.json | 66 ++----------------------- {demo => src/demo}/README.md | 0 {demo => src/demo}/childWin.html | 0 {demo => src/demo}/download-manager.css | 0 {demo => src/demo}/index.html | 0 {demo => src/demo}/win.html | 0 types/shell-path.d.ts | 5 -- 9 files changed, 56 insertions(+), 69 deletions(-) create mode 100644 electron-builder.yml rename jest.config.json => jest-config.json (95%) rename {demo => src/demo}/README.md (100%) rename {demo => src/demo}/childWin.html (100%) rename {demo => src/demo}/download-manager.css (100%) rename {demo => src/demo}/index.html (100%) rename {demo => src/demo}/win.html (100%) delete mode 100644 types/shell-path.d.ts diff --git a/electron-builder.yml b/electron-builder.yml new file mode 100644 index 00000000..3885bc8a --- /dev/null +++ b/electron-builder.yml @@ -0,0 +1,52 @@ +productName: "Symphony" +appId: "com.symphony.electron-desktop" + +# Package electron code into a asar archive. Set to false to debug issues. +asar: true + +# Unpack these files from asar to have them signed +asarUnpack: + - 'node_modules/@nornagon/cld/build/Release/cld.node' + - 'node_modules/@nornagon/spellchecker/build/Release/spellchecker.node' + - 'node_modules/keyboard-layout/build/Release/keyboard-layout-manager.node' + +# Don't package these files +files: + - '!coverage/*' + - '!installer/*' + - '!tests/*' + - '!node_modules/@nornagon/cld/deps/cld${/*}' + - '!node_modules/@nornagon/cld/build/deps${/*}' + - '!node_modules/@nornagon/spellchecker/vendor${/*}' + +# Extra files to package +extraFiles: + - 'config/Symphony.config' + - 'config/titleBarStyles.css' + - 'assets/dictionaries/**' + - 'library/libsymphonysearch.dylib' + - 'library/indexvalidator.exec' + - 'library/cryptoLib.dylib' + - 'library/dictionary' + - 'library/lz4.exec' + +# Mac OS configuration +mac: + category: 'public.app-category.business' + icon: 'build/icons/mac/icon.icns' + +# Windows configuration +win: + icon: 'build/icons/win/icon.ico' + target: + - 'squirrel' + +# Linux configuration +linux: + category: 'Network;InstantMessaging;Chat' + desktop: + StartupWMClass: 'Symphony' + target: + - 'deb' + - 'rpm' + icon: 'build/icons/png' diff --git a/jest.config.json b/jest-config.json similarity index 95% rename from jest.config.json rename to jest-config.json index e741ada8..a6434fbc 100644 --- a/jest.config.json +++ b/jest-config.json @@ -20,7 +20,7 @@ "text", "html" ], - "coverageDirectory": "out/coverage", + "coverageDirectory": "dist/coverage", "collectCoverageFrom": [ "src/**/*.{ts,tsx}", "!**/node_modules/**", diff --git a/package.json b/package.json index dcdee9bd..dcce4525 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "browserify-preload": "browserify -o lib/src/renderer/_preload-main.js -x electron --insert-global-vars=__filename,__dirname lib/src/renderer/preload-main.js", "compile": "npm run lint && gulp build", "dev": "npm run prebuild && cross-env ELECTRON_DEV=true electron .", - "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", + "demo-win": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file:///src/demo/index.html", + "demo-mac": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file://$(pwd)/src/demo/index.html", "icon-gen": "electron-icon-maker --input=images/icon_1024.png --output=./build", "lint": "tslint --project tsconfig.json", "packed-linux": "npm run prebuild && npm run test && npm run icon-gen && build --linux", @@ -22,71 +22,11 @@ "prebuild": "npm run compile && npm run rebuild && npm run browserify-preload", "rebuild": "electron-rebuild -f", "start": "npm run compile && npm run browserify-preload && cross-env ELECTRON_DEV=true electron .", - "test": "npm run lint && cross-env ELECTRON_QA=true jest --config jest.config.json --runInBand --detectOpenHandles", + "test": "npm run lint && cross-env ELECTRON_QA=true jest --config jest-config.json --runInBand --detectOpenHandles", "unpacked-mac": "npm run prebuild && npm run test && npm run icon-gen && build --mac --dir", "unpacked-win": "npm run prebuild && npm run test && npm run icon-gen && build --win --x64 --dir", "unpacked-win-x86": "npm run prebuild && npm run test && npm run icon-gen && build --win --ia32 --dir" }, - "build": { - "asarUnpack": [ - "node_modules/@nornagon/cld/build/Release/cld.node", - "node_modules/@nornagon/spellchecker/build/Release/spellchecker.node", - "node_modules/keyboard-layout/build/Release/keyboard-layout-manager.node" - ], - "files": [ - "!coverage/*", - "!installer/*", - "!tests/*", - "!node_modules/@nornagon/cld/deps/cld${/*}", - "!node_modules/@nornagon/cld/build/deps${/*}", - "!node_modules/@nornagon/spellchecker/vendor${/*}" - ], - "extraFiles": [ - "config/Symphony.config", - "config/titleBarStyles.css", - "dictionaries/**", - "library/libsymphonysearch.dylib", - "library/indexvalidator.exec", - "library/cryptoLib.dylib", - "library/dictionary", - "library/lz4.exec" - ], - "appId": "com.symphony.electron-desktop", - "mac": { - "target": "dmg", - "category": "public.app-category.business", - "icon": "build/icons/mac/icon.icns" - }, - "dmg": { - "contents": [ - { - "x": 140, - "y": 184 - }, - { - "x": 412, - "y": 184, - "type": "link", - "path": "/Applications" - } - ] - }, - "win": { - "target": "squirrel", - "icon": "build/icons/win/icon.ico" - }, - "linux": { - "category": "Network;InstantMessaging;Chat", - "desktop": { - "StartupWMClass": "Symphony" - }, - "target": [ - "deb", - "rpm" - ], - "icon": "build/icons/png" - } - }, "repository": { "type": "git", "url": "git+https://github.com/SymphonyOSS/SymphonyElectron.git" diff --git a/demo/README.md b/src/demo/README.md similarity index 100% rename from demo/README.md rename to src/demo/README.md diff --git a/demo/childWin.html b/src/demo/childWin.html similarity index 100% rename from demo/childWin.html rename to src/demo/childWin.html diff --git a/demo/download-manager.css b/src/demo/download-manager.css similarity index 100% rename from demo/download-manager.css rename to src/demo/download-manager.css diff --git a/demo/index.html b/src/demo/index.html similarity index 100% rename from demo/index.html rename to src/demo/index.html diff --git a/demo/win.html b/src/demo/win.html similarity index 100% rename from demo/win.html rename to src/demo/win.html diff --git a/types/shell-path.d.ts b/types/shell-path.d.ts deleted file mode 100644 index 98fd1ef9..00000000 --- a/types/shell-path.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export = index; -declare function index(): void; -declare namespace index { - function sync(): void; -}