Commit b0237c6b by Torkel Ödegaard Committed by GitHub

Precommit: Fixed precommit task issue (#18883)

parent cb4d30f8
......@@ -11,15 +11,6 @@ const simpleGit = require('simple-git/promise')(process.cwd());
interface PrecommitOptions {}
const tasks = {
test: {
lint: {
ts: ['no-only-tests'],
go: ['no-focus-convey-tests'],
},
},
};
interface GitStatus {
files: GitFile[];
}
......@@ -40,27 +31,26 @@ const precommitRunner: TaskRunner<PrecommitOptions> = async () => {
.filter(file => nodeVersionFiles.indexOf(file.path) !== -1)
.map(f => f.path);
const taskPaths = [];
const gruntTasks = [];
if (affectedNodeVersionFiles.length > 0) {
await execTask(nodeVersionCheckerTask)({});
}
if (sassFiles.length > 0) {
taskPaths.push('lint.sass');
gruntTasks.push('sasslint');
}
if (testFiles.length) {
taskPaths.push('test.lint.ts');
gruntTasks.push('no-only-tests');
}
if (goTestFiles.length) {
taskPaths.push('test.lint.go');
gruntTasks.push('no-focus-convey-tests');
}
const gruntTasks = flatten(taskPaths.map(path => get(tasks, path)));
if (gruntTasks.length > 0) {
console.log(chalk.yellow(`Precommit checks: ${taskPaths.join(', ')}`));
console.log(chalk.yellow(`Precommit checks: ${gruntTasks.join(', ')}`));
const task = execa('grunt', gruntTasks);
// @ts-ignore
const stream = task.stdout;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment