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:devVSCode + 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 Extensionsfrom VSCode's command palette - Find
TypeScript and JavaScript Language Features, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Windowfrom the command palette.
See Vite Configuration Reference.
npm installnpm run devnpm run buildRun Unit Tests with Vitest
NOTE: this does not work yet, feel free to contribute.
npm run test:unitRun End-to-End Tests with Cypress
npm run build
npm run test:e2e # or `npm run test:e2e:ci` for headless testingLint with ESLint
npm run lintRun development server and electron UI.
npm run electron:devCompile installable Electron packages.
npm run app:buildnpx simple-git-hooks- See Configuration Reference.
- Mac category LSApplicationCategoryType
- Update App Icons in
electron/assetsfolder. - 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 version in your project's package.json file (e.g.
2022.02.20) - Commit and sign that change (
git commit -s -a -m "chore: release v2022.02.20") - Tag and sign your commit (
git tag -s -a v2022.02.20 -m "v2022.02.20"). Make sure your tag name's format isv{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)
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
cypressand.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.jsandelectron/preload.jsfollow 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