Add npm test for TSLint
This commit is contained in:
parent
25a077b495
commit
756e5c00f4
@ -30,6 +30,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublish": "npm run tsd && node ts",
|
"prepublish": "npm run tsd && node ts",
|
||||||
|
"test": "node ts --only-test",
|
||||||
"tsd": "./node_modules/.bin/tsd reinstall --overwrite"
|
"tsd": "./node_modules/.bin/tsd reinstall --overwrite"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
3
ts.js
3
ts.js
@ -2,6 +2,7 @@
|
|||||||
var childProcess = require('child_process');
|
var childProcess = require('child_process');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
var isTest = process.argv[2] === '--only-test';
|
||||||
|
|
||||||
read(function(err, fileNames) {
|
read(function(err, fileNames) {
|
||||||
clean(fileNames, function() {
|
clean(fileNames, function() {
|
||||||
@ -27,6 +28,7 @@ read(function(err, fileNames) {
|
|||||||
* @param {function()} done
|
* @param {function()} done
|
||||||
*/
|
*/
|
||||||
function clean(filePaths, done) {
|
function clean(filePaths, done) {
|
||||||
|
if (isTest) return done();
|
||||||
var i = -1;
|
var i = -1;
|
||||||
(function next() {
|
(function next() {
|
||||||
i += 1;
|
i += 1;
|
||||||
@ -46,6 +48,7 @@ function clean(filePaths, done) {
|
|||||||
* @param {function(Error)} done
|
* @param {function(Error)} done
|
||||||
*/
|
*/
|
||||||
function compile(filePaths, done) {
|
function compile(filePaths, done) {
|
||||||
|
if (isTest) return done(null);
|
||||||
var execPath = path.join(__dirname, 'node_modules/.bin/tsc');
|
var execPath = path.join(__dirname, 'node_modules/.bin/tsc');
|
||||||
var options = '--declaration --module CommonJS --noImplicitAny --outDir dist';
|
var options = '--declaration --module CommonJS --noImplicitAny --outDir dist';
|
||||||
childProcess.exec([execPath, options].concat(filePaths).join(' '), function(err, stdout) {
|
childProcess.exec([execPath, options].concat(filePaths).join(' '), function(err, stdout) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user