Based on https://github.com/maximegris/angular-electron.
Used packages with link to their repository/homepage/API:
- http://typeorm.io/#/ and https://github.com/typeorm/typeorm
- https://nestjs.com/ and https://github.com/nestjs/nest
- https://github.com/scttcper/ngx-toastr
- https://material.angular.io/
- https://ngxs.gitbook.io/ngxs/
- Run
npm install
Run.\node_modules\.bin\electron-builder install-app-deps
to install native modules, like sqlite3 or drive-list. See also https://electronjs.org/docs/tutorial/using-native-node-modulesRun.\node_modules\.bin\electron-rebuild.cmd -f -w sqlite3
to be able to use sqlite3 with Electron (see Use SQLite with Electron).- Run one of the following commands:
npm start
to start a locally running client in Electron (development mode). The server will be started automatically.npm run client:test
to run tests for client (not available yet)npm run server:start
to start a locally running server only (development mode)npm run server:test
to run tests for servernpm run electron:build:windows
to build the app for Windowsnpm run publish:windows
to publish a new version to GitHub (adjust the version inpackage.json
)
- Start a terminal as admin
$ npm install --save-dev electron-rebuild
$ npm install sqlite3 --save
$ npm --add-python-to-path='true' --debug install --global --vs2015 windows-build-tools
(it's currently not working without the--vs2015
flag)- Restart terminal (so that changed PATH is available)
$ .\node_modules\.bin\electron-rebuild.cmd -f -w sqlite3
Error: The specified module could not be found. C:\...\node_modules\drivelist\build\Release\drivelist.node
- Admin terminal:
npm --add-python-to-path='true' --debug install --global --vs2015 windows-build-tools
.\node_modules\.bin\electron-rebuild.cmd -f -w drivelist
- Admin terminal:
Error: GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"
- On Windows, run in powershell:
[Environment]::SetEnvironmentVariable("GH_TOKEN","<YOUR_TOKEN_HERE>","User")
- Restart PowerShell/IDE
- On Windows, run in powershell:
-
Generate a GitHub access token by going to https://github.com/settings/tokens/new. The access token should have the
repo
scope/permission. Once you have the token, assign it to an environment variableOn macOS/linux:
export GH_TOKEN="<YOUR_TOKEN_HERE>"
On Windows, run in powershell:
[Environment]::SetEnvironmentVariable("GH_TOKEN","<YOUR_TOKEN_HERE>","User")
Make sure to restart IDE/Terminal to inherit latest env variable.
-
Run
$ npm run publish:windows
to build and package the app for Windows. -
A new release will automatically be created under https://github.com/pschild/image-management-tool/releases.
If"releaseType"
inelectron-builder.json
is set to"draft"
or not set at all, edit the new release and publish it. When it's set to"release"
it will be published automatically. -
Download and install the app from the latest release (using the .exe file).
-
When you want to release a new version, make sure to increment the version in
package.json
, commit and push your changes. -
Do steps 2 and 3 again.
-
The app will automatically detect the new release and update itself.
Run npm start
to start development version (start client in Electron, server will be started automatically).
Run npm run server:start
to start the server only.
Jest will be used to run test suites.
You can run tests for server with npm run server:test
.
Tests for client are not available yet.
Run typeorm migration:create -n SomeNameForMigrationFile
to let the CLI create a file <TIMESTAMP>-SomeNameForMigrationFile.ts
located in server/migration
.
Migrations are run automatically, when the flag migrationsRun
is set to true
in ormconfig.json
. Changes to the entities of course need to be made manually.
See the files 1538044562515-TagLabelName.ts
and 1538046038653-TagNameLabel.ts
as an example for creating migrations. They show, how the column label
in table tag
is renamed to name
, and afterwards this change is reversed.