This template should help get you started developing Electron
app using Vue 3
, Vite
, Vuex
and Vuetify
, and friends.
# clone the project
git clone https://github.com/governance-foundation/template-electron-vuex-vuetify.git
# enter the project directory
cd template-electron-vuex-vuetify
# install dependency
npm install
# develop
npm run electron:dev
VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
TypeScript cannot handle type information for .vue
imports by default, so we replace the tsc
CLI with vue-tsc
for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue
types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensions
from VSCode's command palette - Find
TypeScript and JavaScript Language Features
, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Window
from the command palette.
See Vite Configuration Reference.
npm install
npm run dev
npm run build
Run Unit Tests with Vitest
NOTE: this does not work yet, feel free to contribute.
npm run test:unit
Run End-to-End Tests with Cypress
npm run build
npm run test:e2e # or `npm run test:e2e:ci` for headless testing
Lint with ESLint
npm run lint
Run development server and electron UI.
npm run electron:dev
Compile installable Electron packages.
npm run app:build
npx simple-git-hooks
- See Configuration Reference.
- Mac category LSApplicationCategoryType
- Update App Icons in
electron/assets
folder. - Update App Details and build config in
package.json
.
Following pipleines exist for compiling code as its commited
- Build Branche (build.yml) - Build and Test all branches and create releases.
When you want to create a new release, follow these steps:
- Update the project version
npm verison 2022.03.24
this will update the package.json and relevant commit. - If commit was not created, commit and sign that change (
git commit -s -a -m "chore: release 2022.02.20"
) - Tag and sign your commit (
git tag -s -a 2022.02.20 -m "2022.02.20"
). Make sure your tag name's format is{YYYY}.{MM}.{DD}
. Your workflow will use this tag to detect when to create a release - Push your changes to GitHub (git push && git push --tags)
When committing code please ensure that you add your commits to dedicated feature branch, name your branch feature/#<issue id>-name-of-issue
.
When creating a PR please add default reviewers to your PR. Set title of your PR as #<issue id> Title of issue
.
When interacting with reviews on your PR please resolve conversartions that you have fixed, and re-request reviews after you have pushed updates to your branch.
To generate this app from sratch run the following:
- Install Vue globally -
npm install -g @vue/cli
- Create Vue App
vue create template-electron-vuex-vuetify
- Please pick a preset:
- Manually select features
- Features (All Yes)
- Babel
- TypeScript
- Progressive Web App (PWA) Support
- Router
- Vuex
- CSS Pre-processors
- Linter / Formatter
- Unit Testing
- E2E Testing
- Use class-style component syntax?
- Yes
- Use Babel alongside TypeScript?
- Yes
- Use history mode for router?
- Yes
- Pick a CSS pre-processor:
- Sass/SCSS (with dart-sass)
- Pick a linter / formatter config:
- ESLint + Prettier
- Please pick a preset:
- Pick additional lint features: * Lint on save
- Pick a unit testing solution:
- Jest
- Pick an E2E testing solution: Cypress
- Where do you prefer placing config:
- In dedicated config files
- Pick a unit testing solution:
- Add Vuetify UI framework
vue add vuetify
- use
Default
- use
- Remove Jest, will be replaced by Vitest
- remove test folder
- remove dependencies
npm remove @types/jest jest ts-jest @vue/vue3-jest @vue/cli-plugin-unit-jest babel-jest @vue/cli-plugin-babel
-
Create Vite template for copying Vite config
- create blank vite-vue app
npm create vite@latest my-vue-app -- --template vue
- copy accross folders
cypress
and.vscode
- copy acresss all the conig files
- create blank vite-vue app
-
Add Electron, Vitest and Vite
- add configs
package.json
,vite.config.ts
,electron.js
andelectron/preload.js
follow this Vite + Vue 3 + electron + TypeScript - add dependencies
- add configs
npm install vitest vue-tsc jsdom start-server-and-test @types/jsdom @types/node @vue/tsconfig @rushstack/eslint-patch @vitejs/plugin-vue concurrently cross-env electron electron-builder wait-on @types/electron-devtools-installer vite --save-dev