implement onSetup hook in BuildScript for environment setup

This commit is contained in:
codetypes committed 2025-03-24 13:03:42 +08:00
1 parent 25ed8ecd56
commit ceef9db425
5 files changed
+115 -75

No files matched your search

+32 -30
View File
@@ -1,38 +1,40 @@
/* 批处理脚本 */
/*
如果有processTree,则先运行prcessTree,如果有返回,则进行后面的针对每个节点运行processNode
如果没有定义processTree,则直接针对每个节点运行processNode
如果有processTree,则先运行prcessTree,如果有返回,则进行后面的针对每个节点运行processNode
如果没有定义processTree,则直接针对每个节点运行processNode
export interface TreeModel {
version: string;
name: string;
desc?: string;
export?: boolean;
firstid: number;
group: string[];
import: string[];
declvar: VarDef[];
root: NodeModel;
}
export interface TreeModel {
version: string;
name: string;
desc?: string;
export?: boolean;
firstid: number;
group: string[];
import: string[];
declvar: VarDef[];
root: NodeModel;
}
export interface NodeModel {
id: number;
name: string;
desc?: string;
args?: { [key: string]: any };
input?: string[];
output?: string[];
children?: NodeModel[];
debug?: boolean;
disabled?: boolean;
path?: string;
}
export interface NodeModel {
id: number;
name: string;
desc?: string;
args?: { [key: string]: any };
input?: string[];
output?: string[];
children?: NodeModel[];
debug?: boolean;
disabled?: boolean;
path?: string;
}
interface BatchScript {
processTree?(tree: TreeModel, path: string): TreeModel;
processNode?(node: NodeModel, tree: TreeModel): NodeModel;
}
interface BatchScript {
onSetup?(env: Env): void;
processTree?(tree: TreeModel, path: string): TreeModel | null;
processNode?(node: NodeModel, tree: TreeModel): NodeModel | null;
onWriteFile?(path: string, tree: TreeModel): void;
onComplete?(status: "success" | "failure"): void;
}
*/
({
processTree: (tree) => {