├── .gitignore ├── tsconfig.json ├── src └── hello.ts ├── README.md ├── index.html ├── package.json └── gulpfile.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | dist -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.6.2", 3 | "compilerOptions": { 4 | "emitDecoratorMetadata": true, 5 | "experimentalDecorators": true, 6 | "target": "es5", 7 | "module": "system", 8 | "moduleResolution": "node", 9 | "removeComments": true, 10 | "sourceMap": false 11 | }, 12 | "exclude": [ 13 | "node_modules" 14 | ] 15 | } -------------------------------------------------------------------------------- /src/hello.ts: -------------------------------------------------------------------------------- 1 | import {Component} from 'angular2/core'; 2 | import {bootstrap} from 'angular2/platform/browser'; 3 | 4 | @Component({ 5 | selector: 'hello-app', 6 | template: ` 7 |

Hello, {{name}}!

8 | Say hello to: 9 | ` 10 | }) 11 | export class HelloApp { 12 | name: string = 'World'; 13 | } 14 | 15 | bootstrap(HelloApp); -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ng2-play.ts 2 | 3 | A minimal [Angular2](https://angular.io/) playground using [TypeScript](http://www.typescriptlang.org/) and [SystemJS loader](https://github.com/systemjs/systemjs) 4 | 5 | ## Install 6 | 7 | Clone this repo and execute in your favourite shell: 8 | 9 | * `npm i -g gulp` to install gulp globally (if you don't have it installed already) 10 | * `npm i` to install local npm dependencies 11 | 12 | ## Play 13 | 14 | After completing installation type in your favourite shell: 15 | 16 | * `gulp play` to start a "Hello World" app in a new browser window. App files are observed and will be re-transpiled on each change. 17 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Angular2 playground 6 | 7 | 8 | 9 | Loading... 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 | 26 | 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ng2-play.ts", 3 | "version": "1.0.0-SNAPSHOT", 4 | "description": "A minimal Angular2 playground using TypeScript", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/pkozlowski-opensource/ng2-play.ts.git" 8 | }, 9 | "bugs": { 10 | "url": "https://github.com/pkozlowski-opensource/ng2-play.ts/issues" 11 | }, 12 | "homepage": "https://github.com/pkozlowski-opensource/ng2-play.ts#readme", 13 | "devDependencies": { 14 | "connect": "^3.4.0", 15 | "del": "^1.2.0", 16 | "gulp": "^3.9.0", 17 | "gulp-typescript": "^2.8.0", 18 | "open": "0.0.5", 19 | "serve-static": "^1.10.0" 20 | }, 21 | "dependencies": { 22 | "angular2": "2.0.0-beta.16", 23 | "es6-shim": "0.35.0", 24 | "reflect-metadata": "0.1.2", 25 | "rxjs": "5.0.0-beta.2", 26 | "zone.js": "0.6.12", 27 | "systemjs": "0.19.6" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | 3 | var PATHS = { 4 | src: 'src/**/*.ts' 5 | }; 6 | 7 | gulp.task('clean', function (done) { 8 | var del = require('del'); 9 | del(['dist'], done); 10 | }); 11 | 12 | gulp.task('ts2js', function () { 13 | var typescript = require('gulp-typescript'); 14 | var tscConfig = require('./tsconfig.json'); 15 | 16 | var tsResult = gulp 17 | .src([PATHS.src, 'node_modules/angular2/typings/browser.d.ts']) 18 | .pipe(typescript(tscConfig.compilerOptions)); 19 | 20 | return tsResult.js.pipe(gulp.dest('dist')); 21 | }); 22 | 23 | gulp.task('play', ['ts2js'], function () { 24 | var http = require('http'); 25 | var connect = require('connect'); 26 | var serveStatic = require('serve-static'); 27 | var open = require('open'); 28 | 29 | var port = 9000, app; 30 | 31 | gulp.watch(PATHS.src, ['ts2js']); 32 | 33 | app = connect().use(serveStatic(__dirname)); 34 | http.createServer(app).listen(port, function () { 35 | open('http://localhost:' + port); 36 | }); 37 | }); 38 | 39 | gulp.task('default', ['play']); 40 | --------------------------------------------------------------------------------