Skip to content

governance-foundation/template-electron-vuex-vuetify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

template-electron-vuex-vuetify

build_status Coverage Status github license github issues github last commit github repo size Gitter Gitter

Overview

This template should help get you started developing Electron app using Vue 3, Vite, Vuex and Vuetify, and friends.

Main Window

Run Setup

# 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

Recommended IDE Setup

VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).

Type Support for .vue Imports in TS

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:

  1. Disable the built-in TypeScript Extension
    1. Run Extensions: Show Built-in Extensions from VSCode's command palette
    2. Find TypeScript and JavaScript Language Features, right click and select Disable (Workspace)
  2. Reload the VSCode window by running Developer: Reload Window from the command palette.

Customize configuration

See Vite Configuration Reference.

Project Setup

npm install

Compile and Hot-Reload for Development

npm run dev

Type-Check, Compile and Minify for Production

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

Electron Dev

Run development server and electron UI.

npm run electron:dev

Build Electron Dist

Compile installable Electron packages.

npm run app:build

Add Githooks

npx simple-git-hooks

Customize configuration

Pipelines

Following pipleines exist for compiling code as its commited

  • Build Branche (build.yml) - Build and Test all branches and create releases.

Releasing

When you want to create a new release, follow these steps:

  1. Update the project version npm verison 2022.03.24 this will update the package.json and relevant commit.
  2. If commit was not created, commit and sign that change (git commit -s -a -m "chore: release 2022.02.20")
  3. 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
  4. Push your changes to GitHub (git push && git push --tags)

Pull Request

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.

App Generation

To generate this app from sratch run the following:

Part 1 - Automated

  • 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
  • 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
  • Add Vuetify UI framework vue add vuetify
    • use Default

Part 2 - Manual steps

  • 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
  • Add Electron, Vitest and Vite

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