Git Product home page Git Product logo

erdia's People

Contributors

imjuni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

erdia's Issues

Does not support async datasource

typeorm/typeorm#8914
TypeORM has supported async datasource now, but erdia doesn't.

 ERROR  Given data source file must contain export of a DataSource instance                                
 ERROR  Error: Given data source file must contain export of a DataSource instance            

missing ) after argument list

I ran this command
ts-node -r tsconfig-paths/register ./node_modules/.bin/erdia er -d ...
And it gave me an error like this.

My env

  • windows 11
  • node 16.17.0
  • npm 8.15.0
  • typescript 4.7.2

image

Index Exception on running the build command

I'm getting an error while running the npx erdia build command.
Screenshot 2024-01-18 at 3 38 49โ€ฏPM

I've setup "data-source-path": "dist/database/data-source.js" in .erdiarc.

I'm not sure why it's referring to src/ts files in the error log instead of dist/js files. Kindly guide me how to fix it

ENOENT: no such file or directory error occurs when package name contains slash

When package name contains slash, svg file cannot be generated.

// package.json

{
  "name": "@bbddmm/api",
> npx ts-node --project ./tsconfig.json -r tsconfig-paths/register ../node_modules/.bin/erdia build -d ./database/dataSource.ts -o ./erd --format html

 ERROR  ENOENT: no such file or directory, open '/home/bbddmm/api/erd/@bbddmm/api.svg'       2:16:02 PM

Templating not working

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.

{
  // directory for output files
  "output": "docusaurus/src/pages",

  // typeorm dataSourcePath
  "data-source-path": "src/config/data-source-erd.ts",

  // type of generated document
  "components": ["table", "er"],

  // kind of document name
  // - db: database name from TypeORM
  // - app: application name from package.json
  "project-name": "db",

  // custom template file path. erdia are using [ETA](https://eta.js.org/) template engine
  "template-path": "template",

  // erdia entity database file path
  "database-path": "src/entity",

  // erdia entity database file path
  // "route-base-path": "",

  // document version using package.json version or timestamp
  "version-from": "package.json",

  // If the versionFrom option set file, read the file from this path
  "version-path": "undefined",

  // output format of generated documents
  // - html
  // - markdown
  // - pdf
  // - image
  "format": "md",

  // skip image file attachment in html document
  "skipImageInHtml": false,

  // mermaid.js plugin theme configuration
  // @url https://mermaid-js.github.io/mermaid/#/Setup?id=theme
  "theme": "dark"

  // prettier config path
  "prettier-config": ".prettierrc",

  // title tag content that inside of html document
  // "title": "set title tag content in html document",

  // ER diagram width, it will be set width css attribute
  // @format pdf, image
  // "width": "100%",

  // puppeteer viewport width
  // @format pdf, image
  // "viewport-width": 1280,

  // puppeteer viewport height
  // @format pdf, image
  // "viewport-height":  1440,

  // puppeteer config file path
  // @format pdf, image
  // "puppeteer-config-path": "set your puppeteer configuration file path",

  // Background color. Example: transparent, red, '#F0F0F0'. Optional. Default: white
  // @format pdf, image
  // "background-color": "#FFFFFF",

  // ER diagram export image file format
  // @format image
  // "image-format": "svg",
}
...
"scripts": {
    "erdia": "TS_NODE_PROJECT='./tsconfig.json' ts-node -r tsconfig-paths/register ./node_modules/.bin/erdia build -c .erdiarc",
...

Any ideas?

The type 'double precision' generates mermaid code with invalid syntax.

Hello,

I have an entity that includes a double precision type.

@Entity()
export class SomeEntity {
  @PrimaryGeneratedColumn('uuid', { comment: 'ID' })
  readonly id!: string;

  @Column({ type: 'double precision', comment: 'Latitude' })
  lat!: number;

  @Column({ type: 'double precision', comment: 'Longitude'  })
  lon!: number;
}

Erdia generates mermaid source code as follows.

"some_entities(SomeEntity)" {
  uuid id    PK      "ID"  
  double precision lat      "Latitude"  
  double precision lon      "Longitude"  

This code syntax is invalid because mermaid does not support the double precision type.

Inclusion of ViewEntities causes build error

Using version 3.7.0

Repro steps

  1. Add a view entity, include in entities TypeORM datasource config, e.g.
// View entity
@ViewEntity({
  name: "MyView",
  expression: `...query builder or sql expression`
})
export class MyViewEntity {
  @ViewColumn()
  column: string
  
  ...
}

// Datasource config
const appDataSource = new DataSource({
  entities: [...entities, MyViewEntity],
  ...otherConfig,
});

export default appDataSource;
  1. Run CLI build
  2. Build errors Cannot read properties of undefined (reading 'toString') - as below
    image

It may be far too complicated to construct an ERD based on the expression config key. Potentially the default behaviour should be to filter out Views based on the tableType property on entityMetadata?

This library is so handy otherwise!! Thank you for maintaining ๐Ÿ™

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.