Closed markim closed 5 months ago
@markim Thanks for the feedback, could you please provide a reproducible repo?
No problem, here's the repo I was able to come up with. It uses the basic typeorm init script for an express server, then I added the erdia package.
https://github.com/markim/testerdiarepo
Special note to template/markdown/document.eta
and erdiaoutput/test.md
. Let me dive into your code real quick and see if anything pops out... It looks like it's just not loading the templates, always using the one found in (i'm guessing node_modules/erdia
? Thanks for your time.
@markim Thanks for your participation. I've been looking at the code, and it looks like the problem is in the management of the template while bundling with esbuild. I'm working on fixing the bug, but it's taking some time due to issues related to improving the development environment, updating dependent library versions, etc. I'll let you know with a mention when it's done, thanks.
Oh great! I tried taking a look but I would need more time to debug it properly, but it sounds like you got it triaged pretty well. I definitely know how it goes with the Rube Goldberg of problems like that, haha! Thanks for the fast reply, excited to hear back.
@markim Hello
Thank you for your participant, I was fixed this problem 3.6.1
. Use 3.6.1
, Thank you :)
Hi @imjuni thank you for your work!
I am still having troubles, however. I updated to the new package, deleted the old templates, deleted the old .erdiarc file, then ran erdia init. Some things I noticed:
1.) .erdiarc now uses absolute paths instead of relative ones. This probably should be relative paths so we can share erdia configs in code repositories.
e.g.
// directory for output files
"output": "/Users/mark/code/testerdiarepo/erdiaoutput",
2.) The template path is the root folder by default instead of ./templates (if I remember right from 3.5.0). So it adds all the template folders markdown
html
etc to the root location of package.json.
3.) Here is the error I get when trying to generate from the test repo with the new changes
███████╗██████╗ ██████╗ ██╗ █████╗
██╔════╝██╔══██╗██╔══██╗██║██╔══██╗
█████╗ ██████╔╝██║ ██║██║███████║
██╔══╝ ██╔══██╗██║ ██║██║██╔══██║
███████╗██║ ██║██████╔╝██║██║ ██║
╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝ ╚═╝
ℹ connection initialize: "/Users/mark/code/testerdiarepo/src/data-source.ts" 9:27:29 AM
✔ connection initialized 9:27:29 AM
ℹ version: 0.0.1 9:27:29 AM
ℹ extract entities in test 9:27:29 AM
✔ complete extraction 9:27:29 AM
ℹ Database open and processing 9:27:29 AM
✔ Database open and processing completed 9:27:29 AM
ℹ output format: md 9:27:29 AM
ERROR template: markdown-document { versions: [ { version: '0.0.1', entities: [Array], latest: true } ], 9:27:29 AM
option:
{ _: [ 'build' ],
c: '.erdiarc',
config: '.erdiarc',
output: '/Users/mark/code/testerdiarepo/erdiaoutput',
o: '/Users/mark/code/testerdiarepo/erdiaoutput',
'data-source-path': '/Users/mark/code/testerdiarepo/src/data-source.ts',
d: '/Users/mark/code/testerdiarepo/src/data-source.ts',
dataSourcePath: '/Users/mark/code/testerdiarepo/src/data-source.ts',
components: [ 'table', 'er' ],
t: [ 'table', 'er' ],
'project-name': 'db',
projectName: 'db',
'template-path': '',
templatePath: '',
'database-path': '/Users/mark/code/testerdiarepo/src/entity',
databasePath: '/Users/mark/code/testerdiarepo/src/entity',
'version-from': 'package.json',
versionFrom: 'package.json',
format: 'md',
skipImageInHtml: false,
'skip-image-in-html': false,
theme: 'default',
'show-logo': false,
showLogo: false,
'version-path': undefined,
versionPath: undefined,
'route-base-path': undefined,
routeBasePath: undefined,
title: undefined,
'prettier-config': undefined,
prettierConfig: undefined,
width: '100%',
'viewport-width': 1280,
viewportWidth: 1280,
'viewport-height': 1440,
viewportHeight: 1440,
'image-format': 'svg',
imageFormat: 'svg',
'background-color': 'white',
backgroundColor: 'white',
'$0': 'node_modules/.bin/erdia' },
metadata:
{ name: 'test',
title: undefined,
version: '0.0.1',
createdAt: '2024-04-11T09:27:29-07:00',
updatedAt: '2024-04-11T09:27:29-07:00' } }
ERROR Cannot read properties of undefined (reading 'forEach') 9:27:29 AM
at Eta.eval (eval at compile (node_modules/eta/src/compile.ts:29:12), <anonymous>:17:13)
at Eta.call [as render] (node_modules/eta/src/render.ts:58:26)
at include (eval at compile (node_modules/eta/src/compile.ts:29:12), <anonymous>:4:40)
at eval (eval at compile (node_modules/eta/src/compile.ts:29:12), <anonymous>:25:12)
at Array.forEach (<anonymous>)
at Eta.eval (eval at compile (node_modules/eta/src/compile.ts:29:12), <anonymous>:17:49)
at Eta.render (node_modules/eta/src/render.ts:58:26)
at TemplateRenderer.evaluate (node_modules/erdia/src/templates/TemplateRenderer.ts:26:34)
at createMarkdown (node_modules/erdia/src/creators/createMarkdown.ts:18:38)
at building (node_modules/erdia/src/modules/commands/building.ts:136:30)
ERROR Cannot read properties of undefined (reading 'forEach') 9:27:29 AM
at Eta.eval (eval at compile (node_modules/eta/src/compile.ts:29:12), <anonymous>:17:13)
at Eta.call [as render] (node_modules/eta/src/render.ts:58:26)
at include (eval at compile (node_modules/eta/src/compile.ts:29:12), <anonymous>:4:40)
at eval (eval at compile (node_modules/eta/src/compile.ts:29:12), <anonymous>:25:12)
at Array.forEach (<anonymous>)
at Eta.eval (eval at compile (node_modules/eta/src/compile.ts:29:12), <anonymous>:17:49)
at Eta.render (node_modules/eta/src/render.ts:58:26)
at TemplateRenderer.evaluate (node_modules/erdia/src/templates/TemplateRenderer.ts:26:34)
at createMarkdown (node_modules/erdia/src/creators/createMarkdown.ts:18:38)
at building (node_modules/erdia/src/modules/commands/building.ts:136:30)
I commited this all to the test repo https://github.com/markim/testerdiarepo for debugging.
Thanks, let me know what you think. Looks like something is undefined and the templating engine is trying to iterate over it...
@markim Hi,
Thank you for participating. I fixed this issue in v3.7.0
, thank you.
@imjuni Thank you! I was out this weekend, but finally got a chance to test and it looks great.
Thanks again, have a great Summer.
Hi, first, thanks for the awesome package :)
I am having issues getting the templating working.
I have an .erdiarc config file
It points to "template" as the template location.
I ejected the template, so it has the markdown, html, image folders.
I select to generate markdown with the CLI. It makes the markdown file.
I try to update the template file "template/markdown/document.eta" and add "test" at the top. I regenerate the markdown file, but it doesn't have test at the top. It looks like the templates are being ignored.
Any ideas?