Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

Commit 7657b68

Browse files
sis0k0rigor789
authored andcommitted
feat: update to NativeScript 6.0 (#134)
* refactor: remove the webpack.config.js The `webpack.config.js` file will be added by the `nativescript-dev-webpack` plugin. * refactor(android): set `markingMode` to `none` * chore: update vue projects application resources '/Android' directory structure * chore: update dependencies to {N} 6.0 * refactor: remove mentions of the `bundle` flag The `bundle` flag's been removed in {N} 6.0. * refactor: remove recommendations of using the `hmr` flag The `hmr` flag's now enabled by default in {N} 6.0. * docs(meta): correct a couple of grammatical mistakes * docs: mention the `tns preview` command * docs: update the newly generated project README
1 parent 7870b87 commit 7657b68

25 files changed

+183
-386
lines changed

README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,13 @@ cd <project-name>
1818
npm install
1919

2020
# Build
21-
tns build <platform> --bundle
21+
tns build <platform>
2222

23-
# Build, watch for changes and run the application
24-
tns run <platform> --bundle
23+
# Preview the application on a device
24+
tns preview
2525

26-
# Build, watch for changes and run the application with
27-
# HMR enabled (Hot Module Replacement)
28-
# ---
29-
# make sure you have the latest nativescript cli installed for this to work
30-
# npm install -g nativescript@next
31-
tns run <platform> --hmr
26+
# Build, watch for changes and run the application
27+
tns run
3228

3329
# Clean the NativeScript application instance
3430
tns platform remove <platform>
@@ -43,17 +39,17 @@ During usual run, project runs with following settings -
4339

4440
```bash
4541
# Build, watch for changes and debug the application
46-
tns debug <platform> --bundle
42+
tns debug <platform>
4743
```
4844

4945
To minify code, and prevent Vue logs -
5046

5147
```bash
5248
# Build for production
53-
tns build <platform> --bundle --env.production
49+
tns build <platform> --env.production
5450

5551
# Run as production
56-
tns run <platform> --bundle --env.production
52+
tns run <platform> --env.production
5753
```
5854

5955
## Using NativeScript plugins

meta.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,15 @@ module.exports = {
173173
logger.log(chalk.yellow(`https://github.com/nativescript-vue/vue-cli-template/blob/master/template/package.json`))
174174
logger.log('')
175175
logger.log(chalk.grey(`-------------------------------------------`))
176-
logger.log(`The reason we don't do this automatically, is`)
177-
logger.log(`that you would loose any modifications you've`)
176+
logger.log(`The reason we don't do this automatically is`)
177+
logger.log(`that you would lose any modifications you've`)
178178
logger.log(`made to ${chalk.underline('package.json')}`)
179179
} else {
180180
logger.log(`cd ${chalk.yellow(data.destDirName)}`)
181181
logger.log(`npm install`)
182-
logger.log(`tns run android ${chalk.green('--bundle')}`)
182+
logger.log(`tns preview`)
183183
logger.log(chalk.grey(`# or`))
184-
logger.log(`tns run ios ${chalk.green('--bundle')}`)
185-
logger.log(chalk.grey(`--`))
186-
logger.log(`You may also try the new HMR mode by replacing ${chalk.green('--bundle')}`)
187-
logger.log(`with ${chalk.green('--hmr')}, but note that this is a beta feature.`)
184+
logger.log(`tns run`)
188185
}
189186
}
190187
}

template/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
# Install dependencies
99
npm install
1010

11-
# Build for production
12-
tns build <platform> --bundle
11+
# Preview on device
12+
tns preview
13+
14+
# Build, watch for changes and run the application
15+
tns run
1316

1417
# Build, watch for changes and debug the application
15-
tns debug <platform> --bundle
18+
tns debug <platform>
1619

17-
# Build, watch for changes and run the application
18-
tns run <platform> --bundle
19-
```
20+
# Build for production
21+
tns build <platform> --env.production
22+
23+
```
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
// Add your native dependencies here:
22

3+
// Uncomment to add recyclerview-v7 dependency
4+
//dependencies {
5+
// implementation 'com.android.support:recyclerview-v7:+'
6+
//}
7+
8+
// If you want to add something to be applied before applying plugins' include.gradle files
9+
// e.g. project.ext.googlePlayServicesVersion = "15.0.1"
10+
// create a file named before-plugins.gradle in the current directory and place it there
11+
312
android {
4-
defaultConfig {
13+
defaultConfig {
14+
minSdkVersion 17
515
generatedDensities = []
6-
applicationId = "__PACKAGE__"
716
}
8-
aaptOptions {
9-
additionalParameters "--no-version-vectors"
10-
}
11-
}
17+
aaptOptions {
18+
additionalParameters "--no-version-vectors"
19+
}
20+
}
Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,39 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest
3-
xmlns:android="http://schemas.android.com/apk/res/android" package="__PACKAGE__" android:versionCode="{{ androidVersionCode version }}" android:versionName="{{ version }}">
4-
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
5-
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="__APILEVEL__" />
6-
<uses-permission android:name="android.permission.INTERNET" />
7-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
8-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
9-
<application android:name="com.tns.NativeScriptApplication" android:allowBackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/AppTheme">
10-
<activity android:name="com.tns.NativeScriptActivity" android:label="@string/title_activity_kimera" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@style/LaunchScreenTheme">
11-
<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />
12-
<intent-filter>
13-
<action android:name="android.intent.action.MAIN" />
14-
<category android:name="android.intent.category.LAUNCHER" />
15-
</intent-filter>
16-
</activity>
17-
<activity android:name="com.tns.ErrorReportActivity" />
18-
</application>
19-
</manifest>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="__PACKAGE__"
4+
android:versionCode="10000"
5+
android:versionName="1.0">
6+
7+
<supports-screens
8+
android:smallScreens="true"
9+
android:normalScreens="true"
10+
android:largeScreens="true"
11+
android:xlargeScreens="true"/>
12+
13+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
14+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
15+
<uses-permission android:name="android.permission.INTERNET"/>
16+
17+
<application
18+
android:name="com.tns.NativeScriptApplication"
19+
android:allowBackup="true"
20+
android:icon="@drawable/icon"
21+
android:label="@string/app_name"
22+
android:theme="@style/AppTheme">
23+
24+
<activity
25+
android:name="com.tns.NativeScriptActivity"
26+
android:label="@string/title_activity_kimera"
27+
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|locale|uiMode"
28+
android:theme="@style/LaunchScreenTheme">
29+
30+
<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />
31+
32+
<intent-filter>
33+
<action android:name="android.intent.action.MAIN" />
34+
<category android:name="android.intent.category.LAUNCHER" />
35+
</intent-filter>
36+
</activity>
37+
<activity android:name="com.tns.ErrorReportActivity"/>
38+
</application>
39+
</manifest>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<color name="ns_primary">#F5F5F5</color>
4-
<color name="ns_primaryDark">#53ba82</color>
5-
<color name="ns_accent">#33B5E5</color>
4+
<color name="ns_primaryDark">#757575</color>
5+
<color name="ns_accent">#33B5E5</color>
66
<color name="ns_blue">#272734</color>
7-
</resources>
7+
</resources>

template/app/App_Resources/Android/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<style name="AppTheme" parent="AppThemeBase">
3131
</style>
3232

33-
<!-- theme for actioon-bar -->
33+
<!-- theme for action-bar -->
3434
<style name="NativeScriptToolbarStyleBase" parent="Widget.AppCompat.Toolbar">
3535
<item name="android:background">@color/ns_primary</item>
3636
<item name="theme">@style/ThemeOverlay.AppCompat.ActionBar</item>

template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{
22
"images" : [
3+
{
4+
"size" : "20x20",
5+
"idiom" : "iphone",
6+
"filename" : "[email protected]",
7+
"scale" : "2x"
8+
},
9+
{
10+
"size" : "20x20",
11+
"idiom" : "iphone",
12+
"filename" : "[email protected]",
13+
"scale" : "3x"
14+
},
315
{
416
"size" : "29x29",
517
"idiom" : "iphone",
@@ -42,6 +54,18 @@
4254
"filename" : "[email protected]",
4355
"scale" : "3x"
4456
},
57+
{
58+
"size" : "20x20",
59+
"idiom" : "ipad",
60+
"filename" : "icon-20.png",
61+
"scale" : "1x"
62+
},
63+
{
64+
"size" : "20x20",
65+
"idiom" : "ipad",
66+
"filename" : "[email protected]",
67+
"scale" : "2x"
68+
},
4569
{
4670
"size" : "29x29",
4771
"idiom" : "ipad",
@@ -89,7 +113,7 @@
89113
"idiom" : "ios-marketing",
90114
"filename" : "icon-1024.png",
91115
"scale" : "1x"
92-
}
116+
}
93117
],
94118
"info" : {
95119
"version" : 1,
Loading
Loading
Loading

template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
{
22
"images" : [
3+
{
4+
"extent" : "full-screen",
5+
"idiom" : "iphone",
6+
"subtype" : "2688h",
7+
"filename" : "Default-Portrait-XS-Max.png",
8+
"minimum-system-version" : "12.0",
9+
"orientation" : "portrait",
10+
"scale" : "3x"
11+
},
12+
{
13+
"extent" : "full-screen",
14+
"idiom" : "iphone",
15+
"subtype" : "2688h",
16+
"filename" : "Default-Landscape-XS-Max.png",
17+
"minimum-system-version" : "12.0",
18+
"orientation" : "landscape",
19+
"scale" : "3x"
20+
},
21+
{
22+
"extent" : "full-screen",
23+
"idiom" : "iphone",
24+
"subtype" : "1792h",
25+
"filename" : "Default-Portrait-XR.png",
26+
"minimum-system-version" : "12.0",
27+
"orientation" : "portrait",
28+
"scale" : "2x"
29+
},
30+
{
31+
"extent" : "full-screen",
32+
"idiom" : "iphone",
33+
"subtype" : "1792h",
34+
"filename" : "Default-Landscape-XR.png",
35+
"minimum-system-version" : "12.0",
36+
"orientation" : "landscape",
37+
"scale" : "2x"
38+
},
339
{
440
"extent" : "full-screen",
541
"idiom" : "iphone",
@@ -10,12 +46,12 @@
1046
"scale" : "3x"
1147
},
1248
{
13-
"orientation" : "landscape",
14-
"idiom" : "iphone",
1549
"extent" : "full-screen",
50+
"idiom" : "iphone",
51+
"subtype" : "2436h",
1652
"filename" : "Default-Landscape-X.png",
1753
"minimum-system-version" : "11.0",
18-
"subtype" : "2436h",
54+
"orientation" : "landscape",
1955
"scale" : "3x"
2056
},
2157
{

template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
{
1414
"idiom" : "universal",
15+
"filename" : "[email protected]",
1516
"scale" : "3x"
1617
}
1718
],

template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
{
1414
"idiom" : "universal",
15+
"filename" : "[email protected]",
1516
"scale" : "3x"
1617
}
1718
],

template/app/App_Resources/iOS/Info.plist

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<key>CFBundleDevelopmentRegion</key>
66
<string>en</string>
77
<key>CFBundleDisplayName</key>
8-
<string>{{ app_name }}</string>
8+
<string>${PRODUCT_NAME}</string>
99
<key>CFBundleExecutable</key>
1010
<string>${EXECUTABLE_NAME}</string>
1111
<key>CFBundleInfoDictionaryVersion</key>
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>{{ version }}</string>
18+
<string>1.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>{{ version }}</string>
22+
<string>1.0</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>UILaunchStoryboardName</key>
@@ -43,5 +43,9 @@
4343
<string>UIInterfaceOrientationLandscapeLeft</string>
4444
<string>UIInterfaceOrientationLandscapeRight</string>
4545
</array>
46+
<key>UIStatusBarStyle</key>
47+
<string>UIStatusBarStyleLightContent</string>
48+
<key>UIViewControllerBasedStatusBarAppearance</key>
49+
<false/>
4650
</dict>
4751
</plist>

0 commit comments

Comments
 (0)