Skip to content

Commit 72ee7bf

Browse files
committed
update to [email protected] (fixes #17)
1 parent df450fc commit 72ee7bf

File tree

4 files changed

+81
-96
lines changed

4 files changed

+81
-96
lines changed

README.md

+17-32
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,6 @@
22
You can use TypeORM in connection with the `cordova-sqlite-storage` plugin in your Ionic app.
33
This project demonstrates how that would work.
44

5-
## TypeORM >= 0.1.7
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-
If you already have a custom webpack config file you have to add these lines to your plugins (for both development and production):
8-
9-
```js
10-
plugins: [
11-
...,
12-
new webpack.NormalModuleReplacementPlugin(/typeorm$/, function (result) {
13-
result.request = result.request.replace(/typeorm/, "typeorm/browser");
14-
}),
15-
new webpack.ProvidePlugin({
16-
'window.SQL': 'sql.js/js/sql.js'
17-
})
18-
]
19-
```
20-
If you don't use a custom wepack config, copy the one from this example and add it to your `package.json` under `config`:
21-
```json
22-
"config": {
23-
"ionic_webpack": "./config/webpack.config.js"
24-
}
25-
```
26-
275
## Installation
286

297
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.
@@ -38,26 +16,25 @@ npm -v
3816
npm install -g cordova ionic
3917
```
4018

41-
2. Install all dependencies listed in [`package.json`](/package.json#L15-L47).
19+
2. Install all dependencies listed in [`package.json`](/package.json).
4220
```bash
4321
npm install
4422
```
4523

46-
### Run app in development mode
47-
3. Run the app in your browser:
24+
### Running the example in your browser
4825
```bash
4926
ionic serve
5027
```
5128

52-
### Run app in production mode
53-
3. Add an iOS or Android platform to your project:
29+
### Running the example on your device
30+
3. Add an iOS or Android to the project.
5431
```bash
5532
ionic cordova platform add ios
5633
# or
5734
ionic cordova platform add android
5835
```
5936

60-
4. Run the app on your device:
37+
4. Run the app on your device.
6138
```bash
6239
ionic cordova run ios
6340
# or
@@ -66,15 +43,23 @@ ionic cordova run android
6643

6744
*For further information please read [ionic's deployment guide](https://ionicframework.com/docs/intro/deploying/).*
6845

69-
7046
![screenshot](./screenshot.png)
7147

7248
### Using TypeORM in your own app
73-
1. Install the plugin: `ionic cordova plugin add cordova-sqlite-storage --save`
49+
1. Install the plugin
50+
```bash
51+
ionic cordova plugin add cordova-sqlite-storage --save
52+
```
7453

75-
2. Install TypeORM: `npm install typeorm --save`
54+
2. Install TypeORM
55+
```bash
56+
npm install typeorm --save
57+
```
7658

77-
3. Install node.js-Types: `npm install @types/node --save-dev`
59+
3. Install node.js-Types
60+
```bash
61+
npm install @types/node --save-dev
62+
```
7863

7964
4. Add `"typeRoots": ["node_modules/@types"]` to your `tsconfig.json` under `compilerOptions`
8065

config.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@
8787
<plugin name="cordova-plugin-splashscreen" spec="^4.1.0" />
8888
<plugin name="cordova-plugin-statusbar" spec="^2.4.1" />
8989
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
90-
<plugin name="cordova-sqlite-storage" spec="^2.2.1" />
9190
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
91+
<plugin name="cordova-sqlite-storage" spec="^2.2.1" />
9292
</widget>

package.json

+61-61
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
11
{
2-
"name": "ionic-example",
3-
"version": "1.0.0",
4-
"author": "Daniel Lang",
5-
"scripts": {
6-
"clean": "ionic-app-scripts clean",
7-
"build": "ionic-app-scripts build",
8-
"lint": "ionic-app-scripts lint",
9-
"ionic:build": "ionic-app-scripts build",
10-
"ionic:serve": "ionic-app-scripts serve"
2+
"name": "ionic-example",
3+
"version": "1.0.0",
4+
"author": "Daniel Lang",
5+
"scripts": {
6+
"clean": "ionic-app-scripts clean",
7+
"build": "ionic-app-scripts build",
8+
"lint": "ionic-app-scripts lint",
9+
"ionic:build": "ionic-app-scripts build",
10+
"ionic:serve": "ionic-app-scripts serve"
11+
},
12+
"config": {
13+
"ionic_webpack": "./config/webpack.config.js"
14+
},
15+
"dependencies": {
16+
"@angular/common": "4.4.3",
17+
"@angular/compiler": "4.4.3",
18+
"@angular/compiler-cli": "4.4.3",
19+
"@angular/core": "4.4.3",
20+
"@angular/forms": "4.4.3",
21+
"@angular/http": "4.4.3",
22+
"@angular/platform-browser": "4.4.3",
23+
"@angular/platform-browser-dynamic": "4.4.3",
24+
"@ionic-native/core": "4.3.0",
25+
"@ionic-native/splash-screen": "4.3.0",
26+
"@ionic-native/status-bar": "4.3.0",
27+
"@ionic/storage": "2.0.1",
28+
"cordova-android": "^6.4.0",
29+
"cordova-ios": "^4.5.0",
30+
"cordova-plugin-device": "^1.1.7",
31+
"cordova-plugin-splashscreen": "^4.1.0",
32+
"cordova-plugin-statusbar": "^2.4.1",
33+
"cordova-plugin-whitelist": "^1.3.3",
34+
"cordova-sqlite-storage": "^2.2.1",
35+
"ionic-angular": "3.7.0",
36+
"ionic-plugin-keyboard": "^2.2.1",
37+
"ionicons": "3.0.0",
38+
"rxjs": "5.4.3",
39+
"sw-toolbox": "3.6.0",
40+
"typeorm": "^0.2.0",
41+
"zone.js": "0.8.17"
42+
},
43+
"devDependencies": {
44+
"@ionic/app-scripts": "^3.0.0",
45+
"@types/node": "^8.0.31",
46+
"sql.js": "^0.5.0",
47+
"typescript": "^2.7.1"
48+
},
49+
"description": "An Ionic project",
50+
"cordova": {
51+
"plugins": {
52+
"cordova-plugin-device": {},
53+
"cordova-plugin-splashscreen": {},
54+
"cordova-plugin-statusbar": {},
55+
"cordova-plugin-whitelist": {},
56+
"ionic-plugin-keyboard": {},
57+
"cordova-sqlite-storage": {}
1158
},
12-
"config": {
13-
"ionic_webpack": "./config/webpack.config.js"
14-
},
15-
"dependencies": {
16-
"@angular/common": "4.4.3",
17-
"@angular/compiler": "4.4.3",
18-
"@angular/compiler-cli": "4.4.3",
19-
"@angular/core": "4.4.3",
20-
"@angular/forms": "4.4.3",
21-
"@angular/http": "4.4.3",
22-
"@angular/platform-browser": "4.4.3",
23-
"@angular/platform-browser-dynamic": "4.4.3",
24-
"@ionic-native/core": "4.3.0",
25-
"@ionic-native/splash-screen": "4.3.0",
26-
"@ionic-native/status-bar": "4.3.0",
27-
"@ionic/storage": "2.0.1",
28-
"cordova-android": "^6.4.0",
29-
"cordova-ios": "^4.5.0",
30-
"cordova-plugin-device": "^1.1.7",
31-
"cordova-plugin-splashscreen": "^4.1.0",
32-
"cordova-plugin-statusbar": "^2.4.1",
33-
"cordova-plugin-whitelist": "^1.3.3",
34-
"cordova-sqlite-storage": "^2.2.1",
35-
"ionic-angular": "3.7.0",
36-
"ionic-plugin-keyboard": "^2.2.1",
37-
"ionicons": "3.0.0",
38-
"rxjs": "5.4.3",
39-
"sw-toolbox": "3.6.0",
40-
"typeorm": "0.1.6",
41-
"zone.js": "0.8.17"
42-
},
43-
"devDependencies": {
44-
"@ionic/app-scripts": "^3.0.0",
45-
"@types/node": "^8.0.31",
46-
"sql.js": "^0.5.0",
47-
"typescript": "2.3.4"
48-
},
49-
"description": "An Ionic project",
50-
"cordova": {
51-
"plugins": {
52-
"cordova-plugin-device": {},
53-
"cordova-plugin-splashscreen": {},
54-
"cordova-plugin-statusbar": {},
55-
"cordova-plugin-whitelist": {},
56-
"ionic-plugin-keyboard": {},
57-
"cordova-sqlite-storage": {}
58-
},
59-
"platforms": [
60-
"android",
61-
"ios"
62-
]
63-
}
59+
"platforms": [
60+
"android",
61+
"ios"
62+
]
63+
}
6464
}

src/entities/post.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ export class Post {
1515
text: string;
1616

1717
@ManyToMany(type => Category, {
18-
cascadeInsert: true
18+
cascade: ['insert']
1919
})
2020
@JoinTable()
2121
categories: Category[];
2222

2323
@ManyToOne(type => Author, author => author.posts, {
24-
cascadeInsert: true
24+
cascade: ['insert']
2525
})
2626
author: Author;
2727
}

0 commit comments

Comments
 (0)