Skip to content

Commit

Permalink
More fully working links/related counts, but
Browse files Browse the repository at this point in the history
The primary key field is guessed (as the first field)
and multi-part primary keys are not yet supported
Rename "types" in templates, to entity
  • Loading branch information
tjme committed May 4, 2021
1 parent 3539b71 commit 5a5464a
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 64 deletions.
4 changes: 2 additions & 2 deletions dist/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ function generate(templateDir, targetDir, schemaInPath, overlayInPath, defaultMe
else {
const templateContent = "`" + fs.readFileSync(templateDir + "/" + targetName) + "`";
if (targetName.includes("types")) {
types.map((types) => {
fs.writeFileSync(targetDir + "/" + targetName.replace("types", types.name).toLowerCase(), eval(templateContent));
types.map((entity) => {
fs.writeFileSync(targetDir + "/" + targetName.replace("types", entity.name).toLowerCase(), eval(templateContent));
});
}
else
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opinionate",
"version": "0.4.4",
"version": "0.4.5",
"description": "Automated full stack application code generator",
"license": "MIT",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ export function generate(templateDir: string, targetDir: string, schemaInPath: s
} else {
const templateContent = "`" + fs.readFileSync(templateDir + "/" + targetName) + "`";
if (targetName.includes("types")) {
types.map((types: any) => {
fs.writeFileSync(targetDir + "/" + targetName.replace("types", types.name).toLowerCase(), eval(templateContent));
types.map((entity: any) => {
fs.writeFileSync(targetDir + "/" + targetName.replace("types", entity.name).toLowerCase(), eval(templateContent));
})
} else fs.writeFileSync(targetDir + "/" + targetName, eval(templateContent));
}
Expand Down
8 changes: 4 additions & 4 deletions templates/primevue/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<Toast position="top-right" />
<Menubar class="op-compact" :model="[
{icon: 'pi pi-align-left', label: 'Entities', items:[
${types.filter(t => !t.meta.menu || t.meta.menu=="Entities").map(types => `\
{icon: 'pi pi-table', label: '${types.meta.label}', to: '/${types.name.toLowerCase()}'}`).join(',\n')} ] },
${types.filter(t => !t.meta.menu || t.meta.menu=="Entities").map(entity => `\
{icon: 'pi pi-table', label: '${entity.meta.label}', to: '/${entity.name.toLowerCase()}'}`).join(',\n')} ] },
{icon: 'pi pi-align-left', label: 'Admin', items:[
${types.filter(t => t.meta.menu && t.meta.menu=="Admin").map(types => `\
{icon: 'pi pi-table', label: '${types.meta.label}', to: '/${types.name.toLowerCase()}'}`).join(',\n')} ] }
${types.filter(t => t.meta.menu && t.meta.menu=="Admin").map(entity => `\
{icon: 'pi pi-table', label: '${entity.meta.label}', to: '/${entity.name.toLowerCase()}'}`).join(',\n')} ] }
]" />
<router-view></router-view>
</template>
Expand Down
Loading

0 comments on commit 5a5464a

Please sign in to comment.