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
+54-8Lines changed: 54 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ This project demonstrates how that would work.
5
5
## TypeORM >= 0.1.7
6
6
To support webpack builds outside of Ionic we had to remove the automatic selection of the correct TypeORM version (the `typeorm` package comes with a Node and a browser version). In order to keep using TypeORM with Ionic you have to create a custom `webpack.config.js` file. This example contains one that is identical to the one Ionic uses when no config file is specified but adds the `NormalModuleReplacementPlugin` to select the correct version.
7
7
If you already have a custom webpack config file you have to add these lines to your plugins (for both development and production):
8
+
8
9
```js
9
10
plugins: [
10
11
...,
@@ -20,26 +21,71 @@ If you don't use a custom wepack config, copy the one from this example and add
20
21
}
21
22
```
22
23
23
-
### How to run this example
24
-
1. Install the ionic and cordova cli: `npm install -g cordova ionic`
4. Run the app: `ionic cordova run <ios | android>`. If you need help, you can read [ionic's guide](https://ionicframework.com/docs/intro/deploying/) for running an app on your device
24
+
## Installation
25
+
26
+
To run this example in production or development mode you have to make sure, `ionic` and `cordova` are installed globally on your machine. After that you can install all necessary dependencies for running this example.
27
+
28
+
0. Check if `npm` is installed. Otherwise please [install `node.js` and `npm`](https://nodejs.org/en/download/package-manager/).
29
+
```bash
30
+
npm -v
31
+
```
32
+
33
+
1. Install ionic and cordova command line interface globally.
34
+
```bash
35
+
npm install -g cordova ionic
36
+
```
37
+
38
+
2. Install all dependencies listed in [`package.json`](/package.json#L15-L47).
39
+
```bash
40
+
npm install
41
+
```
42
+
43
+
### Run app in development mode
44
+
3. Run the app in your browser:
45
+
```bash
46
+
ionic serve
47
+
```
48
+
49
+
### Run app in production mode
50
+
3. Add a iOS or Android platform to your project:
51
+
```bash
52
+
ionic cordova platform add ios
53
+
# or
54
+
ionic cordova platform add android
55
+
```
56
+
57
+
4. Run the app on your device:
58
+
```bash
59
+
ionic cordova run ios
60
+
# or
61
+
ionic cordova run android
62
+
```
63
+
64
+
*For further information please read [ionic's deployment guide](https://ionicframework.com/docs/intro/deploying/).*
65
+
28
66
29
67

30
68
31
69
### Using TypeORM in your own app
32
70
1. Install the plugin: `ionic cordova plugin add cordova-sqlite-storage --save`
4. Add `"typeRoots": ["node_modules/@types"]` to your `tsconfig.json` under `compilerOptions`
77
+
36
78
5. Create a custom webpack config file like the one [included in this project](config/webpack.config.js) to use the correct TypeORM version and add the config file to your [`package.json`](package.json#L12-14) (Required with TypeORM >= 0.1.7)
37
79
38
80
### Limitations to TypeORM when using production builds
39
-
Since Ionic make a lot of optimizations when building for productions, the following limitations occur
81
+
82
+
Since Ionic make a lot of optimizations while building for production, the following limitations will occur:
83
+
40
84
1. Entities have to be marked with the table name (eg `@Entity('table_name')`)
41
-
2.`getRepository()` has to be called with the name of the entity instead of the class (eg `getRepository('post') as Repository<Post>`)
42
-
2. Date fields aren't supported
85
+
86
+
2.`getRepository()` has to be called with the name of the entity instead of the class (*eg `getRepository('post') as Repository<Post>`*)
0 commit comments