Skip to content
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

Added emitDecoratorMetadata option #15

Merged
merged 3 commits into from
Jul 31, 2015
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,14 @@ By default, gulp-tsc ignores warnings from tsc command and emits compiled js fil

If set this option to true, gulp-tsc never emits compiled files when tsc command returned warnings or errors.

#### options.emitDecoratorMetadata
Type: `Boolean`
Default: `false`

`--emitDecoratorMetadata` option for `tsc` command.

Emit decorator metadata.

## Error handling

If gulp-tsc fails to compile files, it emits `error` event with `gutil.PluginError` as the manner of gulp plugins.
Expand Down
4 changes: 3 additions & 1 deletion lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ function Compiler(sourceFiles, options) {
noLib: false,
keepTree: true,
pathFilter: null,
safe: false
safe: false,
emitDecoratorMetadata: false,
}, options);
this.options.sourceMap = this.options.sourceMap || this.options.sourcemap;
delete this.options.sourcemap;
Expand Down Expand Up @@ -78,6 +79,7 @@ Compiler.prototype.buildTscArguments = function (version) {
if (this.options.removeComments) args.push('--removeComments');
if (this.options.sourceMap) args.push('--sourcemap');
if (this.options.noLib) args.push('--noLib');
if (this.options.emitDecoratorMetadata) args.push('--emitDecoratorMetadata');

if (this.tempDestination) {
args.push('--outDir', this.tempDestination);
Expand Down
13 changes: 5 additions & 8 deletions test-e2e/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ var abort = function (err) { throw err; };
var ignore = function (err) { };
var currentVersion = 'INVALID';

var isVersion150 = function (version) {
var result = version === '1.5.0-alpha'
|| version === '1.5.0-beta'
|| version === '1.5.0';
return result;
var isVersionGte150 = function (version) {
return version.indexOf('1.5.') === 0;
}

gulp.task('default', ['version', 'all']);
Expand Down Expand Up @@ -94,7 +91,7 @@ gulp.task('test5', ['clean'], function () {
return gulp.src('src-broken/error.ts')
.pipe(typescript()).on('error', ignore)
.pipe(gulp.dest('build/test5'))
.pipe(!isVersion150(currentVersion)
.pipe(!isVersionGte150(currentVersion)
? expect([]) : expect(['build/test5/error.js'])
);
});
Expand Down Expand Up @@ -204,7 +201,7 @@ gulp.task('test15', ['clean'], function () {
return gulp.src('src-broken/error.ts')
.pipe(typescript({ emitError: false }))
.pipe(gulp.dest('build/test15'))
.pipe(!isVersion150(currentVersion)
.pipe(!isVersionGte150(currentVersion)
? expect([]) : expect(['build/test15/error.js'])
);
});
Expand Down Expand Up @@ -247,7 +244,7 @@ gulp.task('test17', ['clean'], function () {
.pipe(gulp.dest('build/test17/s2'));

return es.merge(one, two)
.pipe(!isVersion150(currentVersion)
.pipe(!isVersionGte150(currentVersion)
? expect(['build/test17/s2/b.js'])
: expect(['build/test17/s1/error.js', 'build/test17/s2/b.js'])
)
Expand Down