-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #365 from liam-hq/add_erd_web
feat: Add erd-web package
- Loading branch information
Showing
17 changed files
with
611 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@liam-hq/erd-core": patch | ||
"@liam-hq/cli": patch | ||
--- | ||
|
||
⚒️ Fixing CSS Modules error with toolbar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/versions | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# env files (can opt-in for committing if needed) | ||
.env* | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use client' | ||
|
||
import type { DBStructure } from '@liam-hq/db-structure' | ||
import { | ||
CliVersionProvider, | ||
ERDRenderer, | ||
cliVersionSchema, | ||
initDBStructureStore, | ||
} from '@liam-hq/erd-core' | ||
import { useEffect } from 'react' | ||
import * as v from 'valibot' | ||
|
||
type ERDViewerProps = { | ||
dbStructure: DBStructure | ||
} | ||
|
||
export default function ERDViewer({ dbStructure }: ERDViewerProps) { | ||
useEffect(() => { | ||
initDBStructureStore(dbStructure) | ||
}, [dbStructure]) | ||
|
||
// TODO: Implement version data | ||
const cliVersionData = { | ||
version: '0.0.0', | ||
gitHash: '0000000', | ||
envName: 'development', | ||
isReleasedGitHash: false, | ||
date: '2021-01-01T00:00:00Z', | ||
} | ||
const cliVersion = v.parse(cliVersionSchema, cliVersionData) | ||
|
||
return ( | ||
<div style={{ height: '100vh' }}> | ||
<CliVersionProvider cliVersion={cliVersion}> | ||
<ERDRenderer /> | ||
</CliVersionProvider> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { parse } from '@liam-hq/db-structure/parser' | ||
import { notFound } from 'next/navigation' | ||
import ERDViewer from './erdViewer' | ||
|
||
export default async function Page({ | ||
params, | ||
}: { | ||
params: Promise<{ slug: string[] }> | ||
}) { | ||
const { slug } = await params | ||
const joinedPath = slug.join('/') | ||
if (!joinedPath) { | ||
notFound() | ||
} | ||
|
||
const contentUrl = `https://${joinedPath}` | ||
|
||
const res = await fetch(contentUrl, { cache: 'no-store' }) | ||
if (!res.ok) { | ||
notFound() | ||
} | ||
|
||
const input = await res.text() | ||
|
||
// Currently supports Postgres only | ||
const { value: dbStructure, errors } = await parse(input, 'postgres') | ||
if (errors.length > 0) { | ||
for (const error of errors) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
return <ERDViewer dbStructure={dbStructure} /> | ||
} |
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import type { Metadata } from 'next' | ||
import { Geist, Geist_Mono } from 'next/font/google' | ||
import type React from 'react' | ||
import './globals.css' | ||
|
||
const geistSans = Geist({ | ||
variable: '--font-geist-sans', | ||
subsets: ['latin'], | ||
}) | ||
|
||
const geistMono = Geist_Mono({ | ||
variable: '--font-geist-mono', | ||
subsets: ['latin'], | ||
}) | ||
|
||
export const metadata: Metadata = { | ||
title: 'Create Next App', | ||
description: 'Generated by create next app', | ||
} | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode | ||
}>) { | ||
return ( | ||
<html lang="en"> | ||
<body | ||
className={`${geistSans.variable} ${geistMono.variable} antialiased`} | ||
> | ||
{children} | ||
</body> | ||
</html> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": ["../../packages/configs/biome.jsonc"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import type { NextConfig } from 'next' | ||
|
||
const nextConfig: NextConfig = { | ||
/* config options here */ | ||
} | ||
|
||
export default nextConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "@liam-hq/erd-web", | ||
"private": true, | ||
"version": "0.1.0", | ||
"dependencies": { | ||
"next": "15.1.2", | ||
"react": "18.3.1", | ||
"react-dom": "18", | ||
"valibot": "^1.0.0-beta.5" | ||
}, | ||
"devDependencies": { | ||
"@biomejs/biome": "1.9.3", | ||
"@liam-hq/db-structure": "workspace:*", | ||
"@liam-hq/erd-core": "workspace:*", | ||
"@types/node": "22.9.0", | ||
"@types/react": "18", | ||
"@types/react-dom": "18", | ||
"typescript": "5" | ||
}, | ||
"scripts": { | ||
"build": "next build", | ||
"dev": "next dev --turbopack", | ||
"fmt": "pnpm run '/^fmt:.*/'", | ||
"fmt:biome": "biome check --write --unsafe .", | ||
"lint": "pnpm run '/^lint:.*/'", | ||
"lint:biome": "biome check .", | ||
"start": "next start" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2017", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"moduleResolution": "bundler", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"jsx": "preserve", | ||
"incremental": true, | ||
"plugins": [ | ||
{ | ||
"name": "next" | ||
} | ||
], | ||
"paths": { | ||
"@/*": ["./*", "../../packages/erd-core/src/*"] | ||
} | ||
}, | ||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], | ||
"exclude": ["node_modules"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
@import url('@liam-hq/ui/src/styles/globals.css'); | ||
@import './variables.css'; | ||
|
||
/* https://github.com/radix-ui/primitives/issues/2908 */ | ||
[data-radix-popper-content-wrapper] { | ||
font-family: var(--main-font); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.