You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+68-13Lines changed: 68 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,9 @@ Native code is supported in two different ways:
26
26
- Native libraries support (using [node-ffi](https://github.com/node-ffi/node-ffi) 2.2.0)
27
27
- Hot reload for development
28
28
29
-
## To Use
29
+
## Getting ready
30
30
31
-
1.To clone and run this repository you'll need [Git](https://git-scm.com) and [Node.js](https://nodejs.org/en/download/) (which comes with [npm](http://npmjs.com)) installed on your computer.
31
+
1.In order to clone and run this repository you'll need [Git](https://git-scm.com) and [Node.js](https://nodejs.org/en/download/) (which comes with [npm](http://npmjs.com)) installed on your computer.
32
32
***Node 9 is not supported yet** due to a [node-ffi issue](https://github.com/node-ffi/node-ffi/issues/438)
33
33
***bash command line is required (use git-bash for windows)**
34
34
2. Clone the repository
@@ -50,7 +50,7 @@ Native code is supported in two different ways:
50
50
cd electron-angular-native
51
51
```
52
52
53
-
3.Install and run
53
+
3.Prepare the environment
54
54
55
55
* If you're behind a corporate firewall configure `npm` proxy:
56
56
@@ -99,13 +99,73 @@ Native code is supported in two different ways:
99
99
* From your bash (git-bash or similar) command line:
100
100
101
101
```bash
102
-
# Install dependencies and run the app
103
-
npm install && npm start
102
+
# Install dependencies
103
+
npm install
104
104
```
105
105
106
-
`npm start` runs application in debug mode while watching the .ts files (hot reload)
107
-
108
-
## To distribute
106
+
## Application structure
107
+
108
+
- All the source code resides in `src/` directory
109
+
- All the native source code resides in `src/native/` directory (a new native source code shall be put there as well)
110
+
- Precompiled binaries (`simplelib`) are fetched from [another git repository](https://github.com/meltedspark/electron-angular-native-simplelib-bin) as git submodule and can be found in `native-artifacts/precompiled-libraries` directory.
111
+
If you have any precompiled binaries you'd like to use in your project just put them inside this directory, while keeping platform and architecture subdirectories same to the `simplelib`.
112
+
- Native artifacts that were compiled from the source code as part of the build can be found in `native-artifacts/native-addons` directory (first time compiled on `npm install`)
113
+
114
+
## Application info
115
+
You can define application name, version, author and runtime node dependencies in `app.package.js`
116
+
117
+
## Development
118
+
119
+
-**Running application in debug mode:**
120
+
121
+
```bash
122
+
npm start
123
+
```
124
+
125
+
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.
126
+
The application starts with debug tools open so that you can place breakpoints and debug your Typescript code.
127
+
128
+
**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".
129
+
The reason for that is that webpack compilation and electron serve run simultaneously and the application starts before the code is ready.
130
+
All you need to do is wait - once the compilation is complete the application will reload with the compiled code.*
131
+
132
+
-**Compiling native code:**
133
+
134
+
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:
135
+
136
+
```bash
137
+
npm run compile:native
138
+
```
139
+
140
+
-**Running end to end tests with Spectron:**
141
+
142
+
To run end to end tests use the following command:
143
+
144
+
```bash
145
+
npm run e2e
146
+
```
147
+
This will run all the tests in `e2e` directory (the tests extension must be `.e2e-spec.ts`).
148
+
For your convenience there is a helper class `SpectronUtils` which can be used for tests definition and two test examples:
149
+
150
+
- `native-links.e2e-spec.ts` verifies that the links that loaded from native modules present upon the application start
151
+
- `sanity.e2e-spec.ts` verifies that the application starts
152
+
153
+
-**AoT build:**
154
+
155
+
Sometimes you want to make sure your code compiles with AoT compiler during the development.
156
+
In order to do that use the following command:
157
+
158
+
```bash
159
+
npm run build
160
+
```
161
+
162
+
If you want to *run* the application in product mode (built with AoT) use this:
163
+
164
+
```bash
165
+
npm run start:prod
166
+
```
167
+
168
+
## Distribution
109
169
110
170
- Run the following from the root folder to create a distribution for:
111
171
@@ -138,12 +198,7 @@ Native code is supported in two different ways:
138
198
If forsome reason you want itin dev mode (JIT), run `npm run dist:dev`
139
199
- Build artifact can be found in build-artifacts folder
140
200
141
-
## Application info
142
-
You can define application name, version author and runtime node dependencies in`app.package.js`
0 commit comments