一个PC桌面应用,设置办公室闹钟提醒,定时喝水、休息、吃饭等。
依赖
// 以mac环境为例
brew install ruby
brew install node
brew install npm
npm config set registry https://registry.npm.taobao.org
npm install -g cnpm --registry=https://registry.npm.taobao.org
npm install electron --save-dev
npm install --save glob
运行
// 进入app目录
npm start
or
electron app
打包
// 打包前,先安装electron-packager
npm install electron-packager --save-dev
// 在pack目录,执行打包
npm run-script packager
// windows安装包依赖
brew tap caskroom/cask
brew cask install java xquartz
brew install wine
// Mac环境打包
electron-packager ../app OfficeAlarm --out ./output --platform=darwin --arch=arm64 --version=1.0.5 --overwrite --icon=../app/assets/img/icon_app.icns
// 生成DMG文件
安装[appdmg](https://github.com/LinusU/node-appdmg)
拷贝pack/dmg目录的文件,到pack/output/OfficeAlarm-darwin-x64中
cp -rf dmg/* output/OfficeAlarm-darwin-x64/
cd output/OfficeAlarm-darwin-x64/
appdmg appdmg.json OfficeAlarm.dmg
// M1
npm install --save electron@11
Issue:Electron failed to install correctly, please delete node_modules/electron and try installing again
npm install electron-fix@11 -g
- Electron Packager requires Node 4.0 or above.
- brew install nodebrew
- npm install -g n
- n 8.11.4