feat: generateTemplate fun support context

This commit is contained in:
liangzr 2023-07-20 10:36:10 +08:00 committed by LeoYuan 袁力皓
parent 02a3361f41
commit e875e33dc5
2 changed files with 4 additions and 3 deletions

View File

@ -111,8 +111,6 @@ export class ProjectBuilder implements IProjectBuilder {
// Init // Init
const { schemaParser } = this; const { schemaParser } = this;
const projectRoot = await this.template.generateTemplate();
let schema: IPublicTypeProjectSchema = let schema: IPublicTypeProjectSchema =
typeof originalSchema === 'string' ? JSON.parse(originalSchema) : originalSchema; typeof originalSchema === 'string' ? JSON.parse(originalSchema) : originalSchema;
@ -131,6 +129,9 @@ export class ProjectBuilder implements IProjectBuilder {
// Collect Deps // Collect Deps
// Parse JSExpression // Parse JSExpression
const parseResult: IParseResult = schemaParser.parse(schema); const parseResult: IParseResult = schemaParser.parse(schema);
const projectRoot = await this.template.generateTemplate(parseResult);
let buildResult: IModuleInfo[] = []; let buildResult: IModuleInfo[] = [];
const builders = this.createModuleBuilders({ const builders = this.createModuleBuilders({

View File

@ -127,7 +127,7 @@ export interface ISchemaParser {
export interface IProjectTemplate { export interface IProjectTemplate {
slots: Record<string, IProjectSlot>; slots: Record<string, IProjectSlot>;
generateTemplate: () => ResultDir | Promise<ResultDir>; generateTemplate: (data: IParseResult) => ResultDir | Promise<ResultDir>;
} }
export interface IProjectSlot { export interface IProjectSlot {