You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+15-42
Original file line number
Diff line number
Diff line change
@@ -5,20 +5,20 @@
5
5
I'm a [Yeoman](http://yeoman.io) generator that allows you to create NodeJS modules using TypeScript. I let you quickly setup a project with latest available tools and best practices.
6
6
Tools and libraries I use -
7
7
-_tsc_ - for compiling TypeScript.
8
-
-_tsd_ - for TypeScript definition files management.
8
+
-_typings_ - for management of TypeScript definitions.
9
9
-_tsconfig.json_ - for providing compiler options.
10
10
-_tslint_ - for linting TypeScript source files.
11
11
-[_gulp_](http://gulpjs.com/) - as a build system. You can carry out above tasks through gulp.
12
12
-[_Jasmine 2_](http://jasmine.github.io/2.3/introduction.html) - for writing tests.
13
13
14
-
>You want to know if you can change any of these? Of course, why not? It is your module after all. I simply get down to business of generating, no questions asked. Once done, I get out of the way as if I were not there at all and you can do as you please!
14
+
>You want to know if you can change any of these? Of course, why not? It is your module after all. I simply get down to business of generating, no questions asked. Once done, I get out of the way and you can do as you please!
@@ -39,50 +39,23 @@ Here is the list of tasks available out of the box -
39
39
_build INTERNAL TASK - Compiles all TypeScript source files
40
40
build Compiles all TypeScript source files and updates module references
41
41
clean Cleans the generated js files from lib directory
42
-
gen_tsrefsGenerates the app.d.ts references file dynamically for all application *.ts files
42
+
gen-def Generate a single .d.ts bundle containing external module declarations exported from TypeScript module files
43
43
help Display this help text.
44
44
test Runs the Jasmine test specs [build]
45
-
tsconfig_files Update files section in tsconfig.json
46
45
tslint Lints all TypeScript source files
46
+
update-tsconfig Update files section in tsconfig.json using filesGlob entries
47
+
watch Watches ts source files and runs build on change
47
48
```
48
49
49
-
## Additional notes
50
-
- I provide nice integration with [VSCode editor](https://code.visualstudio.com/). I configure the `gulp build` task as the default VSCode build task.
51
-
- The `gulp build` task also updates _tsconfig/files_ section using _tsconfig/filesGlob_ and generates _typings/app.d.ts_ references file dynamically
52
-
for all the application *.ts files before build so you don't have to do it manually.
53
-
54
-
## Development tips
55
-
- The _tsd_ tool dynamically updates _typings/tsd.d.ts_ file for all type definitions you install through it. Also, the gulp *gen_tsrefs* task dynamically
56
-
updates _typings/app.d.ts_ references file for all application *.ts. Therefore you just need to add references to these two files in any _.ts_ file and you
57
-
are good to go with *tsc* compiler.
58
-
- To keep on using the typical CommonJS exports and imports use the `export` and `inport` systax mentioned in the example below.
59
-
60
-
```ts
61
-
classGreeter {
62
-
greeting:string;
63
-
constructor(message:string) {
64
-
this.greeting=message;
65
-
}
66
-
greet() {
67
-
return'Bonjour, '+this.greeting+'!';
68
-
}
69
-
}
70
-
//The following line is important, export like this allows you to use the old-style CommonJS export/import.
71
-
export=Greeter;
72
-
73
-
```
74
-
This is how the above class can be used in some other file.
50
+
## What's new in the latest release?
51
+
- Use of latest version of TypeScript(`^1.8`).
52
+
- Switch to _typings_ as manager for TypeScript definitions. The TSD team has deprecated _tsd_ in favour of _typings_. You can find more information about _typings_ on [Github](https://github.com/typings/typings).
53
+
- Integration of _dts-generator_ tool to generate a single _.d.ts_ bundle containing external module declarations exported from TypeScript source files in the module. The package.json now declares _typings_ field that points to the single _.d.ts_ bundle. You can find more information about _typings_ field on [TypeScript Wiki](https://github.com/Microsoft/TypeScript/wiki/Typings-for-npm-packages).
54
+
- Less global dependencies. `typescript` and `tslint` are now installed as local dev dependencies allowing you to freely use different versions of these for different modules.
55
+
- Addition of _gulp watch_ task that watches ts source files and runs build on change.
75
56
76
-
```ts
77
-
/// <reference path="../typings/tsd.d.ts" />
78
-
/// <reference path="../typings/app.d.ts" />
79
-
80
-
importGreeter=require('./greeter');
81
-
82
-
const greeter =newGreeter('friend');
83
-
greeter.greet();
84
-
85
-
```
57
+
## Additional notes
58
+
- I provide nice integration with [VS Code editor](https://code.visualstudio.com/). I configure the `gulp build` task as the default VS Code build task.
gulp.task('_build','INTERNAL TASK - Compiles all TypeScript source files',function(cb){
49
-
exec('tsc',function(err,stdout,stderr){
48
+
exec('tsc --version',function(err,stdout,stderr){
49
+
console.log('TypeScript ',stdout);
50
+
if(stderr){
51
+
console.log(stderr);
52
+
}
53
+
});
54
+
55
+
returnexec('tsc',function(err,stdout,stderr){
50
56
console.log(stdout);
51
-
console.log(stderr);
57
+
if(stderr){
58
+
console.log(stderr);
59
+
}
52
60
cb(err);
53
61
});
54
62
});
55
63
56
-
//run tslint task, then run _tsconfig_files and _gen_tsrefs in parallel, then run _build
57
-
gulp.task('build','Compiles all TypeScript source files and updates module references',gulpSequence('tslint',['tsconfig_files','gen_tsrefs'],'_build'));
64
+
//run tslint task, then run update-tsconfig and gen-def in parallel, then run _build
65
+
gulp.task('build','Compiles all TypeScript source files and updates module references',gulpSequence('tslint',['update-tsconfig','gen-def'],'_build'));
58
66
59
67
gulp.task('test','Runs the Jasmine test specs',['build'],function(){
60
68
returngulp.src('test/*.js')
61
69
.pipe(jasmine());
62
70
});
71
+
72
+
gulp.task('watch','Watches ts source files and runs build on change',function(){
0 commit comments