Skip to content

Commit

Permalink
debug: parse template filename
Browse files Browse the repository at this point in the history
  • Loading branch information
ramilexe committed Aug 16, 2022
1 parent 69ba111 commit c295d1f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 32 deletions.
74 changes: 43 additions & 31 deletions packages/schema/bind/src/bindings/golang/wasm-go/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const generateBinding: GenerateBindingFn = (
for (const objectType of abi.objectTypes) {
output.entries.push({
type: "Directory",
name: objectType.type,
name: "abc",
data: renderTemplates(
templatePath("object-type"),
objectType,
Expand All @@ -43,6 +43,18 @@ export const generateBinding: GenerateBindingFn = (
});
}

// if (abi.moduleType) {
// output.entries.push({
// type: "Directory",
// name: "types",
// data: renderTemplates(
// templatePath("types"),
// abi.moduleType,
// subTemplates
// ),
// });
// }

// Generate imported folder
const importEntries: OutputEntry[] = [];

Expand Down Expand Up @@ -123,38 +135,38 @@ export const generateBinding: GenerateBindingFn = (
// }
//
// Generate module type folders
if (abi.moduleType) {
output.entries.push({
type: "Directory",
name: abi.moduleType.type,
data: renderTemplates(
templatePath("module-type"),
abi.moduleType,
subTemplates
),
});
}

// Generate enum type folders
for (const enumType of abi.enumTypes) {
output.entries.push({
type: "Directory",
name: enumType.type,
data: renderTemplates(templatePath("enum-type"), enumType, subTemplates),
});
}

// Generate env type folders
if (abi.envType) {
output.entries.push({
type: "Directory",
name: abi.envType.type,
data: renderTemplates(templatePath("object-type"), abi.envType, subTemplates),
});
}
// if (abi.moduleType) {
// output.entries.push({
// type: "Directory",
// name: abi.moduleType.type,
// data: renderTemplates(
// templatePath("module-type"),
// abi.moduleType,
// subTemplates
// ),
// });
// }
//
// // Generate enum type folders
// for (const enumType of abi.enumTypes) {
// output.entries.push({
// type: "Directory",
// name: enumType.type,
// data: renderTemplates(templatePath("enum-type"), enumType, subTemplates),
// });
// }
//
// // Generate env type folders
// if (abi.envType) {
// output.entries.push({
// type: "Directory",
// name: abi.envType.type,
// data: renderTemplates(templatePath("object-type"), abi.envType, subTemplates),
// });
// }

// Generate root entry file
output.entries.push(...renderTemplates(templatePath(""), abi, subTemplates));
// output.entries.push(...renderTemplates(templatePath(""), abi, subTemplates));

return result;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/schema/bind/src/bindings/utils/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function renderTemplates(
if (data) {
output.push({
type: "File",
name: name.replace("-", "."),
name: name.replace("-", ".").replace("%type%", (view as {type: string}).type.toLowerCase()),
data,
});
}
Expand Down

0 comments on commit c295d1f

Please sign in to comment.