Easy to use, ready for distribution boilerplate for Electron Angular applications supporting native code.
Native code is supported in two different ways:
You can define application name, version, author and runtime node dependencies in app.package.js
-
Running application in debug mode:
npm start
This will run your Electron Angular application in watch mode, i.e. if you change any .ts
file the application will reload the changes automatically.
The application starts with debug tools open so that you can place breakpoints and debug your Typescript code.
Note that first time you run npm start
the application might open with console error saying "Not allowed to load local resource: file:///.../electron-angular-native/serve/index.html".
The reason for that is that webpack compilation and electron serve run simultaneously and the application starts before the code is ready.
All you need to do is wait - once the compilation is complete the application will reload with the compiled code.
-
Debugging production build (AoT, Uglify etc.):
Sometimes you want to make sure your code compiles in production mode during the development (or even debug AoT related issues).
In order to build the application in production mode run:
npm run build:prod
If you want to debug the application in production mode (built with AoT) use this:
npm run start:prod
-
Compiling native code:
Native code is not compiled on every npm start
(it's only compiled on npm install
and before the distribution), but if you want to recompile it, run the following command from your bash command line:
npm run electron:build:native
-
Running end to end tests with Spectron:
To run end to end tests use the following command:
npm run e2e
This will run all the tests in e2e
directory (the tests extension must be .e2e-spec.ts
).
For your convenience there is a helper class SpectronUtils
which can be used for tests definition and two test examples:
native-links.e2e-spec.ts
verifies that the links that loaded from native modules present upon the application startsanity.e2e-spec.ts
verifies that the application starts
Note that end-to-end tests check the end user application (meaning the application created with npm run dist
command). This means that prior to executing npm run e2e
you have to execute npm run dist
at least once