feat: add stage condition checks

This commit is contained in:
wancat committed 2024-03-08 00:47:50 +08:00
1 parent 77fe2d37b3
commit 5bea2ea78c
3 files changed
+60 -13

No files matched your search

+6 -3
View File
@@ -1,4 +1,4 @@
import { IStage, ICommand } from './types'
import { IStage, ICommand, IFileExistenceChecker } from './types'
import { Condition } from './condition/Condition'
export class Stage {
@@ -12,7 +12,10 @@ export class Stage {
this.condition = new Condition(condition)
}
satisfies(command: ICommand): boolean {
return this.condition.match(command)
async satisfies(
command: ICommand,
checker: IFileExistenceChecker
): Promise<boolean> {
return this.condition.match(command) && this.condition.check(checker)
}
}