just-scripts
Version:
Just Stack Scripts
35 lines • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.tslintTask = void 0;
const just_task_1 = require("just-task");
const utils_1 = require("../utils");
const path = require("path");
const fs = require("fs");
function tslintTask(options = {}) {
const projectFile = options.project || (0, just_task_1.resolveCwd)('./tsconfig.json');
return function tslint() {
const tslintCmd = (0, just_task_1.resolve)('tslint/lib/tslintCli.js');
if (projectFile && tslintCmd && fs.existsSync(projectFile)) {
just_task_1.logger.info(`Running tslint`);
const args = [
'--project',
projectFile,
'-t',
'stylish',
'-r',
path.dirname((0, just_task_1.resolve)('tslint-microsoft-contrib') || ''),
];
if (options.fix) {
args.push('--fix');
}
const cmd = (0, utils_1.encodeArgs)([process.execPath, tslintCmd, ...args]).join(' ');
just_task_1.logger.info(cmd);
return (0, utils_1.exec)(cmd, { stdout: process.stdout, stderr: process.stderr });
}
else {
return Promise.resolve();
}
};
}
exports.tslintTask = tslintTask;
//# sourceMappingURL=tslintTask.js.map