Skip to content

Commit a8a38e8

Browse files
author
vakrilov
committed
Additional cleanup & readme updates & build fixes
1 parent 827bf0f commit a8a38e8

File tree

10 files changed

+63
-248
lines changed

10 files changed

+63
-248
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ nativescript-angular/**/*.d.ts
1010
nativescript-angular/**/*.js
1111
!nativescript-angular/postinstall.js
1212
!nativescript-angular/hooks/**/*.js
13+
!nativescript-angular/gulpfile.js
1314

1415
.tscache
1516
.nvm

Diff for: .travis.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ install:
2525
- npm install -g nativescript --ignore-scripts
2626
- tns usage-reporting disable
2727
- tns error-reporting disable
28+
- cd nativescript-angular
29+
- npm install
30+
- cd ../tests
31+
- npm install
32+
- npm install ../nativescript-angular
2833

2934
before_script:
3035
- echo no | android create avd --force -n test -t android-19 -b armeabi-v7a
3136
- emulator -avd test -no-audio -no-window &
3237
- android-wait-for-emulator
3338

3439
script:
35-
- npm install
36-
- cd ./tests
37-
- npm install
38-
- npm install ../nativescript-angular
3940
- tns platform add android
4041
- tns test android --emulator --justlaunch

Diff for: DEVELOPERS.md

-46
This file was deleted.

Diff for: README.md

+29-16
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Integrating NativeScript with Angular 2.
44

55
# Running locally
66

7-
# Prerequisites
7+
## Prerequisites
88

99
Install your native toolchain and NativeScript as described in the docs:
1010

@@ -14,31 +14,26 @@ https://docs.nativescript.org/setup/quick-setup
1414
## Install dependencies
1515

1616
```
17-
$ npm install -g grunt-cli gulp
17+
$ npm install -g gulp
1818
```
1919

2020
Then install the needed NPM packages:
2121

2222
```
23+
$ cd nativescript-angular
2324
$ npm install
2425
```
2526

26-
## Compile and prepare NativeScript and Angular
27-
28-
```
29-
$ grunt
30-
```
31-
32-
## Initialize the test NativeScript app (ng-sample)
27+
## Run the sample application (ng-sample)
3328

29+
Intall NPM packages (use the local copy of `nativescript-angular`):
3430
```
3531
$ cd ng-sample
3632
$ npm install
33+
$ npm install ../nativescript-angular
3734
```
3835

39-
The latter installs the `angular2` and `tns-core-modules` packages that you just built by running `grunt prepare` step in the project root.
40-
41-
## Run the ng-sample app
36+
Start the app:
4237

4338
```
4439
$ tns run android
@@ -61,19 +56,37 @@ $ env WEBPACK_BUILD=1 tns run android
6156

6257
# Running the tests
6358

59+
Intall NPM packages (use the local copy of `nativescript-angular`):
6460
```
6561
$ cd tests
6662
$ npm install
63+
$ npm install ../nativescript-angular
64+
```
65+
66+
Start test run:
67+
68+
```
6769
$ tns test ios --emulator
70+
$ tns test android --emulator
6871
```
6972

7073
# Developer workflow:
7174

72-
1. Make changes to `src/nativescript-angular`, and rebuild with `grunt build`. If succesful, you should get a npm package in the project root.
73-
2. Navigate to the ng-sample subdir: `$ cd ng-sample`. Make some changes to the app or `../src/nativescript-angular`.
74-
3. Run with `$ tns run android` or `$ tns run ios`
75+
## Setup:
76+
Use `npm link` to link `nativescript-angular` in `tests` and `ng-sample` progects:
77+
78+
```
79+
cd nativescript-angular
80+
npm link
81+
cd ../ng-sample
82+
npm link nativescript-angular
83+
cd ../tests
84+
npm link nativescript-angular
85+
```
7586

76-
Note that you should never change files in `ng-sample/src/nativescript-angular/` as they are overwritten with the reference sources in `src/nativescript-angular` on every `grunt app` run.
87+
## Work
88+
1. Make changes to the `test`, `ng-sample` projects or in `nativescript-angular` folder.
89+
2. Run the `tests` or `ng-sample` using as shown above.
7790

7891
# Watch the video explaining Angular 2 and NativeScript
7992
[NativeScript session on AngularConnect conference](https://www.youtube.com/watch?v=4SbiiyRSIwo)

Diff for: gruntfile.js

-139
This file was deleted.

Diff for: nativescript-angular/.npmignore

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
*.ts
44
!*.d.ts
55

6+
*.js.map
7+
68
tsconfig.json
79
global.d.ts
810
.npmignore
11+
gulpfile.js

Diff for: nativescript-angular/global.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/// <reference path="../node_modules/tns-core-modules/tns-core-modules.d.ts" />
1+
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" />

Diff for: nativescript-angular/gulpfile.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var gulp = require('gulp');
2+
var del = require('del');
3+
var glob = require('glob');
4+
5+
gulp.task('clean-defs', function() {
6+
var files = [...glob.sync("*.ts"), ...glob.sync("!(node_modules)/*.ts")]
7+
.map(function(file) {
8+
return file.replace(/.ts$/, '.d.ts');
9+
});
10+
11+
return del(files).then(paths => {
12+
console.log('Definition files cleaned:')
13+
console.log(paths.join('\n'));
14+
});
15+
});

Diff for: nativescript-angular/package.json

+9-11
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
},
1515
"scripts": {
1616
"postinstall": "node postinstall.js",
17-
"prepublish": "tsc"
17+
"prepublish": "tsc",
18+
"postpublish": "gulp clean-defs"
1819
},
1920
"dependencies": {
2021
"nativescript-intl": "^0.0.2",
@@ -31,21 +32,18 @@
3132
"parse5": "1.4.2",
3233
"punycode": "1.3.2",
3334
"querystring": "0.2.0",
34-
"url": "0.10.3"
35+
"url": "0.10.3",
36+
"shelljs": "^0.7.0"
3537
},
3638
"devDependencies": {
37-
"grunt": "0.4.5",
38-
"grunt-contrib-copy": "0.8.0",
39-
"grunt-contrib-clean": "0.6.0",
40-
"grunt-shell": "1.1.2",
41-
"grunt-file": "1.0.2",
42-
"grunt-env": "0.4.4",
43-
"grunt-ts": "5.0.0-beta.5",
44-
"shelljs": "^0.5.3",
39+
"del": "^2.2.0",
40+
"glob": "^7.0.3",
41+
"gulp": "^3.9.1",
42+
"tns-core-modules": ">=2.0.0 || >=2.1.0-2016 || >=2.0.0-angular-7",
4543
"typescript": "^1.8.10"
4644
},
4745
"peerDependencies": {
4846
"tns-core-modules": ">=2.0.0 || >=2.1.0-2016 || >=2.0.0-angular-7"
4947
},
5048
"nativescript": {}
51-
}
49+
}

0 commit comments

Comments
 (0)