Skip to content

Commit d76fc5d

Browse files
committed
1.5 updates:
- use a tsconfig.json to build ng-sample - move src/** to app, get rid of the unnecessary copy op - use the new tns hooks to compile typescript sources - copy renderer files to ng-sample/app done in a before-prepare hook
1 parent 3f07943 commit d76fc5d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+99
-226
lines changed

.gitignore

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@ nativescript-angular*.tgz
1212
angular2-*.tgz
1313

1414

15-
ng-sample/app
15+
ng-sample/app/**/*.js
16+
ng-sample/app/nativescript-angular
17+
ng-sample/app/global.d.ts
1618
ng-sample/platforms
1719
ng-sample/lib
1820
ng-sample/node_modules
19-
ng-sample/src/tns_modules
20-
ng-sample/src/typings
21-
ng-sample/src/global.d.ts
22-
ng-sample/src/angular2
23-
ng-sample/src/nativescript-angular
2421

2522
startup-test/platforms
2623
startup-test/lib
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

ng-sample/gruntfile.js

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,6 @@ module.exports = function(grunt) {
1616
var angularSrcPath = grunt.option("angularSrcPath") || "../src"
1717

1818
grunt.initConfig({
19-
ts: {
20-
build: {
21-
src: [
22-
'src/**/*.ts',
23-
// This one refers to the Angular package structure from npm
24-
// and doesn't compile against the dev source.
25-
'!src/nativescript-angular/application.d.ts',
26-
],
27-
dest: 'app',
28-
options: {
29-
fast: "never",
30-
module: "commonjs",
31-
target: "es5",
32-
sourceMap: true,
33-
removeComments: false,
34-
experimentalDecorators: true,
35-
emitDecoratorMetadata: true,
36-
compiler: "node_modules/typescript/bin/tsc",
37-
noEmitOnError: true
38-
},
39-
},
40-
},
41-
copy: {
42-
appFiles: {
43-
expand: true,
44-
cwd: 'src',
45-
src: [
46-
'**/*',
47-
'!**/*.ts',
48-
],
49-
dest: 'app'
50-
},
51-
rendererFiles: {
52-
expand: true,
53-
cwd: '../src',
54-
src: [
55-
'nativescript-angular/**/*',
56-
'global.d.ts',
57-
],
58-
dest: 'src'
59-
},
60-
},
6119
shell: {
6220
localInstallAngular: {
6321
command: "npm install \"<%= angularPackagePath %>\""
@@ -66,22 +24,6 @@ module.exports = function(grunt) {
6624
command: "npm install \"<%= nsPackagePath %>\""
6725
},
6826
},
69-
clean: {
70-
appBeforeDeploy: {
71-
expand: true,
72-
cwd: './app',
73-
src: [
74-
'angular2',
75-
'nativescript-angular',
76-
'css',
77-
'**/*.js.map',
78-
]
79-
},
80-
}
81-
});
82-
83-
grunt.registerTask("removeAppDir", function() {
84-
grunt.file.delete("app");
8527
});
8628

8729
grunt.registerTask("checkModules", function() {
@@ -90,18 +32,6 @@ module.exports = function(grunt) {
9032
}
9133
});
9234

93-
grunt.registerTask("app", [
94-
"copy:rendererFiles",
95-
"ts:build",
96-
"copy:appFiles",
97-
"preDeploy",
98-
]);
99-
100-
grunt.registerTask("app-full", [
101-
"full-clean",
102-
"app",
103-
]);
104-
10535
grunt.registerTask("getNSPackage", function() {
10636
var packageFiles = grunt.file.expand({
10737
cwd: nsDistPath
@@ -132,26 +62,8 @@ module.exports = function(grunt) {
13262
"shell:localInstallAngular",
13363
]);
13464

135-
grunt.registerTask("prepareQuerystringPackage", function() {
136-
//The {N} require doesn't look for index.js automatically
137-
//so we need to declare it as main
138-
var packagePath = "node_modules/querystring/package.json";
139-
140-
var packageData = grunt.file.readJSON(packagePath);
141-
packageData.main = './index.js';
142-
grunt.file.write(packagePath, JSON.stringify(packageData, null, 4));
143-
});
144-
14565
grunt.registerTask("prepare", [
14666
"updateModules",
14767
"updateAngular",
148-
"prepareQuerystringPackage",
149-
]);
150-
151-
grunt.registerTask("preDeploy", [
152-
]);
153-
154-
grunt.registerTask("full-clean", [
155-
"removeAppDir",
15668
]);
15769
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var path = require('path');
2+
var shelljs = require('shelljs');
3+
4+
module.exports = function() {
5+
shelljs.cp('-Rf', '../src/nativescript-angular', 'app');
6+
shelljs.cp('-Rf', '../src/global.d.ts', 'app');
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("nativescript-dev-typescript/lib/before-prepare.js");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("nativescript-dev-typescript/lib/watch.js");

ng-sample/package.json

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,50 @@
11
{
2-
"name": "tns-template-hello-world",
3-
"main": "app.js",
4-
"version": "1.1.0",
5-
"author": "Telerik <support@telerik.com>",
6-
"description": "Nativescript hello-world project template",
7-
"license": "BSD",
8-
"keywords": [
9-
"telerik",
10-
"mobile",
11-
"nativescript",
12-
"{N}",
13-
"tns",
14-
"appbuilder",
15-
"template"
16-
],
17-
"repository": {
18-
"type": "git",
19-
"url": "git://github.com/NativeScript/template-hello-world.git"
20-
},
21-
"bugs": {
22-
"url": "https://github.com/NativeScript/template-hello-world/issues"
23-
},
24-
"homepage": "https://github.com/NativeScript/template-hello-world",
25-
"dependencies": {
26-
"@reactivex/rxjs": "5.0.0-alpha.7",
27-
"parse5": "1.4.2",
28-
"punycode": "1.3.2",
29-
"querystring": "0.2.0",
30-
"url": "0.10.3",
31-
"reflect-metadata": "0.1.2",
32-
"zone.js": "0.5.8"
33-
},
34-
"devDependencies": {
35-
"grunt": "0.4.5",
36-
"grunt-ts": "4.2.0",
37-
"grunt-contrib-copy": "0.8.0",
38-
"grunt-contrib-clean": "0.6.0",
39-
"grunt-shell": "1.1.2",
40-
"shelljs": "^0.5.3",
41-
"typescript": "1.6.2"
42-
},
43-
"nativescript": {
44-
"id": "org.nativescript.ngsample",
45-
"tns-android": {
46-
"version": "1.4.0"
47-
}
48-
}
49-
}
2+
"name": "tns-template-hello-world",
3+
"main": "app.js",
4+
"version": "1.1.0",
5+
"author": "Telerik <support@telerik.com>",
6+
"description": "Nativescript hello-world project template",
7+
"license": "BSD",
8+
"keywords": [
9+
"telerik",
10+
"mobile",
11+
"nativescript",
12+
"{N}",
13+
"tns",
14+
"appbuilder",
15+
"template"
16+
],
17+
"repository": {
18+
"type": "git",
19+
"url": "git://github.com/NativeScript/template-hello-world.git"
20+
},
21+
"bugs": {
22+
"url": "https://github.com/NativeScript/template-hello-world/issues"
23+
},
24+
"homepage": "https://github.com/NativeScript/template-hello-world",
25+
"dependencies": {
26+
"@reactivex/rxjs": "5.0.0-alpha.7",
27+
"parse5": "1.4.2",
28+
"punycode": "1.3.2",
29+
"querystring": "0.2.0",
30+
"url": "0.10.3",
31+
"reflect-metadata": "0.1.2",
32+
"zone.js": "0.5.8"
33+
},
34+
"devDependencies": {
35+
"grunt": "0.4.5",
36+
"grunt-contrib-clean": "0.6.0",
37+
"grunt-contrib-copy": "0.8.0",
38+
"grunt-shell": "1.1.2",
39+
"grunt-ts": "5.0.0-beta.5",
40+
"nativescript-dev-typescript": "^0.2.2",
41+
"shelljs": "^0.5.3",
42+
"typescript": "^1.6.2"
43+
},
44+
"nativescript": {
45+
"id": "org.nativescript.ngsample",
46+
"tns-android": {
47+
"version": "1.4.0"
48+
}
49+
}
50+
}

ng-sample/src/android17-dummy.d.ts

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

ng-sample/src/ios-dummy.d.ts

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

ng-sample/src/ns-dependencies.d.ts

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

ng-sample/tsconfig.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"compilerOptions": {
3+
"outDir": "app",
4+
"rootDir": "app",
5+
"module": "commonjs",
6+
"target": "es5",
7+
"inlineSourceMap": true,
8+
"experimentalDecorators": true,
9+
"removeComments": false,
10+
"emitDecoratorMetadata": true,
11+
"noEmitOnError": true
12+
},
13+
"files": [
14+
"app/app.ts",
15+
"app/benchmark.ts",
16+
"app/global.d.ts",
17+
"app/main-page.ts",
18+
"app/main-view-model.ts",
19+
"app/nativescript-angular/application.d.ts",
20+
"app/nativescript-angular/application.ts",
21+
"app/nativescript-angular/dom_adapter.ts",
22+
"app/nativescript-angular/element-registry.d.ts",
23+
"app/nativescript-angular/element-registry.ts",
24+
"app/nativescript-angular/polyfills/array.ts",
25+
"app/nativescript-angular/renderer.ts",
26+
"app/nativescript-angular/view_node.ts",
27+
"app/nativescript-angular/xhr.ts",
28+
"app/nativescript-angular/zone.ts",
29+
"app/nativescript-angular/zone_patch.ts",
30+
"app/profiling.ts",
31+
"app/renderer-test.ts",
32+
"node_modules/tns-core-modules/tns-core-modules.d.ts"
33+
],
34+
"filesGlob": [
35+
"node_modules/tns-core-modules/tns-core-modules.d.ts",
36+
"app/**/*.ts"
37+
]
38+
}

0 commit comments

Comments
 (0)