@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user