Skip to content

Commit 7574f7d

Browse files
committed
Update ng-sample app for alpha 46
1 parent 0994206 commit 7574f7d

File tree

7 files changed

+33
-94
lines changed

7 files changed

+33
-94
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ng-sample/lib
1818
ng-sample/node_modules
1919
ng-sample/src/tns_modules
2020
ng-sample/src/typings
21+
ng-sample/src/global.d.ts
2122
ng-sample/src/angular2
2223
ng-sample/src/nativescript-angular
2324

ng-sample/gruntfile.js

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = function(grunt) {
99
grunt.loadNpmTasks('grunt-shell');
1010

1111
var nsDistPath = process.env.NSDIST || '../deps/NativeScript/bin/dist';
12+
var angularDistPath = process.env.ANGULARDIST || '../';
1213

1314
var modulesPath = grunt.option("modulesPath", path.join(nsDistPath, 'modules'));
1415

@@ -26,12 +27,6 @@ module.exports = function(grunt) {
2627
dest: 'app',
2728
options: {
2829
fast: "never",
29-
30-
// Resolve non-relative modules like "ui/styling/style"
31-
// based on the project root (not on node_modules which
32-
// is the typescript 1.6+ default)
33-
additionalFlags: '--moduleResolution classic',
34-
3530
module: "commonjs",
3631
target: "es5",
3732
sourceMap: true,
@@ -57,32 +52,15 @@ module.exports = function(grunt) {
5752
expand: true,
5853
cwd: '../src',
5954
src: [
60-
'css/**/*',
6155
'nativescript-angular/**/*',
6256
'global.d.ts',
6357
],
6458
dest: 'src'
6559
},
66-
tnsifyAngular: {
67-
expand: true,
68-
cwd: 'app/',
69-
src: [
70-
"angular2/**/*",
71-
"css/**/*",
72-
"nativescript-angular/**/*",
73-
],
74-
//dest: 'platforms/android/src/main/assets/app/tns_modules',
75-
dest: 'app/tns_modules',
76-
},
7760
},
7861
shell: {
79-
updateAngular: {
80-
command: "grunt prepareAngular --angularDest ng-sample/src",
81-
options: {
82-
execOptions: {
83-
cwd: '..',
84-
}
85-
}
62+
localInstallAngular: {
63+
command: "npm install \"<%= angularPackagePath %>\""
8664
},
8765
localInstallModules: {
8866
command: "npm install \"<%= nsPackagePath %>\""
@@ -134,11 +112,26 @@ module.exports = function(grunt) {
134112
grunt.config('nsPackagePath', nsPackagePath);
135113
});
136114

115+
grunt.registerTask("getAngularPackage", function() {
116+
var packageFiles = grunt.file.expand({
117+
cwd: angularDistPath
118+
},[
119+
'angular2-*.tgz'
120+
]);
121+
var angularPackagePath = path.join(angularDistPath, packageFiles[0]);
122+
grunt.config('angularPackagePath', angularPackagePath);
123+
});
124+
137125
grunt.registerTask("updateModules", [
138126
"getNSPackage",
139127
"shell:localInstallModules",
140128
]);
141129

130+
grunt.registerTask("updateAngular", [
131+
"getAngularPackage",
132+
"shell:localInstallAngular",
133+
]);
134+
142135
grunt.registerTask("prepareQuerystringPackage", function() {
143136
//The {N} require doesn't look for index.js automatically
144137
//so we need to declare it as main
@@ -151,12 +144,11 @@ module.exports = function(grunt) {
151144

152145
grunt.registerTask("prepare", [
153146
"updateModules",
154-
"shell:updateAngular",
147+
"updateAngular",
155148
"prepareQuerystringPackage",
156149
]);
157150

158151
grunt.registerTask("preDeploy", [
159-
"copy:tnsifyAngular",
160152
]);
161153

162154
grunt.registerTask("full-clean", [

ng-sample/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
},
2424
"homepage": "https://github.com/NativeScript/template-hello-world",
2525
"dependencies": {
26-
"@reactivex/rxjs": "5.0.0-alpha.4",
26+
"@reactivex/rxjs": "5.0.0-alpha.7",
2727
"parse5": "1.4.2",
2828
"punycode": "1.3.2",
2929
"querystring": "0.2.0",
3030
"url": "0.10.3",
31-
"reflect-metadata": "0.1.1",
31+
"reflect-metadata": "0.1.2",
3232
"zone.js": "0.5.8"
3333
},
3434
"devDependencies": {

ng-sample/src/benchmark.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {Button} from 'ui/button';
33
import {Label} from 'ui/label';
44
import {Inject, Component, View, NgIf, NgFor} from 'angular2/angular2';
55
import {ApplicationRef} from 'angular2/src/core/application_ref';
6-
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
76
import * as profiling from './profiling';
87

98
@Component({selector: 'tree', inputs: ['data']})
@@ -48,7 +47,7 @@ export class Benchmark {
4847
public initDataNg = new TreeNode('', null, null);
4948
public initDataBaseline = new TreeNode('', null, null);
5049

51-
constructor(private appRef: ApplicationRef, private lifeCycle: LifeCycle) {
50+
constructor(private appRef: ApplicationRef) {
5251
}
5352

5453
public baselineTest(container: StackLayout) {
@@ -63,7 +62,7 @@ export class Benchmark {
6362

6463
public componentTest() {
6564
this.initDataNg = new TreeNode('', null, null);
66-
this.lifeCycle.tick();
65+
this.appRef.tick();
6766

6867
profiling.start('angular');
6968
this.createNgDom();
@@ -91,14 +90,14 @@ export class Benchmark {
9190
var values = this.count++ % 2 == 0 ? ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*'] :
9291
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', '-'];
9392
this.initDataBaseline = buildTree(this.maxDepth, values, 0);
94-
this.lifeCycle.tick();
93+
this.appRef.tick();
9594
}
9695

9796
private createNgDom() {
9897
var values = this.count++ % 2 == 0 ? ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*'] :
9998
['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', '-'];
10099
this.initDataNg = buildTree(this.maxDepth, values, 0);
101-
this.lifeCycle.tick();
100+
this.appRef.tick();
102101
}
103102
}
104103

ng-sample/src/global.d.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

ng-sample/src/main-page.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as profiling from "./profiling";
22
import {topmost} from 'ui/frame';
33
import {TextView} from 'ui/text-view';
44

5-
import {nativeScriptBootstrap} from 'nativescript-angular/application';
5+
import {nativeScriptBootstrap} from './nativescript-angular/application';
66
import {RendererTest} from './renderer-test';
77
import {Benchmark} from './benchmark';
88

@@ -16,7 +16,8 @@ export function pageLoaded(args) {
1616

1717
profiling.start('ng-bootstrap');
1818
console.log('BOOTSTRAPPING...');
19-
nativeScriptBootstrap(Benchmark, []).then((appRef) => {
19+
//nativeScriptBootstrap(Benchmark, []).then((appRef) => {
20+
nativeScriptBootstrap(RendererTest, []).then((appRef) => {
2021
profiling.stop('ng-bootstrap');
2122
console.log('ANGULAR BOOTSTRAP DONE.');
2223
}, (err) =>{

src/global.d.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,15 @@
11
declare var assert: any;
22

3-
interface BrowserNodeGlobal {
4-
Object: typeof Object;
5-
Array: typeof Array;
6-
Map: typeof Map;
7-
Set: typeof Set;
8-
Date: typeof Date;
9-
RegExp: typeof RegExp;
10-
JSON: typeof JSON;
11-
Math: typeof Math;
12-
assert(condition: any): void;
13-
Reflect: any;
14-
zone: Zone;
15-
getAngularTestability: Function;
16-
getAllAngularTestabilities: Function;
17-
setTimeout: Function;
18-
clearTimeout: Function;
19-
setInterval: Function;
20-
clearInterval: Function;
21-
}
3+
declare type BrowserNodeGlobal = any;
224

235
interface Map<K, V> {
246
keys(): Array<K>;
257
values(): Array<V>;
268
}
279

10+
declare type MapConstructor = typeof Map;
11+
declare type SetConstructor = typeof Set;
12+
2813
interface NumberConstructor {
2914
isInteger(number: number): boolean;
3015
}

0 commit comments

Comments
 (0)