├── .gitignore ├── .idea ├── inspectionProfiles │ └── Project_Default.xml ├── jsLibraryMappings.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── nativescript-sample.iml └── vcs.xml ├── README.md ├── app ├── App_Resources │ ├── Android │ │ ├── app.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ ├── background.png │ │ │ ├── icon.png │ │ │ └── logo.png │ │ │ ├── drawable-ldpi │ │ │ ├── background.png │ │ │ ├── icon.png │ │ │ └── logo.png │ │ │ ├── drawable-mdpi │ │ │ ├── background.png │ │ │ ├── icon.png │ │ │ └── logo.png │ │ │ ├── drawable-nodpi │ │ │ └── splash_screen.xml │ │ │ ├── drawable-xhdpi │ │ │ ├── background.png │ │ │ ├── icon.png │ │ │ └── logo.png │ │ │ ├── drawable-xxhdpi │ │ │ ├── background.png │ │ │ ├── icon.png │ │ │ └── logo.png │ │ │ ├── drawable-xxxhdpi │ │ │ ├── background.png │ │ │ ├── icon.png │ │ │ └── logo.png │ │ │ ├── values-v21 │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ └── styles.xml │ └── iOS │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── icon-1024.png │ │ │ ├── icon-29.png │ │ │ ├── icon-29@2x.png │ │ │ ├── icon-29@3x.png │ │ │ ├── icon-40.png │ │ │ ├── icon-40@2x.png │ │ │ ├── icon-40@3x.png │ │ │ ├── icon-60@2x.png │ │ │ ├── icon-60@3x.png │ │ │ ├── icon-76.png │ │ │ ├── icon-76@2x.png │ │ │ └── icon-83.5@2x.png │ │ ├── Contents.json │ │ ├── LaunchImage.launchimage │ │ │ ├── Contents.json │ │ │ ├── Default-1125h.png │ │ │ ├── Default-568h@2x.png │ │ │ ├── Default-667h@2x.png │ │ │ ├── Default-736h@3x.png │ │ │ ├── Default-Landscape-X.png │ │ │ ├── Default-Landscape.png │ │ │ ├── Default-Landscape@2x.png │ │ │ ├── Default-Landscape@3x.png │ │ │ ├── Default-Portrait.png │ │ │ ├── Default-Portrait@2x.png │ │ │ ├── Default.png │ │ │ └── Default@2x.png │ │ ├── LaunchScreen.AspectFill.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchScreen-AspectFill.png │ │ │ └── LaunchScreen-AspectFill@2x.png │ │ └── LaunchScreen.Center.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchScreen-Center.png │ │ │ └── LaunchScreen-Center@2x.png │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ └── build.xcconfig ├── LICENSE ├── README.md ├── app.scss ├── components │ ├── App.ts │ └── TaskItem.ts ├── images │ └── NativeScript-Vue.png ├── main.ts ├── models │ └── Todo.ts └── package.json ├── docs └── demo.gif ├── hooks ├── after-prepare │ └── nativescript-dev-webpack.js ├── after-watch │ ├── nativescript-dev-typescript.js │ └── nativescript-dev-webpack.js ├── before-cleanApp │ └── nativescript-dev-webpack.js ├── before-prepare │ └── nativescript-dev-typescript.js ├── before-prepareJSApp │ └── nativescript-dev-webpack.js ├── before-shouldPrepare │ └── nativescript-dev-webpack.js ├── before-watch │ ├── nativescript-dev-typescript.js │ └── nativescript-dev-webpack.js └── before-watchPatterns │ ├── nativescript-dev-typescript.js │ └── nativescript-dev-webpack.js ├── package-lock.json ├── package.json ├── tsconfig.esm.json ├── tsconfig.json ├── types └── nativescript-vue.d.ts └── webpack.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Node template 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | 10 | # Runtime data 11 | pids 12 | *.pid 13 | *.seed 14 | *.pid.lock 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # nyc test coverage 23 | .nyc_output 24 | 25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 26 | .grunt 27 | 28 | # Bower dependency directory (https://bower.io/) 29 | bower_components 30 | 31 | # node-waf configuration 32 | .lock-wscript 33 | 34 | # Compiled binary addons (https://nodejs.org/api/addons.html) 35 | build/Release 36 | 37 | # Dependency directories 38 | node_modules/ 39 | jspm_packages/ 40 | 41 | # TypeScript v1 declaration files 42 | typings/ 43 | 44 | # Optional npm cache directory 45 | .npm 46 | 47 | # Optional eslint cache 48 | .eslintcache 49 | 50 | # Optional REPL history 51 | .node_repl_history 52 | 53 | # Output of 'npm pack' 54 | *.tgz 55 | 56 | # Yarn Integrity file 57 | .yarn-integrity 58 | 59 | # dotenv environment variables file 60 | .env 61 | 62 | # next.js build output 63 | .next 64 | ### JetBrains template 65 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 66 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 67 | 68 | # User-specific stuff 69 | .idea/ 70 | !/.idea/jsLibraryMappings.xml 71 | !/.idea/codeStyles/ 72 | 73 | # CMake 74 | cmake-build-debug/ 75 | cmake-build-release/ 76 | 77 | # Mongo Explorer plugin 78 | .idea/**/mongoSettings.xml 79 | 80 | # File-based project format 81 | *.iws 82 | 83 | # IntelliJ 84 | out/ 85 | 86 | # mpeltonen/sbt-idea plugin 87 | .idea_modules/ 88 | 89 | # JIRA plugin 90 | atlassian-ide-plugin.xml 91 | 92 | # Cursive Clojure plugin 93 | .idea/replstate.xml 94 | 95 | # Crashlytics plugin (for Android Studio and IntelliJ) 96 | com_crashlytics_export_strings.xml 97 | crashlytics.properties 98 | crashlytics-build.properties 99 | fabric.properties 100 | 101 | # Editor-based Rest Client 102 | .idea/httpRequests 103 | ### VisualStudioCode template 104 | .vscode/ 105 | 106 | 107 | # Nativescript 108 | /platforms 109 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/jsLibraryMappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/nativescript-sample.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NativeScript Vue TypeORM Sample 2 | 3 | Okay let's break this down 4 | 5 | - **NativeScript** : Runs Javascript as Native apps on Android and iOS 6 | - **VueJS**: A frontend framework that can be used in NativeScript (Angular is possible too) 7 | - **nativescript-sqlite**: A Sqlite library for {N}, used here as the Sqlite driver 8 | - **TypeORM**: A TypeScript/ES7 based ORM that works on NodeJS as well as browsers 9 | 10 | ## Demo 11 | As you can see the task list is persisted even when the app 12 | is killed and reopened. 13 | 14 | ![demo](docs/demo.gif) 15 | 16 | 17 | ## Setting this up 18 | 19 | Okay so the TL;DR version is this - 20 | 21 | - **Setup a NativeScript project** 22 | 23 | This creates a NativeScript-Vue app 24 | ``` 25 | tns create nativescript-sample --template nativescript-vue-template 26 | ``` 27 | 28 | Feel free to use NativeScript without any frontend framework, or with 29 | Angular. All the same. TypeORM will work everywhere 30 | 31 | - **Make sure you are _webpack_-ing your project.** 32 | 33 | TypeORM's browser library is in ES7 (with `import/export` statements) 34 | This is something that cannot be executed directly in NativeScript 35 | (At least not untill we have a JavascriptCore or V8 that start supporting it) 36 | 37 | So please make sure you are using {N} in bundle mode 38 | 39 | ``` 40 | tns install webpack 41 | ``` 42 | 43 | When running the project, always use bundle mode 44 | 45 | ``` 46 | tns run ios --bundle 47 | ``` 48 | - **Install the _nativescript-sqlite_ plugin** 49 | 50 | Please make sure you install it as a tns plugin and not _just_ npm install 51 | 52 | ``` 53 | tns plugin add nativescript-sqlite 54 | ``` 55 | 56 | - **Install TypeORM** 57 | 58 | ``` 59 | npm install typeorm 60 | ``` 61 | 62 | At this stage you are ready to use TypeORM. 63 | Please read the documentation on 64 | 65 | TypeORM can be used with/without a repository and it can be used 66 | in `DataMapper` fashion or `ActiveRecord` fashion. Please do whatever 67 | feels comfortable. Everything is supported. 68 | 69 | ## Trying things out quickly 70 | 71 | ### 1. Setup TypeORM somewhere your app starts 72 | 73 | I have done this in the [app/main.ts](main.ts) file. You should ideally do this 74 | wherever your app is initialised. 75 | 76 | ```typescript 77 | import {createConnection, getManager} from "typeorm/browser"; 78 | import Todo from './models/Todo'; 79 | 80 | (async () => { 81 | try { 82 | const connection = await createConnection({ 83 | database: 'test.db', 84 | type: 'nativescript', 85 | entities: [ 86 | Todo 87 | ], 88 | logging: true 89 | }) 90 | 91 | console.log("Connection Created") 92 | 93 | // setting true will drop tables and recreate 94 | await connection.synchronize(false) 95 | 96 | console.log("Synchronized") 97 | 98 | 99 | } catch (err) { 100 | console.error(err) 101 | } 102 | })(); 103 | ``` 104 | 105 | ### 2. Define your model 106 | 107 | I am using ActiveRecord. If you want to use DataMapper, you should 108 | _**not**_ extend from BaseEntitiy 109 | 110 | ```typescript 111 | import {BaseEntity, Entity, PrimaryGeneratedColumn, Column} from "typeorm/browser"; 112 | 113 | @Entity() 114 | export default class Todo extends BaseEntity { 115 | @PrimaryGeneratedColumn() 116 | id?: number; 117 | 118 | @Column() 119 | task: string; 120 | 121 | @Column() 122 | done: boolean; 123 | 124 | constructor(task: string, done: boolean) { 125 | super(); 126 | this.task = task; 127 | this.done = done; 128 | } 129 | 130 | } 131 | ``` 132 | 133 | ### 3. Use the entities in your app 134 | 135 | You can check out [app/components/App.ts](App.ts) 136 | 137 | ```typescript 138 | import Todo from "./models/Todo"; 139 | 140 | function refreshTodos() { 141 | Todo.find().then((todos) => { 142 | console.log(todos) 143 | this.todos = todos 144 | }).catch(console.error) 145 | } 146 | function addTodo() { 147 | const todo = new Todo(this.newtask, false); 148 | todo.save().then(() => this.refreshTodos()) 149 | .catch(console.error) 150 | } 151 | ``` 152 | 153 | -------------------------------------------------------------------------------- /app/App_Resources/Android/app.gradle: -------------------------------------------------------------------------------- 1 | // Add your native dependencies here: 2 | 3 | // Uncomment to add recyclerview-v7 dependency 4 | //dependencies { 5 | // compile 'com.android.support:recyclerview-v7:+' 6 | //} 7 | 8 | android { 9 | defaultConfig { 10 | generatedDensities = [] 11 | applicationId = "org.nativescript.nativescriptsample" 12 | 13 | //override supported platforms 14 | // ndk { 15 | // abiFilters.clear() 16 | // abiFilters "armeabi-v7a" 17 | // } 18 | 19 | } 20 | aaptOptions { 21 | additionalParameters "--no-version-vectors" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-hdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-ldpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-mdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/values-v21/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3d5afe 4 | -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 14 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F5F5F5 4 | #757575 5 | #33B5E5 6 | #272734 7 | -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 21 | 22 | 23 | 31 | 32 | 34 | 35 | 36 | 42 | 43 | 45 | 46 | -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "icon-29.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "icon-29@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "icon-29@3x.png", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "icon-40@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "icon-40@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "icon-60@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "icon-60@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "29x29", 47 | "idiom" : "ipad", 48 | "filename" : "icon-29.png", 49 | "scale" : "1x" 50 | }, 51 | { 52 | "size" : "29x29", 53 | "idiom" : "ipad", 54 | "filename" : "icon-29@2x.png", 55 | "scale" : "2x" 56 | }, 57 | { 58 | "size" : "40x40", 59 | "idiom" : "ipad", 60 | "filename" : "icon-40.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "40x40", 65 | "idiom" : "ipad", 66 | "filename" : "icon-40@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "76x76", 71 | "idiom" : "ipad", 72 | "filename" : "icon-76.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "76x76", 77 | "idiom" : "ipad", 78 | "filename" : "icon-76@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "83.5x83.5", 83 | "idiom" : "ipad", 84 | "filename" : "icon-83.5@2x.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "1024x1024", 89 | "idiom" : "ios-marketing", 90 | "filename" : "icon-1024.png", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "2436h", 7 | "filename" : "Default-1125h.png", 8 | "minimum-system-version" : "11.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "orientation" : "landscape", 14 | "idiom" : "iphone", 15 | "extent" : "full-screen", 16 | "filename" : "Default-Landscape-X.png", 17 | "minimum-system-version" : "11.0", 18 | "subtype" : "2436h", 19 | "scale" : "3x" 20 | }, 21 | { 22 | "extent" : "full-screen", 23 | "idiom" : "iphone", 24 | "subtype" : "736h", 25 | "filename" : "Default-736h@3x.png", 26 | "minimum-system-version" : "8.0", 27 | "orientation" : "portrait", 28 | "scale" : "3x" 29 | }, 30 | { 31 | "extent" : "full-screen", 32 | "idiom" : "iphone", 33 | "subtype" : "736h", 34 | "filename" : "Default-Landscape@3x.png", 35 | "minimum-system-version" : "8.0", 36 | "orientation" : "landscape", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "extent" : "full-screen", 41 | "idiom" : "iphone", 42 | "subtype" : "667h", 43 | "filename" : "Default-667h@2x.png", 44 | "minimum-system-version" : "8.0", 45 | "orientation" : "portrait", 46 | "scale" : "2x" 47 | }, 48 | { 49 | "orientation" : "portrait", 50 | "idiom" : "iphone", 51 | "filename" : "Default@2x.png", 52 | "extent" : "full-screen", 53 | "minimum-system-version" : "7.0", 54 | "scale" : "2x" 55 | }, 56 | { 57 | "extent" : "full-screen", 58 | "idiom" : "iphone", 59 | "subtype" : "retina4", 60 | "filename" : "Default-568h@2x.png", 61 | "minimum-system-version" : "7.0", 62 | "orientation" : "portrait", 63 | "scale" : "2x" 64 | }, 65 | { 66 | "orientation" : "portrait", 67 | "idiom" : "ipad", 68 | "filename" : "Default-Portrait.png", 69 | "extent" : "full-screen", 70 | "minimum-system-version" : "7.0", 71 | "scale" : "1x" 72 | }, 73 | { 74 | "orientation" : "landscape", 75 | "idiom" : "ipad", 76 | "filename" : "Default-Landscape.png", 77 | "extent" : "full-screen", 78 | "minimum-system-version" : "7.0", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "orientation" : "portrait", 83 | "idiom" : "ipad", 84 | "filename" : "Default-Portrait@2x.png", 85 | "extent" : "full-screen", 86 | "minimum-system-version" : "7.0", 87 | "scale" : "2x" 88 | }, 89 | { 90 | "orientation" : "landscape", 91 | "idiom" : "ipad", 92 | "filename" : "Default-Landscape@2x.png", 93 | "extent" : "full-screen", 94 | "minimum-system-version" : "7.0", 95 | "scale" : "2x" 96 | }, 97 | { 98 | "orientation" : "portrait", 99 | "idiom" : "iphone", 100 | "filename" : "Default.png", 101 | "extent" : "full-screen", 102 | "scale" : "1x" 103 | }, 104 | { 105 | "orientation" : "portrait", 106 | "idiom" : "iphone", 107 | "filename" : "Default@2x.png", 108 | "extent" : "full-screen", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "orientation" : "portrait", 113 | "idiom" : "iphone", 114 | "filename" : "Default-568h@2x.png", 115 | "extent" : "full-screen", 116 | "subtype" : "retina4", 117 | "scale" : "2x" 118 | }, 119 | { 120 | "orientation" : "portrait", 121 | "idiom" : "ipad", 122 | "extent" : "to-status-bar", 123 | "scale" : "1x" 124 | }, 125 | { 126 | "orientation" : "portrait", 127 | "idiom" : "ipad", 128 | "filename" : "Default-Portrait.png", 129 | "extent" : "full-screen", 130 | "scale" : "1x" 131 | }, 132 | { 133 | "orientation" : "landscape", 134 | "idiom" : "ipad", 135 | "extent" : "to-status-bar", 136 | "scale" : "1x" 137 | }, 138 | { 139 | "orientation" : "landscape", 140 | "idiom" : "ipad", 141 | "filename" : "Default-Landscape.png", 142 | "extent" : "full-screen", 143 | "scale" : "1x" 144 | }, 145 | { 146 | "orientation" : "portrait", 147 | "idiom" : "ipad", 148 | "extent" : "to-status-bar", 149 | "scale" : "2x" 150 | }, 151 | { 152 | "orientation" : "portrait", 153 | "idiom" : "ipad", 154 | "filename" : "Default-Portrait@2x.png", 155 | "extent" : "full-screen", 156 | "scale" : "2x" 157 | }, 158 | { 159 | "orientation" : "landscape", 160 | "idiom" : "ipad", 161 | "extent" : "to-status-bar", 162 | "scale" : "2x" 163 | }, 164 | { 165 | "orientation" : "landscape", 166 | "idiom" : "ipad", 167 | "filename" : "Default-Landscape@2x.png", 168 | "extent" : "full-screen", 169 | "scale" : "2x" 170 | } 171 | ], 172 | "info" : { 173 | "version" : 1, 174 | "author" : "xcode" 175 | } 176 | } -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-AspectFill.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-AspectFill@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-Center.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-Center@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png -------------------------------------------------------------------------------- /app/App_Resources/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiresFullScreen 28 | 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/App_Resources/iOS/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /app/App_Resources/iOS/build.xcconfig: -------------------------------------------------------------------------------- 1 | // You can add custom settings here 2 | // for example you can uncomment the following line to force distribution code signing 3 | // CODE_SIGN_IDENTITY = iPhone Distribution 4 | // To build for device with Xcode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html 5 | // DEVELOPMENT_TEAM = YOUR_TEAM_ID; 6 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 7 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 8 | -------------------------------------------------------------------------------- /app/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Tiago Alves 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/README.md: -------------------------------------------------------------------------------- 1 | # NativeScript Vue.js Template 2 | 3 | This repo serves as the starting point for NativeScript + Vue.js projects, using [nativescript-vue](https://github.com/rigor789/nativescript-vue). 4 | 5 | ## Usage 6 | 7 | 1. Install NativeScript tools (see http://docs.nativescript.org/start/quick-setup) 8 | 9 | 2. Create app from this template 10 | 11 | ```bash 12 | tns create hello-ns-vue --template nativescript-vue-template 13 | 14 | cd hello-ns-vue 15 | ``` 16 | 17 | > While the `nativescript-vue` project is not up-to-date on npm, you may have to run 18 | > `npm link nativescript-vue` in the project folder (like [described here](https://github.com/rigor789/nativescript-vue/blob/master/CONTRIBUTING.md)). 19 | 20 | 3. Run in Android or iOS 21 | 22 | ```bash 23 | tns run android 24 | tns run ios 25 | ``` 26 | 27 | ## Templates 28 | 29 | This template contains a number of app samples that you can use as the starting point of your app. To experiment, try copying and pasting the code from `app-with-list-view.js`, `app-with-router.js`, `app-with-tab-view.js`, or `app-with-vmodel.js` into your app’s `app.js` file. 30 | -------------------------------------------------------------------------------- /app/app.scss: -------------------------------------------------------------------------------- 1 | @import '~nativescript-theme-core/css/core.light.android.css'; 2 | 3 | .task-item { 4 | 5 | .task-item-task { 6 | padding: 20; 7 | width: 100%; 8 | } 9 | } 10 | .todo-list-container { 11 | padding: 20; 12 | 13 | TextField { 14 | text-align: center; 15 | font-size: 18pt; 16 | } 17 | } 18 | .todo-list-container > * { 19 | width: 100%; 20 | } 21 | #todolist { 22 | height: 100%; 23 | } -------------------------------------------------------------------------------- /app/components/App.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'nativescript-vue' 2 | import TaskItem from './TaskItem' 3 | import Todo from "../models/Todo"; 4 | 5 | class App extends Vue { 6 | surprise: boolean 7 | newtask: string 8 | todos: Array 9 | refreshTodos: () => void 10 | } 11 | export default Vue.extend({ 12 | data() { 13 | return { 14 | newtask: '', 15 | surprise: false, 16 | todos: [ 17 | {task: 'First Task', done: false}, 18 | {task: 'Second Task', done: true} 19 | ] 20 | }; 21 | }, 22 | mounted() { 23 | this.refreshTodos() 24 | }, 25 | methods: { 26 | refreshTodos() { 27 | Todo.find().then((todos) => { 28 | console.log(todos) 29 | this.todos = todos 30 | }).catch(console.error) 31 | }, 32 | 33 | addTodo() { 34 | const todo = new Todo(this.newtask, false); 35 | todo.save().then(() => this.refreshTodos()) 36 | .catch(console.error) 37 | } 38 | }, 39 | template: ` 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | `, 54 | components: { 55 | TaskItem 56 | }, 57 | }) 58 | -------------------------------------------------------------------------------- /app/components/TaskItem.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'nativescript-vue' 2 | import Todo from "~/models/Todo"; 3 | 4 | class TaskItem extends Vue { 5 | todo: Todo 6 | } 7 | 8 | export default Vue.extend({ 9 | props: ['todo'], 10 | methods: { 11 | async removeSelf() { 12 | if (this.todo.id) { 13 | await Todo.delete({id: this.todo.id}) 14 | this.$emit('requestRefresh') 15 | } 16 | } 17 | }, 18 | template: ` 19 | 20 | 21 | 22 | ` 23 | }) -------------------------------------------------------------------------------- /app/images/NativeScript-Vue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/app/images/NativeScript-Vue.png -------------------------------------------------------------------------------- /app/main.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'nativescript-vue' 2 | import App from './components/App' 3 | import 'nativescript-sqlite' 4 | 5 | import {createConnection, getManager} from "typeorm/browser"; 6 | 7 | import Todo from '~/models/Todo'; 8 | 9 | (async () => { 10 | try { 11 | const connection = await createConnection({ 12 | database: 'test.db', 13 | type: 'nativescript', 14 | entities: [ 15 | Todo 16 | ], 17 | logging: true 18 | }) 19 | 20 | console.log("Connection Created") 21 | 22 | await connection.synchronize(false) 23 | 24 | console.log("Synchronized") 25 | 26 | 27 | } catch (err) { 28 | console.error(err) 29 | } 30 | })(); 31 | 32 | 33 | 34 | Vue.config.silent = false 35 | 36 | new Vue({ 37 | render: h => h(App), 38 | }).$start(); 39 | -------------------------------------------------------------------------------- /app/models/Todo.ts: -------------------------------------------------------------------------------- 1 | import {BaseEntity, Entity, PrimaryGeneratedColumn, Column} from "typeorm/browser"; 2 | 3 | @Entity() 4 | export default class Todo extends BaseEntity { 5 | @PrimaryGeneratedColumn() 6 | id?: number; 7 | 8 | @Column() 9 | task: string; 10 | 11 | @Column() 12 | done: boolean; 13 | 14 | constructor(task: string, done: boolean) { 15 | super(); 16 | this.task = task; 17 | this.done = done; 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "main.js", 3 | "name": "nativescript-vue-template", 4 | "version": "0.2.0" 5 | } -------------------------------------------------------------------------------- /docs/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/typeorm/nativescript-vue-typeorm-sample/ecd0906fb12d87b5b53a5175c24b7393d221ba38/docs/demo.gif -------------------------------------------------------------------------------- /hooks/after-prepare/nativescript-dev-webpack.js: -------------------------------------------------------------------------------- 1 | module.exports = require("nativescript-dev-webpack/lib/after-prepare.js"); 2 | -------------------------------------------------------------------------------- /hooks/after-watch/nativescript-dev-typescript.js: -------------------------------------------------------------------------------- 1 | module.exports = require("nativescript-dev-typescript/lib/after-watch.js"); 2 | -------------------------------------------------------------------------------- /hooks/after-watch/nativescript-dev-webpack.js: -------------------------------------------------------------------------------- 1 | module.exports = require("nativescript-dev-webpack/lib/after-watch.js"); 2 | -------------------------------------------------------------------------------- /hooks/before-cleanApp/nativescript-dev-webpack.js: -------------------------------------------------------------------------------- 1 | module.exports = require("nativescript-dev-webpack/lib/before-cleanApp.js"); 2 | -------------------------------------------------------------------------------- /hooks/before-prepare/nativescript-dev-typescript.js: -------------------------------------------------------------------------------- 1 | module.exports = require("nativescript-dev-typescript/lib/before-prepare.js"); 2 | -------------------------------------------------------------------------------- /hooks/before-prepareJSApp/nativescript-dev-webpack.js: -------------------------------------------------------------------------------- 1 | module.exports = require("nativescript-dev-webpack/lib/before-prepareJS.js"); 2 | -------------------------------------------------------------------------------- /hooks/before-shouldPrepare/nativescript-dev-webpack.js: -------------------------------------------------------------------------------- 1 | module.exports = require("nativescript-dev-webpack/lib/before-shouldPrepare.js"); 2 | -------------------------------------------------------------------------------- /hooks/before-watch/nativescript-dev-typescript.js: -------------------------------------------------------------------------------- 1 | module.exports = require("nativescript-dev-typescript/lib/watch.js"); 2 | -------------------------------------------------------------------------------- /hooks/before-watch/nativescript-dev-webpack.js: -------------------------------------------------------------------------------- 1 | module.exports = require("nativescript-dev-webpack/lib/before-watch.js"); 2 | -------------------------------------------------------------------------------- /hooks/before-watchPatterns/nativescript-dev-typescript.js: -------------------------------------------------------------------------------- 1 | module.exports = require("nativescript-dev-typescript/lib/before-watchPatterns.js"); 2 | -------------------------------------------------------------------------------- /hooks/before-watchPatterns/nativescript-dev-webpack.js: -------------------------------------------------------------------------------- 1 | module.exports = require("nativescript-dev-webpack/lib/before-watchPatterns.js"); 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "NativeScript Application", 3 | "license": "SEE LICENSE IN ", 4 | "readme": "NativeScript Application", 5 | "repository": "", 6 | "nativescript": { 7 | "id": "org.nativescript.nativescriptsample", 8 | "tns-ios": { 9 | "version": "4.1.1" 10 | }, 11 | "tns-android": { 12 | "version": "4.1.3" 13 | } 14 | }, 15 | "dependencies": { 16 | "nativescript-sqlite": "^2.2.1", 17 | "nativescript-theme-core": "^1.0.4", 18 | "nativescript-vue": "^1.3.1", 19 | "tns-core-modules": "^3.4.1", 20 | "tslib": "^1.9.3", 21 | "typeorm": "git+https://github.com/championswimmer/typeorm.git#npm_package_nativescript" 22 | }, 23 | "devDependencies": { 24 | "babel-traverse": "6.26.0", 25 | "babel-types": "6.26.0", 26 | "babylon": "6.18.0", 27 | "lazy": "1.0.11", 28 | "nativescript-dev-typescript": "^0.7.2-2018-06-22-03", 29 | "nativescript-dev-webpack": "^0.14.2", 30 | "node-sass": "^4.9.0", 31 | "typescript": "^2.9.2", 32 | "vue": "^2.5.16" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tsconfig.esm.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig", 3 | "compilerOptions": { 4 | "module": "es2015", 5 | "moduleResolution": "node" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es2015", 5 | "moduleResolution": "node", 6 | "esModuleInterop": true, 7 | "experimentalDecorators": true, 8 | "emitDecoratorMetadata": true, 9 | "noEmitHelpers": true, 10 | "importHelpers": true, 11 | "noEmitOnError": true, 12 | "lib": [ 13 | "es6", 14 | "dom" 15 | ], 16 | "typeRoots": [ 17 | "types" 18 | ], 19 | "baseUrl": ".", 20 | "paths": { 21 | "~/*": [ 22 | "app/*" 23 | ], 24 | "*": [ 25 | "./node_modules/tns-core-modules/*", 26 | "./node_modules/*" 27 | ] 28 | } 29 | }, 30 | "exclude": [ 31 | "node_modules", 32 | "platforms" 33 | ] 34 | } -------------------------------------------------------------------------------- /types/nativescript-vue.d.ts: -------------------------------------------------------------------------------- 1 | // Typings for NativeScript-Vue 2 | 3 | declare type Buffer = any 4 | declare module 'nativescript-vue' { 5 | // import vue.js typings 6 | import Vue from 'vue'; 7 | import {ExtendedVue} from 'vue/types/vue' 8 | import {ComponentOptions} from 'vue/types/options' 9 | 10 | // creat a nativescript vue class that extends vue.js 11 | class NativeScriptVue extends Vue { 12 | /** 13 | * Registers NativeScript Plugin. 14 | * @param elementName Name of the element to use in your template 15 | * @param resolver function to register the element 16 | */ 17 | static registerElement(elementName: string, resolver: (...compClass: any[]) => any): void 18 | $isAndroid: boolean 19 | $isIOS: boolean 20 | 21 | /** 22 | * Starts nativescript application.start() method 23 | */ 24 | $start(): void 25 | static extend(options: ComponentOptions): ExtendedVue 26 | } 27 | 28 | export default NativeScriptVue; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const { join, relative, resolve, sep } = require("path"); 2 | 3 | const webpack = require("webpack"); 4 | const nsWebpack = require("nativescript-dev-webpack"); 5 | const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target"); 6 | const CleanWebpackPlugin = require("clean-webpack-plugin"); 7 | const CopyWebpackPlugin = require("copy-webpack-plugin"); 8 | const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); 9 | const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); 10 | const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); 11 | 12 | module.exports = env => { 13 | // Add your custom Activities, Services and other Android app components here. 14 | const appComponents = [ 15 | "tns-core-modules/ui/frame", 16 | "tns-core-modules/ui/frame/activity", 17 | ]; 18 | 19 | const platform = env && (env.android && "android" || env.ios && "ios"); 20 | if (!platform) { 21 | throw new Error("You need to provide a target platform!"); 22 | } 23 | 24 | const platforms = ["ios", "android"]; 25 | const projectRoot = __dirname; 26 | 27 | // Default destination inside platforms//... 28 | const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot)); 29 | const appResourcesPlatformDir = platform === "android" ? "Android" : "iOS"; 30 | 31 | const { 32 | // The 'appPath' and 'appResourcesPath' values are fetched from 33 | // the nsconfig.json configuration file 34 | // when bundling with `tns run android|ios --bundle`. 35 | appPath = "app", 36 | appResourcesPath = "app/App_Resources", 37 | 38 | // You can provide the following flags when running 'tns run android|ios' 39 | snapshot, // --env.snapshot 40 | uglify, // --env.uglify 41 | report, // --env.report 42 | } = env; 43 | 44 | const appFullPath = resolve(projectRoot, appPath); 45 | const appResourcesFullPath = resolve(projectRoot, appResourcesPath); 46 | 47 | const entryModule = nsWebpack.getEntryModule(appFullPath); 48 | const entryPath = `.${sep}${entryModule}.ts`; 49 | 50 | const config = { 51 | mode: uglify ? "production" : "development", 52 | context: appFullPath, 53 | watchOptions: { 54 | ignored: [ 55 | appResourcesFullPath, 56 | // Don't watch hidden files 57 | "**/.*", 58 | ] 59 | }, 60 | target: nativescriptTarget, 61 | entry: { 62 | bundle: entryPath, 63 | }, 64 | output: { 65 | pathinfo: false, 66 | path: dist, 67 | libraryTarget: "commonjs2", 68 | filename: "[name].js", 69 | globalObject: "global", 70 | }, 71 | resolve: { 72 | extensions: [".ts", ".js", ".scss", ".css"], 73 | // Resolve {N} system modules from tns-core-modules 74 | modules: [ 75 | resolve(__dirname, "node_modules/tns-core-modules"), 76 | resolve(__dirname, "node_modules"), 77 | "node_modules/tns-core-modules", 78 | "node_modules", 79 | ], 80 | alias: { 81 | 'vue$': 'nativescript-vue', 82 | '~': appFullPath 83 | }, 84 | // don't resolve symlinks to symlinked modules 85 | symlinks: false 86 | }, 87 | resolveLoader: { 88 | // don't resolve symlinks to symlinked loaders 89 | symlinks: false 90 | }, 91 | node: { 92 | // Disable node shims that conflict with NativeScript 93 | "http": false, 94 | "timers": false, 95 | "setImmediate": false, 96 | "fs": "empty", 97 | "__dirname": false, 98 | }, 99 | devtool: "none", 100 | optimization: { 101 | splitChunks: { 102 | cacheGroups: { 103 | vendor: { 104 | name: "vendor", 105 | chunks: "all", 106 | test: (module, chunks) => { 107 | const moduleName = module.nameForCondition ? module.nameForCondition() : ''; 108 | return /[\\/]node_modules[\\/]/.test(moduleName) || 109 | appComponents.some(comp => comp === moduleName); 110 | 111 | }, 112 | enforce: true, 113 | }, 114 | } 115 | }, 116 | minimize: !!uglify, 117 | minimizer: [ 118 | new UglifyJsPlugin({ 119 | uglifyOptions: { 120 | parallel: true, 121 | cache: true, 122 | output: { 123 | comments: false, 124 | }, 125 | compress: { 126 | // The Android SBG has problems parsing the output 127 | // when these options are enabled 128 | 'collapse_vars': platform !== "android", 129 | sequences: platform !== "android", 130 | } 131 | } 132 | }) 133 | ], 134 | }, 135 | module: { 136 | rules: [ 137 | { 138 | test: new RegExp(entryPath), 139 | use: [ 140 | // Require all Android app components 141 | platform === "android" && { 142 | loader: "nativescript-dev-webpack/android-app-components-loader", 143 | options: { modules: appComponents } 144 | }, 145 | 146 | { 147 | loader: "nativescript-dev-webpack/bundle-config-loader", 148 | options: { 149 | loadCss: !snapshot, // load the application css if in debug mode 150 | } 151 | }, 152 | ].filter(loader => !!loader) 153 | }, 154 | 155 | { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"}, 156 | 157 | { 158 | test: /\.css$/, 159 | use: { loader: "css-loader", options: { minimize: false, url: false } } 160 | }, 161 | 162 | { 163 | test: /\.scss$/, 164 | use: [ 165 | { loader: "css-loader", options: { minimize: false, url: false } }, 166 | "sass-loader" 167 | ] 168 | }, 169 | 170 | { 171 | test: /\.ts$/, 172 | use: { 173 | loader: "awesome-typescript-loader", 174 | options: { configFileName: "tsconfig.esm.json" }, 175 | } 176 | }, 177 | ] 178 | }, 179 | plugins: [ 180 | // Define useful constants like TNS_WEBPACK 181 | new webpack.DefinePlugin({ 182 | "global.TNS_WEBPACK": "true" 183 | }), 184 | // Remove all files from the out dir. 185 | new CleanWebpackPlugin([ `${dist}/**/*` ]), 186 | // Copy native app resources to out dir. 187 | new CopyWebpackPlugin([ 188 | { 189 | from: `${appResourcesFullPath}/${appResourcesPlatformDir}`, 190 | to: `${dist}/App_Resources/${appResourcesPlatformDir}`, 191 | context: projectRoot 192 | }, 193 | ]), 194 | // Copy assets to out dir. Add your own globs as needed. 195 | new CopyWebpackPlugin([ 196 | { from: "fonts/**" }, 197 | { from: "**/*.jpg" }, 198 | { from: "**/*.png" }, 199 | ], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }), 200 | // Generate a bundle starter script and activate it in package.json 201 | new nsWebpack.GenerateBundleStarterPlugin([ 202 | "./vendor", 203 | "./bundle", 204 | ]), 205 | // For instructions on how to set up workers with webpack 206 | // check out https://github.com/nativescript/worker-loader 207 | new NativeScriptWorkerPlugin(), 208 | new nsWebpack.PlatformFSPlugin({ 209 | platform, 210 | platforms, 211 | }), 212 | // Does IPC communication with the {N} CLI to notify events when running in watch mode. 213 | new nsWebpack.WatchStateLoggerPlugin(), 214 | ], 215 | }; 216 | 217 | if (report) { 218 | // Generate report files for bundles content 219 | config.plugins.push(new BundleAnalyzerPlugin({ 220 | analyzerMode: "static", 221 | openAnalyzer: false, 222 | generateStatsFile: true, 223 | reportFilename: resolve(projectRoot, "report", `report.html`), 224 | statsFilename: resolve(projectRoot, "report", `stats.json`), 225 | })); 226 | } 227 | 228 | if (snapshot) { 229 | config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({ 230 | chunk: "vendor", 231 | requireModules: [ 232 | "tns-core-modules/bundle-entry-points", 233 | ], 234 | projectRoot, 235 | webpackConfig: config, 236 | })); 237 | } 238 | 239 | return config; 240 | }; 241 | --------------------------------------------------------------------------------