typeorm / cordova-example

Example project to demonstrate TypeORM in a Cordova app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to run? Exact steps for noob

pleerock opened this issue · comments

Last time Ive worked with cordova 3-4 years ago. Can you please provide exact steps so just any noob like me can try this example?

  1. I did npm i cordova -g
  2. I installed plugin: cordova plugin add cordova-sqlite-storage --save
  3. Im trying to run cordova platform add android but it gives me following error:
$ cordova platform add android
Using cordova-fetch for cordova-android@^6.2.3
Adding android project...
Error: Error validating package name. Package name must look like: com.company.Name

Also readme tells me to do:

  1. copy Reflect.js and system.src.js from the node_modules folder into the lib folder

right after npm i and tsc, however I don't have "lib" directory after doing those steps.

I messed the App-ID up. Step 2 is not necessary and step 3 should work now. I also included the lib folder in this repository and updated the README.

Oh looks like its inside /www directory

Oh yeah, sorry, i will change the README

ahh Im handing over an hour trying to figure out current problem. App is running okay however screen is empty. It fails on a first System call. Ive fixed wrong paths:

        <script type="text/javascript" src="lib/typeorm/Reflect.js"></script>
        <script type="text/javascript" src="lib/typeorm/system.src.js"></script>

But problem remains, still trying to figure out a problem. BTW how can I run app and see results of console.log in terminal?

I'm sorry to hear, that the example doesn't work for you.
The paths should be fine if you copy Reflect.js and system.src.js into the www/lib folder.
There is how you can inspect android and iOS.

Okay I found the way how to print things.

I don't think its something with me =)

document.addEventListener("deviceready", function () {
    document.writeln("Hello world");
    console.log("Reflect:");
    console.log(Reflect);
    console.log("System:");
    console.log(System);
    console.log("-----");

prints me:

09-27 09:00:45.845: I/chromium(3782): [INFO:CONSOLE(4)] "Reflect:", source: file:///android_asset/www/lib/typeorm/script.js (4)
09-27 09:00:45.855: D/SystemWebChromeClient(3782): file:///android_asset/www/lib/typeorm/script.js: Line 5 : [object Object]
09-27 09:00:45.855: I/chromium(3782): [INFO:CONSOLE(5)] "[object Object]", source: file:///android_asset/www/lib/typeorm/script.js (5)
09-27 09:00:45.855: D/SystemWebChromeClient(3782): file:///android_asset/www/lib/typeorm/script.js: Line 6 : System:
09-27 09:00:45.865: I/chromium(3782): [INFO:CONSOLE(6)] "System:", source: file:///android_asset/www/lib/typeorm/script.js (6)
09-27 09:00:45.905: D/SystemWebChromeClient(3782): file:///android_asset/www/lib/typeorm/script.js: Line 7 : Uncaught ReferenceError: System is not defined
09-27 09:00:45.915: I/chromium(3782): [INFO:CONSOLE(7)] "Uncaught ReferenceError: System is not defined", source: file:///android_asset/www/lib/typeorm/script.js (7)

Okay maybe console.log Reflect isnt a good idea because this object is already presents in javascript even without reflect metadata... But the fact is that it does not see systemjs's System for some reason

Im giving up. Did you actually run this example? Because I found bugs and it obviously cannot be run with them. Please check this example on your machine

I haven't for a while

I updated the example to the newest version of TypeORM. The screenshot below is from my Moto G5 running Android 7.0 and the app was created using cordova 7.0.1
screenshot_20170927-155754

Okay I just pulled and still have a problem. I guess its something with my emulator. I'll try to install android 7 emulator

What version are you running in the emulator?

Can I close this issue? And do you think it's a good idea to include the libraries in the www/lib folder?

I downloaded and tried 7 emulator but it crashes all the time. I don't know why. Im going to download another emulator and check it before closing this issue.

And do you think it's a good idea to include the libraries in the www/lib folder?

No, I don't think so, it does not look as a good idea.

Also, when are you be able to setup ionic example? Im planning to make a final release today or tomorrow and publish links on reddit, it will be really great if we'll have ionic example for those who are interested in it.

Ionic example is online
And the libraries are removed