Skip to content

chore: Simplify dev workflow #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
nativescript-angular*.tgz
bin/dist
node_modules
tags
src/nativescript-angular/**/*.js
!src/nativescript-angular/postinstall.js
!src/nativescript-angular/hooks/**/*.js
.baseDir.ts
**/*.js.map

/hooks

nativescript-angular/**/*.d.ts
!nativescript-angular/global.d.ts
nativescript-angular/**/*.js
!nativescript-angular/postinstall.js
!nativescript-angular/hooks/**/*.js
!nativescript-angular/gulpfile.js

.tscache
.nvm
.vscode
Expand All @@ -19,7 +25,6 @@ tests/lib
tests/node_modules

ng-sample/app/**/*.js
ng-sample/app/nativescript-angular
ng-sample/app/global.d.ts
ng-sample/platforms
ng-sample/lib
Expand Down
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ install:
- npm install -g nativescript --ignore-scripts
- tns usage-reporting disable
- tns error-reporting disable
- cd nativescript-angular
- npm install
- cd ../tests
- npm install
- npm install ../nativescript-angular

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

script:
- npm install
- cd ./tests
- npm install
- tns platform add android
- tns test android --emulator --justlaunch
46 changes: 0 additions & 46 deletions DEVELOPERS.md

This file was deleted.

45 changes: 29 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Integrating NativeScript with Angular 2.

# Running locally

# Prerequisites
## Prerequisites

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

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

```
$ npm install -g grunt-cli gulp
$ npm install -g gulp
```

Then install the needed NPM packages:

```
$ cd nativescript-angular
$ npm install
```

## Compile and prepare NativeScript and Angular

```
$ grunt
```

## Initialize the test NativeScript app (ng-sample)
## Run the sample application (ng-sample)

Intall NPM packages (use the local copy of `nativescript-angular`):
```
$ cd ng-sample
$ npm install
$ npm install ../nativescript-angular
```

The latter installs the `angular2` and `tns-core-modules` packages that you just built by running `grunt prepare` step in the project root.

## Run the ng-sample app
Start the app:

```
$ tns run android
Expand All @@ -61,19 +56,37 @@ $ env WEBPACK_BUILD=1 tns run android

# Running the tests

Intall NPM packages (use the local copy of `nativescript-angular`):
```
$ cd tests
$ npm install
$ npm install ../nativescript-angular
```

Start test run:

```
$ tns test ios --emulator
$ tns test android --emulator
```

# Developer workflow:

1. Make changes to `src/nativescript-angular`, and rebuild with `grunt build`. If succesful, you should get a npm package in the project root.
2. Navigate to the ng-sample subdir: `$ cd ng-sample`. Make some changes to the app or `../src/nativescript-angular`.
3. Run with `$ tns run android` or `$ tns run ios`
## Setup:
Use `npm link` to link `nativescript-angular` in `tests` and `ng-sample` progects:

```
cd nativescript-angular
npm link
cd ../ng-sample
npm link nativescript-angular
cd ../tests
npm link nativescript-angular
```

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.
## Work
1. Make changes to the `test`, `ng-sample` projects or in `nativescript-angular` folder.
2. Run the `tests` or `ng-sample` using as shown above.

# Watch the video explaining Angular 2 and NativeScript
[NativeScript session on AngularConnect conference](https://www.youtube.com/watch?v=4SbiiyRSIwo)
Expand Down
139 changes: 0 additions & 139 deletions gruntfile.js

This file was deleted.

11 changes: 11 additions & 0 deletions nativescript-angular/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.tgz

*.ts
!*.d.ts

*.js.map

tsconfig.json
global.d.ts
.npmignore
gulpfile.js
File renamed without changes.
1 change: 1 addition & 0 deletions nativescript-angular/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" />
15 changes: 15 additions & 0 deletions nativescript-angular/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var gulp = require('gulp');
var del = require('del');
var glob = require('glob');

gulp.task('clean-defs', function() {
var files = [...glob.sync("*.ts"), ...glob.sync("!(node_modules)/*.ts")]
.map(function(file) {
return file.replace(/.ts$/, '.d.ts');
});

return del(files).then(paths => {
console.log('Definition files cleaned:')
console.log(paths.join('\n'));
});
});
Loading