Comparing version 0.2.6 to 0.3.6
@@ -12,6 +12,7 @@ module.exports = function (grunt) { | ||
normal:{ | ||
src:["test/fail.ts","test/work.ts"] | ||
src:["test/work/**/*.ts"], | ||
verbose: true | ||
}, | ||
long:{ | ||
src:["test/fail.ts","test/work.ts"], | ||
fail:{ | ||
src:["test/fail/*.ts"], | ||
verbose: true | ||
@@ -18,0 +19,0 @@ } |
{ | ||
"author": "basarat", | ||
"name": "grunt-ts", | ||
"description": "compile typescript to javascript using computer installed typescript", | ||
"version": "0.2.6", | ||
"description": "compile typescript files to javascript using tsc command", | ||
"version": "0.3.6", | ||
"homepage": "https://github.com/basarat/grunt-ts", | ||
@@ -7,0 +7,0 @@ "repository": { |
@@ -20,3 +20,4 @@ module.exports = function (grunt) { | ||
function compileFile(filepath, options) { | ||
function compileAllFiles(filepaths, options) { | ||
var filepath = filepaths.join(' '); | ||
var cmd = 'node ' + tsc + ' ' + filepath; | ||
@@ -46,17 +47,12 @@ var result = exec(cmd); | ||
files.forEach(function (file) { | ||
if (f.verbose) { | ||
console.log('Compiling: ' + file.yellow); | ||
} | ||
var result = compileFile(file, f); | ||
if (result.code != 0) { | ||
var msg = "Failed to compile file: " + file; | ||
console.log(msg.red); | ||
success = false; | ||
} | ||
}); | ||
var result = compileAllFiles(files, f); | ||
if (result.code != 0) { | ||
var msg = "Compilation failed:"; | ||
console.log(msg.red); | ||
success = false; | ||
} | ||
}); | ||
return true; | ||
return success; | ||
}); | ||
}; |
@@ -27,3 +27,3 @@ /* | ||
interface IOptions{ | ||
interface IOptions { | ||
target: string; // es3 , es5 | ||
@@ -36,2 +36,3 @@ module: string; // amd, commonjs | ||
dest: string; | ||
single: boolean; // use a single command for compilation | ||
} | ||
@@ -64,17 +65,17 @@ | ||
function compileFile(filepath: string, options: IOptions): ICompileResult{ | ||
function compileAllFiles(filepaths: string[], options: IOptions): ICompileResult { | ||
// TODO: use options | ||
var filepath: string = filepaths.join(' '); | ||
var cmd = 'node ' + tsc + ' ' + filepath; | ||
var result = exec(cmd); | ||
return result; | ||
} | ||
} | ||
var exec = shell.exec; | ||
var currentPath = path.resolve("."); | ||
var tsc = getTsc(resolveTypeScriptBinPath(currentPath, 0)); | ||
grunt.registerMultiTask('ts', 'Compile TypeScript files', function () { | ||
// Was the whole process successful | ||
var success = true; | ||
var success = true; | ||
@@ -96,15 +97,9 @@ var that = this; | ||
files.forEach(function (file) { | ||
//console.log(f); | ||
if (f.verbose) { | ||
console.log('Compiling: ' + file.yellow); | ||
} | ||
var result = compileFile(file, f); | ||
if (result.code != 0) { | ||
var msg = "Failed to compile file: " + file; | ||
console.log(msg.red); | ||
success = false; | ||
} | ||
}); | ||
var result = compileAllFiles(files, f); | ||
if (result.code != 0) { | ||
var msg = "Compilation failed:"; | ||
console.log(msg.red); | ||
success = false; | ||
} | ||
}); | ||
@@ -114,4 +109,4 @@ | ||
// return true so that your watch continues and does not fail: | ||
return true; | ||
return success; | ||
}); | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9951
17
224