├── .babelrc ├── .gitignore ├── 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 │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── Web │ │ ├── favicon.ico │ │ └── index.html │ └── 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 ├── assets │ └── images │ │ └── NativeScript-Vue.png ├── components │ ├── HelloWorld.native.vue │ ├── HelloWorld.web.vue │ └── HelloWorldBase.js ├── fonts │ └── .gitkeep ├── main.native.js ├── main.web.js ├── package.json ├── styles.native.scss ├── styles.web.scss └── variables.scss ├── babel.config.js ├── build ├── utils.js └── web │ ├── platforms │ └── web │ │ └── index.html │ └── webpack.config.js ├── package.json ├── vue-hot-reload-api-patcher.js ├── webpack.config.js ├── yarn-error.log └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "es2015", 5 | { 6 | "modules": false 7 | } 8 | ], 9 | "stage-2" 10 | ] 11 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | *.js.map 4 | 5 | !app/samples/*.js 6 | 7 | /platforms 8 | /hooks 9 | /lib 10 | /node_modules 11 | 12 | /tns/platforms 13 | /tns/node_modules 14 | /tns/app/tns_modules 15 | /dist-native 16 | /dist-web 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NativeScript-Vue / Web code-sharing app 2 | 3 | > A native application built with NativeScript-Vue, sharing code with a web app. 4 | 5 | ## Usage 6 | 7 | ### Getting started 8 | 9 | ```bash 10 | git clone tralves/ns-vue-codeshare-demo 11 | 12 | cd 13 | 14 | npm i 15 | ``` 16 | 17 | ### Native apps 18 | 19 | ```bash 20 | # Build for production 21 | tns build --bundle 22 | 23 | # Build, watch for changes and debug the application 24 | tns debug --bundle 25 | 26 | # Build, watch for changes and run the application 27 | tns run --bundle 28 | ``` 29 | 30 | ### Web apps 31 | 32 | ```bash 33 | # Start dev server with hot module reload 34 | yarn web:start 35 | 36 | # Build for production 37 | yarn web:build 38 | 39 | # Build for development 40 | yarn web:dev 41 | ``` 42 | 43 | The app is built in `platforms/web`. 44 | 45 | ## How to develop code-sharing apps? 46 | 47 | > coming soon... 48 | -------------------------------------------------------------------------------- /app/App_Resources/Android/app.gradle: -------------------------------------------------------------------------------- 1 | // Add your native dependencies here: 2 | 3 | android { 4 | defaultConfig { 5 | generatedDensities = [] 6 | applicationId = "org.nativescript.application" 7 | } 8 | aaptOptions { 9 | additionalParameters "--no-version-vectors" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/drawable-hdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | NativeScript-Vue Application 4 | NativeScript-Vue Application 5 | 6 | -------------------------------------------------------------------------------- /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/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | NativeScript-Vue Application 4 | NativeScript-Vue Application 5 | 6 | -------------------------------------------------------------------------------- /app/App_Resources/Android/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 17 | 18 | 20 | 21 | 22 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 42 | 43 | -------------------------------------------------------------------------------- /app/App_Resources/Web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/app/App_Resources/Web/favicon.ico -------------------------------------------------------------------------------- /app/App_Resources/Web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | test-vue-app 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/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 | NativeScript-Vue Application 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0.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 | -------------------------------------------------------------------------------- /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/assets/images/NativeScript-Vue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/app/assets/images/NativeScript-Vue.png -------------------------------------------------------------------------------- /app/components/HelloWorld.native.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 25 | 26 | 35 | -------------------------------------------------------------------------------- /app/components/HelloWorld.web.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | 25 | 30 | -------------------------------------------------------------------------------- /app/components/HelloWorldBase.js: -------------------------------------------------------------------------------- 1 | export default { 2 | data() { 3 | return { 4 | surprise: false, 5 | title: 'Tap you!', 6 | count: 300, 7 | } 8 | }, 9 | created() { 10 | setInterval(() => { 11 | this.count = this.count - 1 12 | }, 1000) 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /app/fonts/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tralves/ns-vue-codeshare-demo/0aa24e63e083ae5302ea0ed87df69bedd42130b2/app/fonts/.gitkeep -------------------------------------------------------------------------------- /app/main.native.js: -------------------------------------------------------------------------------- 1 | import Vue from 'nativescript-vue' 2 | import VueDevtools from 'nativescript-vue-devtools' 3 | 4 | Vue.use(VueDevtools) 5 | 6 | import HelloWorld from './components/HelloWorld' 7 | 8 | import './styles' 9 | 10 | // Prints Vue logs when --env.production is *NOT* set while building 11 | Vue.config.silent = TNS_ENV === 'production' 12 | 13 | new Vue({ 14 | render: h => h('frame', [h(HelloWorld)]), 15 | }).$start() 16 | -------------------------------------------------------------------------------- /app/main.web.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | import HelloWorld from './components/HelloWorld' 4 | 5 | import './styles' 6 | 7 | new Vue({ 8 | el: '#app', 9 | render: h => h(HelloWorld), 10 | }) 11 | -------------------------------------------------------------------------------- /app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "android": { 3 | "v8Flags": "--expose_gc" 4 | }, 5 | "main": "main.native", 6 | "name": "nsvue2codesharedemo", 7 | "version": "1.0.0" 8 | } 9 | -------------------------------------------------------------------------------- /app/styles.native.scss: -------------------------------------------------------------------------------- 1 | // NativeScript core theme 2 | // @see https://docs.nativescript.org/ui/theme 3 | @import '~nativescript-theme-core/scss/light'; 4 | 5 | @import 'variables'; 6 | 7 | @import '~nativescript-theme-core/scss/index'; 8 | 9 | // Global SCSS styling 10 | // @see https://docs.nativescript.org/ui/styling 11 | 12 | .page { 13 | background: $background; 14 | } 15 | -------------------------------------------------------------------------------- /app/styles.web.scss: -------------------------------------------------------------------------------- 1 | @import 'variables'; 2 | 3 | html, 4 | body { 5 | color: $secondary; 6 | height: 100%; 7 | } 8 | 9 | body { 10 | background: $background; 11 | margin: 0; 12 | font-family: Arial, Helvetica, sans-serif; 13 | font-size: 12px; 14 | } 15 | 16 | .page { 17 | margin: 10px; 18 | display: flex; 19 | flex-direction: column; 20 | flex-wrap: nowrap; 21 | justify-content: flex-start; 22 | align-items: stretch; 23 | align-content: center; 24 | 25 | > * { 26 | margin: 5px 0; 27 | } 28 | 29 | img { 30 | align-self: center; 31 | } 32 | } 33 | 34 | button { 35 | height: 30px; 36 | background-color: #00beff; 37 | color: white; 38 | text-transform: uppercase; 39 | } 40 | -------------------------------------------------------------------------------- /app/variables.scss: -------------------------------------------------------------------------------- 1 | $secondary: rgba(0, 0, 0, 0.87); 2 | $background: linear-gradient(to right, #94eaff, #d1913c); 3 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function (api) { 2 | api.cache(true) 3 | 4 | return { 5 | presets: [['@babel/env', { targets: { esmodules: true } }]], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | function getExtensions(platform) { 4 | return ['js', 'css', 'scss', 'vue'].reduce((exts, ext) => { 5 | exts.push(`.${platform}.${ext}`) 6 | if (platformIsNative(platform)) exts.push(`.native.${ext}`) 7 | exts.push(`.${ext}`) 8 | return exts 9 | }, []) 10 | } 11 | 12 | function platformIsNative(platform) { 13 | return ['ios', 'android'].includes(platform) 14 | } 15 | 16 | module.exports = { 17 | getExtensions: getExtensions, 18 | platformIsNative: platformIsNative, 19 | } 20 | -------------------------------------------------------------------------------- /build/web/platforms/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Webpack App 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build/web/webpack.config.js: -------------------------------------------------------------------------------- 1 | const { relative, resolve, sep, join } = require('path') 2 | 3 | const webpack = require('webpack') 4 | const { getExtensions } = require('../utils') 5 | const MiniCssExtractPlugin = require('mini-css-extract-plugin') 6 | const HtmlWebpackPlugin = require('html-webpack-plugin') 7 | 8 | const VueLoaderPlugin = require('vue-loader/lib/plugin') 9 | 10 | const projectRoot = resolve(__dirname, '../..') 11 | const platform = 'web' 12 | 13 | const appFullPath = resolve(projectRoot, 'app') 14 | const appResourcesFullPath = resolve( 15 | appFullPath, 16 | `App_Resources${sep}${platform}` 17 | ) 18 | const dist = resolve(projectRoot, `platforms${sep}${platform}`) 19 | const config = { 20 | /** 21 | * You can use these too for bigger projects. For now it is 0 conf mode for me! 22 | */ 23 | entry: { 24 | build: join(appFullPath, 'main.web.js'), 25 | //vendor: join(appFullPath, 'vendor.js'), 26 | }, 27 | output: { 28 | path: dist, 29 | }, 30 | resolve: { 31 | extensions: getExtensions(platform), //['.vue', '.js', '.scss', '.css'], 32 | alias: { 33 | '~': appFullPath, 34 | '@': appFullPath, 35 | // assets: resolve(appFullPath, 'assets'), 36 | }, 37 | }, 38 | module: { 39 | rules: [ 40 | { 41 | test: /\.css$/, 42 | use: [ 43 | 'css-hot-loader', 44 | MiniCssExtractPlugin.loader, 45 | { loader: 'css-loader', options: { minimize: false, url: false } }, 46 | ], 47 | }, 48 | { 49 | test: /\.scss$/, 50 | use: [ 51 | 'css-hot-loader', 52 | MiniCssExtractPlugin.loader, 53 | { loader: 'css-loader', options: { minimize: false, url: false } }, 54 | 'sass-loader', 55 | ], 56 | }, 57 | { 58 | test: /\.js$/, 59 | loader: 'babel-loader', 60 | }, 61 | { 62 | test: /\.vue$/, 63 | loader: 'vue-loader', 64 | }, 65 | { 66 | test: /\.(png|jpg|gif|svg)$/, 67 | loader: 'file-loader', 68 | options: { 69 | name: '[name].[ext]?[hash]', 70 | }, 71 | }, 72 | ], 73 | }, 74 | plugins: [ 75 | new MiniCssExtractPlugin({ 76 | filename: `app.css`, 77 | }), 78 | new HtmlWebpackPlugin({ 79 | template: resolve(appResourcesFullPath, 'index.html'), 80 | }), 81 | new VueLoaderPlugin(), 82 | ], 83 | } 84 | 85 | console.log(config) 86 | 87 | module.exports = config 88 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nsvue2codesharedemo", 3 | "version": "1.0.0", 4 | "description": "A native application built with NativeScript-Vue", 5 | "author": "Tiago Alves ", 6 | "license": "MIT", 7 | "scripts": { 8 | "web:start": "webpack-dev-server --mode development --inline --hot --config build/web/webpack.config.js", 9 | "web:dev": "webpack --mode development --config build/web/webpack.config.js", 10 | "web:build": "webpack --mode production --config build/web/webpack.config.js" 11 | }, 12 | "nativescript": { 13 | "id": "org.nativescript.application", 14 | "tns-ios": { 15 | "version": "4.2.0" 16 | }, 17 | "tns-android": { 18 | "version": "4.2.0" 19 | } 20 | }, 21 | "dependencies": { 22 | "@vue/devtools": "^5.0.0-beta.3", 23 | "nativescript-socket.io": "^0.9.0", 24 | "nativescript-theme-core": "^1.0.4", 25 | "nativescript-toast": "^1.4.6", 26 | "nativescript-vue": "^2.0.0-alpha.3", 27 | "nativescript-vue-devtools": "^1.0.0", 28 | "tns-core-modules": "^4.2.0", 29 | "vue": "^2.5.17" 30 | }, 31 | "devDependencies": { 32 | "@babel/core": "^7.0.0", 33 | "@babel/preset-env": "^7.0.0", 34 | "babel-loader": "^8.0.2", 35 | "babel-traverse": "6.26.0", 36 | "babel-types": "6.26.0", 37 | "babylon": "6.18.0", 38 | "clean-webpack-plugin": "^0.1.19", 39 | "copy-webpack-plugin": "^4.5.2", 40 | "cross-env": "^5.2.0", 41 | "css-hot-loader": "^1.4.2", 42 | "css-loader": "^1.0.0", 43 | "file-loader": "^2.0.0", 44 | "html-webpack-plugin": "^3.2.0", 45 | "lazy": "1.0.11", 46 | "mini-css-extract-plugin": "^0.4.1", 47 | "nativescript-dev-webpack": "^0.17.0-2018-09-12-01", 48 | "nativescript-vue-template-compiler": "^2.0.0-alpha.3", 49 | "nativescript-worker-loader": "~0.9.0", 50 | "node-sass": "^4.9.2", 51 | "sass-loader": "^7.1.0", 52 | "uglifyjs-webpack-plugin": "~1.2.7", 53 | "vue-loader": "^15.2.6", 54 | "vue-template-compiler": "^2.5.17", 55 | "webpack": "^4.16.4", 56 | "webpack-bundle-analyzer": "~2.13.1", 57 | "webpack-cli": "^3.1.0", 58 | "webpack-dev-server": "^3.1.8" 59 | } 60 | } -------------------------------------------------------------------------------- /vue-hot-reload-api-patcher.js: -------------------------------------------------------------------------------- 1 | // TODO: Removed the file once https://github.com/vuejs/vue-hot-reload-api/pull/70 is accepted 2 | module.exports = function (source) { 3 | return `var window = {}; 4 | ${source};`; 5 | }; 6 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const { relative, resolve, sep } = require('path') 2 | 3 | const webpack = require('webpack') 4 | const { getExtensions } = require('./build/utils') 5 | const CleanWebpackPlugin = require('clean-webpack-plugin') 6 | const CopyWebpackPlugin = require('copy-webpack-plugin') 7 | const MiniCssExtractPlugin = require('mini-css-extract-plugin') 8 | const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer') 9 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') 10 | 11 | const VueLoaderPlugin = require('vue-loader/lib/plugin') 12 | const NsVueTemplateCompiler = require('nativescript-vue-template-compiler') 13 | 14 | const nsWebpack = require('nativescript-dev-webpack') 15 | const nativescriptTarget = require('nativescript-dev-webpack/nativescript-target') 16 | const { 17 | NativeScriptWorkerPlugin, 18 | } = require('nativescript-worker-loader/NativeScriptWorkerPlugin') 19 | 20 | module.exports = env => { 21 | // Add your custom Activities, Services and other android app components here. 22 | const appComponents = [ 23 | 'tns-core-modules/ui/frame', 24 | 'tns-core-modules/ui/frame/activity', 25 | ] 26 | 27 | const platform = env && ((env.android && 'android') || (env.ios && 'ios')) 28 | if (!platform) { 29 | throw new Error('You need to provide a target platform!') 30 | } 31 | 32 | const platforms = ['ios', 'android'] 33 | const projectRoot = __dirname 34 | 35 | // Default destination inside platforms//... 36 | const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot)) 37 | const appResourcesPlatformDir = platform === 'android' ? 'Android' : 'iOS' 38 | 39 | const { 40 | // The 'appPath' and 'appResourcesPath' values are fetched from 41 | // the nsconfig.json configuration file 42 | // when bundling with `tns run android|ios --bundle`. 43 | appPath = 'app', 44 | appResourcesPath = 'app/App_Resources', 45 | 46 | // You can provide the following flags when running 'tns run android|ios' 47 | snapshot, // --env.snapshot 48 | production, // --env.production 49 | report, // --env.report 50 | hmr, // --env.hmr 51 | } = env 52 | 53 | const mode = production ? 'production' : 'development' 54 | 55 | const appFullPath = resolve(projectRoot, appPath) 56 | const appResourcesFullPath = resolve(projectRoot, appResourcesPath) 57 | 58 | const entryModule = nsWebpack.getEntryModule(appFullPath) 59 | const entryPath = `.${sep}${entryModule}.js` 60 | console.log(`Bundling application for entryPath ${entryPath}...`) 61 | 62 | const config = { 63 | mode: mode, 64 | context: appFullPath, 65 | watchOptions: { 66 | ignored: [ 67 | appResourcesFullPath, 68 | // Don't watch hidden files 69 | '**/.*', 70 | ], 71 | }, 72 | target: nativescriptTarget, 73 | // target: nativeScriptVueTarget, 74 | entry: { 75 | bundle: entryPath, 76 | }, 77 | output: { 78 | pathinfo: false, 79 | path: dist, 80 | libraryTarget: 'commonjs2', 81 | filename: '[name].js', 82 | globalObject: 'global', 83 | }, 84 | resolve: { 85 | extensions: getExtensions(platform), //['.vue', '.js', '.scss', '.css'], 86 | // Resolve {N} system modules from tns-core-modules 87 | modules: [ 88 | resolve(__dirname, 'node_modules/tns-core-modules'), 89 | resolve(__dirname, 'node_modules'), 90 | 'node_modules/tns-core-modules', 91 | 'node_modules', 92 | ], 93 | alias: { 94 | '~': appFullPath, 95 | '@': appFullPath, 96 | assets: resolve(appFullPath, 'assets'), 97 | vue: 'nativescript-vue', 98 | }, 99 | // don't resolve symlinks to symlinked modules 100 | symlinks: false, 101 | }, 102 | resolveLoader: { 103 | // don't resolve symlinks to symlinked loaders 104 | symlinks: false, 105 | }, 106 | node: { 107 | // Disable node shims that conflict with NativeScript 108 | http: false, 109 | timers: false, 110 | setImmediate: false, 111 | fs: 'empty', 112 | __dirname: false, 113 | }, 114 | devtool: 'none', 115 | optimization: { 116 | splitChunks: { 117 | cacheGroups: { 118 | vendor: { 119 | name: 'vendor', 120 | chunks: 'all', 121 | test: module => { 122 | const moduleName = module.nameForCondition 123 | ? module.nameForCondition() 124 | : '' 125 | return ( 126 | /[\\/]node_modules[\\/]/.test(moduleName) || 127 | appComponents.some(comp => comp === moduleName) 128 | ) 129 | }, 130 | enforce: true, 131 | }, 132 | }, 133 | }, 134 | minimize: Boolean(production), 135 | minimizer: [ 136 | new UglifyJsPlugin({ 137 | uglifyOptions: { 138 | parallel: true, 139 | cache: true, 140 | output: { 141 | comments: false, 142 | }, 143 | compress: { 144 | // The Android SBG has problems parsing the output 145 | // when these options are enabled 146 | collapse_vars: platform !== 'android', 147 | sequences: platform !== 'android', 148 | }, 149 | }, 150 | }), 151 | ], 152 | }, 153 | module: { 154 | rules: [ 155 | { 156 | test: new RegExp(entryPath), 157 | use: [ 158 | // Require all Android app components 159 | platform === 'android' && { 160 | loader: 'nativescript-dev-webpack/android-app-components-loader', 161 | options: { modules: appComponents }, 162 | }, 163 | 164 | { 165 | loader: 'nativescript-dev-webpack/bundle-config-loader', 166 | options: { 167 | registerPages: true, // applicable only for non-angular apps 168 | loadCss: !snapshot, // load the application css if in debug mode 169 | }, 170 | }, 171 | ].filter(loader => Boolean(loader)), 172 | }, 173 | 174 | // TODO: Removed the rule once https://github.com/vuejs/vue-hot-reload-api/pull/70 is accepted 175 | { 176 | test: resolve( 177 | __dirname, 178 | 'node_modules/vue-hot-reload-api/dist/index.js' 179 | ), 180 | use: '../vue-hot-reload-api-patcher', 181 | }, 182 | 183 | { 184 | test: /\.css$/, 185 | use: [ 186 | 'nativescript-dev-webpack/style-hot-loader', 187 | 'css-hot-loader', 188 | MiniCssExtractPlugin.loader, 189 | { loader: 'css-loader', options: { minimize: false, url: false } }, 190 | ], 191 | }, 192 | { 193 | test: /\.scss$/, 194 | use: [ 195 | 'nativescript-dev-webpack/style-hot-loader', 196 | 'css-hot-loader', 197 | MiniCssExtractPlugin.loader, 198 | { loader: 'css-loader', options: { minimize: false, url: false } }, 199 | 'sass-loader', 200 | ], 201 | }, 202 | { 203 | test: /\.js$/, 204 | loader: 'babel-loader', 205 | }, 206 | { 207 | test: /\.vue$/, 208 | loader: 'vue-loader', 209 | options: { 210 | compiler: NsVueTemplateCompiler, 211 | }, 212 | }, 213 | ], 214 | }, 215 | plugins: [ 216 | // ... Vue Loader plugin omitted 217 | new MiniCssExtractPlugin({ 218 | filename: `app.css`, 219 | }), 220 | // make sure to include the plugin! 221 | new VueLoaderPlugin(), 222 | // Define useful constants like TNS_WEBPACK 223 | new webpack.DefinePlugin({ 224 | 'global.TNS_WEBPACK': 'true', 225 | TNS_ENV: JSON.stringify(mode), 226 | }), 227 | // Remove all files from the out dir. 228 | new CleanWebpackPlugin([`${dist}/**/*`]), 229 | // Copy native app resources to out dir. 230 | new CopyWebpackPlugin([ 231 | { 232 | from: `${appResourcesFullPath}/${appResourcesPlatformDir}`, 233 | to: `${dist}/App_Resources/${appResourcesPlatformDir}`, 234 | context: projectRoot, 235 | }, 236 | ]), 237 | // Copy assets to out dir. Add your own globs as needed. 238 | new CopyWebpackPlugin( 239 | [ 240 | { from: 'fonts/**' }, 241 | { from: '**/*.+(jpg|png)' }, 242 | { from: 'assets/**/*' }, 243 | ], 244 | { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] } 245 | ), 246 | // Generate a bundle starter script and activate it in package.json 247 | new nsWebpack.GenerateBundleStarterPlugin(['./vendor', './bundle']), 248 | // For instructions on how to set up workers with webpack 249 | // check out https://github.com/nativescript/worker-loader 250 | new NativeScriptWorkerPlugin(), 251 | new nsWebpack.PlatformFSPlugin({ 252 | platform, 253 | platforms, 254 | }), 255 | // Does IPC communication with the {N} CLI to notify events when running in watch mode. 256 | new nsWebpack.WatchStateLoggerPlugin(), 257 | ], 258 | } 259 | 260 | if (report) { 261 | // Generate report files for bundles content 262 | config.plugins.push( 263 | new BundleAnalyzerPlugin({ 264 | analyzerMode: 'static', 265 | openAnalyzer: false, 266 | generateStatsFile: true, 267 | reportFilename: resolve(projectRoot, 'report', `report.html`), 268 | statsFilename: resolve(projectRoot, 'report', `stats.json`), 269 | }) 270 | ) 271 | } 272 | 273 | if (snapshot) { 274 | config.plugins.push( 275 | new nsWebpack.NativeScriptSnapshotPlugin({ 276 | chunk: 'vendor', 277 | requireModules: ['tns-core-modules/bundle-entry-points'], 278 | projectRoot, 279 | webpackConfig: config, 280 | }) 281 | ) 282 | } 283 | 284 | if (hmr) { 285 | config.plugins.push(new webpack.HotModuleReplacementPlugin()) 286 | } 287 | 288 | return config 289 | } 290 | --------------------------------------------------------------------------------