feat: add task module
test / test (push) Successful in 1m10s

This commit is contained in:
2026-11-10 15:30:34 +03:00
parent 19d475b182
commit 6fd8988251
33 changed files with 241 additions and 219 deletions
+29
View File
@@ -0,0 +1,29 @@
import { branch, compile } from "../core/config";
import type { Config } from "../core/type";
import type { TaskBundle, TaskCompilerType } from "./core";
import { CleanTaskCompiler } from "./impl/clean";
import { FormatTaskCompiler } from "./impl/format";
import { ProjectTaskCompiler } from "./impl/project";
import { ProtoTaskCompiler } from "./impl/proto";
import { SetupTaskCompiler } from "./impl/setup";
const COMPILERS: TaskCompilerType[] = [FormatTaskCompiler, CleanTaskCompiler, SetupTaskCompiler, ProtoTaskCompiler];
const PROJECT_COMPILERS: TaskCompilerType[] = [ProjectTaskCompiler];
export default (projects: Config[]): TaskBundle => {
const bundle: TaskBundle = {};
const config = projects.reduce((config, project) => branch(config, project), compile({}));
for (const compiler of COMPILERS) {
for (const [name, task] of Object.entries(new compiler(config).compile())) {
bundle[name] = task;
}
}
for (const compiler of PROJECT_COMPILERS) {
for (const project of projects) {
for (const [name, task] of Object.entries(new compiler(project).compile())) {
bundle[name] = task;
}
}
}
return bundle;
};