## INSTALL (use yarn wherever necessary) // install choco for windows (run in admin cmd not powershell) @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" - choco install nodejs-lts ( + npm) (LTS) //restart vscode choco install yarn // if robotjs issue then temp remove from package.json: "robotjs": "^X.x.x" - npm install electron --save-dev (recommended) - npm install electron -g (globally) ## UPGRADE (use yarn wherever necessary) // update all packages to latest version in package.json - yarn upgrade-interactive --latest // caution: elow npm update doesn't work sometimes - npm update --save - npm update --save-dev - choco upgrade nodejs (+ npm) - choco upgrade chocolatey - choco upgrade electron - yarn upgrade-interactive --latest ## CHECK VERSION - node --version //8.9.4 - npm --v in cmd //5.6.0 - electron --version //1.7.10 ## BUILD - npm install // rebuild all node_modules npm install npm rebuild // outdated npm modules npm outdated // removes packages not depended on by your project according to your package.json: npm prune --production ## RUN & DBUG - electron ./main.js (might give error) - or hit debug button in vscode // https://stackoverflow.com/questions/48854265/why-do-i-see-an-electron-security-warning-after-updating-my-electron-project-t - if ROBOTJS issues - see https://stackoverflow.com/questions/11178372/is-it-possible-to-simulate-keyboard-mouse-event-in-nodejs/46897783#46897783 - or follow below instructions - npm install --global windows-build-tools - npm install robotjs --save-dev // for me, it added 0.4.7 version - npm rebuild --runtime=electron --target=2.0.8 --disturl=https://atom.io/download/atom-shell --abi=57 // here 2.0.8 = my electron version electron --version // abi 57 = for my corresponding node version 8.11.2 node --version // if couldn't run then try build steps one more time and then run ## PACKAGE app using electron builder - configure package.json follow https://www.electron.build - yarn add electron-builder --dev - yarn dist //see detailed logs by setting: //permanent.. need to reload cmd - setx DEBUG "electron-builder" // remove it by: REG delete HKCU\Environment /F /V DEBUG //for one session only - set DEBUG=electron-builder // remove it by: set DEBUG= ## SIGN app while packagaing - generate selfsign certificate for windows https://stackoverflow.com/questions/84847/how-do-i-create-a-self-signed-certificate-for-code-signing-on-windows/47144138#47144138 - add "certificateFile" : "selfsigncert.pfx" to package.json - add CSC_KEY_PASSWORD to env variable with password as value - setx CSC_KEY_PASSWORD "my_password" "nsis": { "runAfterFinish": true, "installerIcon": "icon.ico", "uninstallerIcon": "icon.ico", "createDesktopShortcut": true, "deleteAppDataOnUninstall": true } ## PUBLISH - By default, electron-updater will try to detect the GitHub settings (such as the repo name and owner) from reading the .git/config Optional: { ... "build": { "publish": [{ "provider": "github", "owner": "iffy", "repo": "electron-updater-example" }], ... } } see sample: https://github.com/iffy/electron-updater-example/blob/master/main.js 1) get access token from https://github.com/settings/tokens/new and check "repo" section 2) Windows: set it in terminal: [Environment]::SetEnvironmentVariable("GH_TOKEN","fs949jweksc6d3352fdb2ae4cdecf84jjfvw9vf","User") 3) update the version in package.json and commit all changes 4) run: node_modules/.bin/build -p always -- it'll create a new tag with current version and push the exe to the new DRAFT. 5) got to github repo-> releases and edit and "publish" this draft. 6) update should be avilable in user app. again repeat step 3, 4 and 5 for new release. ## unistall node module - npm -g uninstall my_module --save - npm rm my_module - yarn remove my_module ## lists all installed packages: - npm list ##BLOG TO-DO: - missing in package.json "include": "./build/installer.nsh" - and installer.nsh file ##TO-DO: - mac icons https://www.electron.build/icons