Skip to content

Commit deebb12

Browse files
Adding development guide
Plus several formatting adaptions for better understanding and reading. Also added a step zero to check for npm.
1 parent 0e18990 commit deebb12

1 file changed

Lines changed: 54 additions & 8 deletions

File tree

README.md

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This project demonstrates how that would work.
55
## TypeORM >= 0.1.7
66
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.
77
If you already have a custom webpack config file you have to add these lines to your plugins (for both development and production):
8+
89
```js
910
plugins: [
1011
...,
@@ -20,26 +21,71 @@ If you don't use a custom wepack config, copy the one from this example and add
2021
}
2122
```
2223

23-
### How to run this example
24-
1. Install the ionic and cordova cli: `npm install -g cordova ionic`
25-
2. Install all dependencies: `npm install`
26-
3. Add a platform: `ionic cordova platform add <ios | android>`
27-
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+
2866

2967
![screenshot](./screenshot.png)
3068

3169
### Using TypeORM in your own app
3270
1. Install the plugin: `ionic cordova plugin add cordova-sqlite-storage --save`
71+
3372
2. Install TypeORM: `npm install typeorm --save`
73+
3474
3. Install node.js-Types: `npm install @types/node --save-dev`
75+
3576
4. Add `"typeRoots": ["node_modules/@types"]` to your `tsconfig.json` under `compilerOptions`
77+
3678
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)
3779

3880
### 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+
4084
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>`*)
87+
88+
3. Date fields are **not supported**:
4389
```ts
4490
@Column()
4591
birthdate: Date;

0 commit comments

Comments
 (0)