Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/toolbars/generate-code/src/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default {
default: () => ({})
}
},
setup() {
setup(props) {
const { isBlock, getCurrentPage } = useCanvas()
const { getCurrentBlock } = useBlock()

Expand Down Expand Up @@ -164,7 +164,9 @@ export default {
}
}

const res = await generateAppCode(appSchema)
const res = await (props.options?.generateAppCode
Copy link
Collaborator

@hexqi hexqi Sep 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const { getAllNestedBlocksSchema, generateAppCode } = getMetaApi('engine.service.generateCode')
generateAppCode是generateCode服务导出的方法,这里可以通过开发一个新的出码的MetaService,实现新的generateCode来实现,应该不需要这个配置也可以做到

? props.options.generateAppCode(appSchema)
: generateAppCode(appSchema))

const { genResult = [] } = res || {}
const fileRes = genResult.map(({ fileContent, fileName, path, fileType }) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/fs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export const writeFile = async (handle: any, { filePath, fileContent }) => {
}

const writable = await fileHandle.createWritable()
await writable.write(fileContent)
await writable.write({ type: 'write', data: fileContent })
await writable.close()
}

Expand Down