Skip to content

Commit 27fe2a4

Browse files
author
Dimitar Tachev
authored
Merge pull request #71 from NativeScript/zbranzov/update-webpack
Update webpack and ios/android build versions
2 parents d976820 + 8db6cb9 commit 27fe2a4

File tree

10 files changed

+60
-85
lines changed

10 files changed

+60
-85
lines changed

.travis.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,25 @@ matrix:
1717
os: linux
1818
node_js: "6"
1919
script: cd src && npm run ci.tslint && cd ../demo && npm run ci.tslint && cd ../demo-angular && npm run ci.tslint
20-
- stage: "WebPack"
20+
- stage: "WebPack and Build"
2121
os: osx
2222
env:
23-
- Webpack="iOS"
24-
osx_image: xcode8.3
23+
- WebpackiOS="11"
24+
osx_image: xcode9.1
2525
language: node_js
2626
node_js: "6"
2727
jdk: oraclejdk8
28-
script: cd demo && npm run build.plugin && npm i && npm run build-ios-bundle && cd ../demo-angular && npm run build.plugin && npm i && npm run build-ios-bundle
28+
script: cd demo && npm run build.plugin && npm i && npm run ns-bundle --ios --build-app --uglify && cd ../demo-angular && npm run build.plugin && npm i && npm run ns-bundle --ios --build-app --uglify
2929
- language: android
3030
os: linux
3131
env:
32-
- Webpack="Android"
32+
- WebpackAndroid="26"
3333
jdk: oraclejdk8
3434
before_install: nvm install 6.10.3
35-
script: cd demo && npm run build.plugin && npm i && npm run build-android-bundle && cd ../demo-angular && npm run build.plugin && npm i && npm run build-android-bundle
36-
- stage: "Build"
35+
script: cd demo && npm run build.plugin && npm i && npm run ns-bundle --android --build-app --uglify --snapshot && cd ../demo-angular && npm run build.plugin && npm i && npm run ns-bundle --android --build-app --uglify --snapshot
36+
- language: android
3737
env:
38-
- BuildAndroid="25"
39-
language: android
38+
- BuildAndroid="26"
4039
os: linux
4140
jdk: oraclejdk8
4241
before_install: nvm install 6.10.3
@@ -45,9 +44,9 @@ matrix:
4544
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $ANDROID_SAUCE_STORAGE --data-binary @$ANDROID_PACKAGE_FOLDER/$ANDROID_PACKAGE"
4645
- os: osx
4746
env:
48-
- BuildiOS="10.3"
49-
- Xcode="8.3"
50-
osx_image: xcode8.3
47+
- BuildiOS="11"
48+
- Xcode="9.1"
49+
osx_image: xcode9.1
5150
language: node_js
5251
node_js: "6"
5352
jdk: oraclejdk8
@@ -79,8 +78,9 @@ android:
7978
components:
8079
- tools
8180
- platform-tools
82-
- build-tools-25.0.2
83-
- android-25
81+
- build-tools-26.0.1
82+
- android-26
83+
- android-23
8484
- extra-android-m2repository
8585

8686
before_cache:

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,23 @@ NativeScript : Facebook SDK ![apple](https://cdn3.iconfinder.com/data/icons/pico
1616
- [Configuration](#configuration)
1717
- [Android](#android)
1818
- [iOS](#ios)
19-
- [NativeScript Core](#nativescript-core)
20-
- [Initialization](#initialization)
21-
- [Login](#login)
22-
- [Facebook Login Button](#facebook-login-button)
23-
- [Custom Login Button](#custom-login-button)
24-
- [Log out](#log-out)
25-
- [Facebook Logout Button](#facebook-logout-button)
26-
- [Custom Logout Button](#custom-logout-button)
27-
- [NativeScript Angular](#nativescript-angular)
28-
- [Initialization](#initialization-1)
29-
- [Login](#login-1)
30-
- [Facebook Login Button](#facebook-login-button-1)
31-
- [Custom Login Button](#custom-login-button-1)
32-
- [Logout](#logout)
33-
- [Facebook Logout Button](#facebook-logout-button-1)
34-
- [Custom Logout Button](#custom-logout-button-1)
19+
- [Usage](#usage)
20+
- [NativeScript Core](#nativescript-core)
21+
- [Initialization](#initialization)
22+
- [Login](#login)
23+
- [Facebook Login Button](#facebook-login-button)
24+
- [Custom Login Button](#custom-login-button)
25+
- [Log out](#log-out)
26+
- [Facebook Logout Button](#facebook-logout-button)
27+
- [Custom Logout Button](#custom-logout-button)
28+
- [NativeScript Angular](#nativescript-angular)
29+
- [Initialization](#initialization-1)
30+
- [Login](#login-1)
31+
- [Facebook Login Button](#facebook-login-button-1)
32+
- [Custom Login Button](#custom-login-button-1)
33+
- [Logout](#logout)
34+
- [Facebook Logout Button](#facebook-logout-button-1)
35+
- [Custom Logout Button](#custom-logout-button-1)
3536
- [Login Response](#login-response)
3637
- [Graph API Example](#graph-api-example)
3738
- [Release notes](#release-notes)
@@ -79,6 +80,7 @@ Update Info.plist file (app/App_Resources/iOS/Info.plist) to contains `CFBundleU
7980
```
8081
>Make sure you replaced {facebook_app_id} with your Facebook App Id. More info regarding how to obtain a Facebook App Id can be found [here](https://developers.facebook.com/docs/apps/register).
8182
83+
# Usage
8284
## NativeScript Core
8385
### Initialization
8486
Call init of nativescript-facebook module on application launch.

demo-angular/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ platforms
22
node_modules
33
hooks
44
app/**/*.js
5+
report
Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
1-
// Resolve JavaScript classes that extend a Java class, and need to resolve
2-
// their JavaScript module from a bundled script. For example:
3-
// NativeScriptApplication, NativeScriptActivity, etc.
4-
//
5-
// This module gets bundled together with the rest of the app code and the
6-
// `require` calls get resolved to the correct bundling import call.
7-
//
8-
// At runtime the module gets loaded *before* the rest of the app code, so code
9-
// placed here needs to be careful about its dependencies.
10-
111
require("tns-core-modules/application");
12-
require("tns-core-modules/ui/frame");
13-
require("tns-core-modules/ui/frame/activity");
14-
15-
if (global.TNS_WEBPACK) {
16-
global.__requireOverride = function (name, dir) {
17-
if (name === "./tns_modules/application/application.js") {
18-
return require("application");
19-
} else if (name === "./tns_modules/ui/frame/frame.js") {
20-
return require("ui/frame");
21-
} else if (name === "./tns_modules/ui/frame/activity.js") {
22-
return require("ui/frame/activity");
23-
}
24-
};
2+
if (!global["__snapshot"]) {
3+
/*
4+
In case snapshot generation is enabled these modules will get into the bundle but will not be required/evaluated.
5+
The snapshot webpack plugin will add them to the tns-java-classes.js bundle file. This way, they will be evaluated on app start as early as possible.
6+
*/
7+
require("tns-core-modules/ui/frame");
8+
require("tns-core-modules/ui/frame/activity");
259
}

demo-angular/app/vendor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ require("@angular/router");
1111
require("nativescript-angular/platform-static");
1212
require("nativescript-angular/forms");
1313
require("nativescript-angular/router");
14+
require("nativescript-facebook");

demo-angular/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,15 @@
4343
"lazy": "1.0.11",
4444
"nativescript-css-loader": "~0.26.0",
4545
"nativescript-dev-typescript": "^0.4.0",
46-
"nativescript-dev-webpack": "0.7.3",
46+
"nativescript-dev-webpack": "^0.8.0",
4747
"raw-loader": "~0.5.1",
4848
"resolve-url-loader": "~2.0.2",
4949
"typescript": "~2.3.4",
5050
"webpack": "~2.6.1",
5151
"webpack-sources": "~1.0.1",
5252
"tslint": "~5.4.3",
53-
"webpack-bundle-analyzer": "^2.8.2"
53+
"webpack-bundle-analyzer": "^2.8.2",
54+
"nativescript-worker-loader": "~0.8.1"
5455
},
5556
"scripts": {
5657
"ns-bundle": "ns-bundle",

demo/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
platforms
33
hooks
44
app/**/*.js
5+
report
Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
1-
// Resolve JavaScript classes that extend a Java class, and need to resolve
2-
// their JavaScript module from a bundled script. For example:
3-
// NativeScriptApplication, NativeScriptActivity, etc.
4-
//
5-
// This module gets bundled together with the rest of the app code and the
6-
// `require` calls get resolved to the correct bundling import call.
7-
//
8-
// At runtime the module gets loaded *before* the rest of the app code, so code
9-
// placed here needs to be careful about its dependencies.
10-
111
require("application");
12-
require("ui/frame");
13-
require("ui/frame/activity");
14-
15-
if (global.TNS_WEBPACK) {
16-
global.__requireOverride = function (name, dir) {
17-
if (name === "./tns_modules/application/application.js") {
18-
return require("application");
19-
} else if (name === "./tns_modules/ui/frame/frame.js") {
20-
return require("ui/frame");
21-
} else if (name === "./tns_modules/ui/frame/activity.js") {
22-
return require("ui/frame/activity");
23-
}
24-
};
25-
}
2+
if (!global["__snapshot"]) {
3+
/*
4+
In case snapshot generation is enabled these modules will get into the bundle but will not be required/evaluated.
5+
The snapshot webpack plugin will add them to the tns-java-classes.js bundle file. This way, they will be evaluated on app start as early as possible.
6+
*/
7+
require("ui/frame");
8+
require("ui/frame/activity");
9+
}

demo/app/vendor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
require("./vendor-platform");
2-
32
require("tns-core-modules/bundle-entry-points");
3+
require("nativescript-facebook");

demo/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@
3232
"nativescript-css-loader": "~0.26.0",
3333
"nativescript-dev-appium": "^1.0.0",
3434
"nativescript-dev-typescript": "^0.4.0",
35-
"nativescript-dev-webpack": "0.7.3",
35+
"nativescript-dev-webpack": "^0.8.0",
3636
"raw-loader": "~0.5.1",
3737
"resolve-url-loader": "~2.0.2",
3838
"typescript": "~2.2.2",
3939
"tslint": "~5.4.3",
4040
"wd": "~1.1.1",
4141
"webpack": "~2.6.1",
4242
"webpack-sources": "~1.0.1",
43-
"webpack-bundle-analyzer": "^2.8.2"
43+
"webpack-bundle-analyzer": "^2.8.2",
44+
"nativescript-worker-loader": "~0.8.1"
4445
},
4546
"scripts": {
4647
"ns-bundle": "ns-bundle",
@@ -52,10 +53,10 @@
5253
"ci.ios.build": "npm run build.plugin && tns build ios",
5354
"ci.ios.uitest": "npm run appium --runtype=ios-simulator103iPhone6",
5455
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
56+
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
5557
"start-android-bundle": "npm run ns-bundle --android --run-app --uglify --snapshot",
5658
"start-ios-bundle": "npm run ns-bundle --ios --run-app --uglify",
5759
"build-android-bundle": "npm run ns-bundle --android --build-app --uglify --snapshot",
58-
"build-ios-bundle": "npm run ns-bundle --ios --build-app --uglify",
59-
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install"
60+
"build-ios-bundle": "npm run ns-bundle --ios --build-app --uglify"
6061
}
61-
}
62+
}

0 commit comments

Comments
 (0)