imjuni / erdia Goto Github PK
View Code? Open in Web Editor NEWCLI to generate mermaid.js ER diagram using TypeORM entity
Home Page: https://imjuni.github.io/erdia/
License: MIT License
CLI to generate mermaid.js ER diagram using TypeORM entity
Home Page: https://imjuni.github.io/erdia/
License: MIT License
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
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
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?
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.
Using version 3.7.0
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;
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 ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.