This is a template repository for desktop app creation with electron (v30), angular (v18) and better-sqlite3 (v9).
It includes a fully (opinionated) pre configured project setup with the following:
Package | Usage | Available Commands (check/fixup) |
---|---|---|
prettier | Checks and formats all .js ,.jsx ,.ts ,.tsx ,.json ,.html ,.md files |
npm run prettier /npm run prettier:fix |
stylelint | Checks and fixes all .ts files. |
npm run stylelint /npm run stylelint:fix |
eslint | Checks and fixes all .css ,.scss ,.sass files. |
npm run lint /npm run lint:fix |
The app provides a set of three pre-defined workspaces:
- The
workspaces/angular-app
contains the main frontend application code. - The
workspaces/electron-app
contains all code relevant for electron including main, renderer and IPC communication. - The
workspaces/shared-lib
includes all code relevant for both the angular and the electron workspace.
The angular-app template includes the @ngrx dependencies for reactive state management.
To debug the @ngrx state the Redux DevTools are required.
Download and extract this extension to workspaces/electron-app/plugins
. Create the folder if it does not exist yet.
Adjust the path to the plugin in workspaces/electron-app/src/main/windows/main.ts
where all plugins can be loaded. Important: Extensions should only be used in development for debugging purposes as they are out of scope for electron!
Important scripts to run the app are listed in the DEV SCRIPTS
and the PROD SCRIPTS
sections.
Using the start
script all code will be compiled in watch mode so the app recompiles on any code changes. The script scripts/electron-forge-watcher.js
watches changes in the shared-lib and electron-app and recompiles the electron application.
This repository includes two prepared workflows capable of creating releases for the Linux and Windows platforms.
Semantic Release is used to define the next app version to release. The .releaserc.json
file includes the plugin configuration.
(Note: The initial version will always be 1.0.0 so in case you need a release <1.0.0 you should use other plugins.)
To utilize Semantic Release your commits should follow the Conventional Commit Guidelines.
When using this schema the workflows will automatically create/update the CHANGELOG.md
file depending on the commits included in a release.
Semantic Release will create a tag including the new version by following the Semantic Versioning.
The release workflow executes the package:prod script to build portable apps for the matrix of Linux and Windows.
The resulting folders are zipped and uploaded as a release directly to GitHub. The release includes the relevant changelog parts as release notes taken from the release commit message.
To create new releases the workflow defined in .github/workflows/semantic-release-main.yml has to be executed. (Note: A new version is only created if the changes affect the semantic version of the app.)