0.1.3 • Published 8 years ago

gulp-typescript-angular-annotate v0.1.3

Weekly downloads
37
License
MIT
Repository
github
Last release
8 years ago

gulp-typescript-annotate

gulp plugin to append class name & constructor parameter names to TypeScript Class. If typesafe option is true, this plugin append $inject from constructor parameter type.

Motivation

Working with TypeScript 1.5 Decorator, we can write component-based programing code for AngularJS.

let Controller = (clazz:any)=>{
   angular.module('sample')
     .controller(clazz.$className,class);
}

@Controller
class TestController{

   date:Date;

   constructor(public q:angular.IQService){
     this.date = new Date();
   }

}

gulp-typescript-annotate append $className and $inject to code.

let Controller = (clazz:any)=>{
   angular.module('sample')
     .controller(clazz.$className,class);
}

@Controller
class TestController{

   date:Date;

   constructor(public q:angular.IQService){
     this.date = new Date();
   }/*<generated>*/static $className = 'TestController';static $inject = ['$q'];/*</generated>*/

}

see more examples

Install

Install with npm

$ npm install gulp-typescript-annotate

Usage

Modify gulpfile.js

Add gulp-typescript-annotate plugin to gulp pipe before gulp-typescript plugin.

var gulp = require('gulp');

var typescript = require('gulp-typescript');
var typescriptAnnotate = require('gulp-typescript-annotate');

gulp.task('scripts', function () {
  return gulp.src('./**/*.ts')
    .pipe(typescriptAnnotate({typesafe:true}))
    .pipe(typescript())
    .pipe(gulp.dest('./dist'));
});
0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago