Skip to content

[WIP] Drizzle Run next #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 61 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
07797e1
Fix [BUG]: Nextjs 15 can't find the index.mjs #41
rphlmr Dec 8, 2024
1f47d87
bump
rphlmr Jan 7, 2025
3522405
upgrade versions
rphlmr Jan 19, 2025
b88e2f2
make drizzle-visualizer sharable
rphlmr Jan 25, 2025
97acf95
wip prefixing tw
rphlmr Jan 25, 2025
f4691b2
up
rphlmr Jan 25, 2025
280fc34
it becomes a mess....
rphlmr Jan 29, 2025
242c982
remove tw prefix
rphlmr Feb 9, 2025
5f7f9a1
wip
rphlmr Feb 10, 2025
6750cfc
tw 4 wip refactor
rphlmr Feb 14, 2025
4418055
handle light mode
rphlmr Mar 14, 2025
33762bd
wip removing turbo
rphlmr Mar 14, 2025
cd767d9
test pipeline
rphlmr Mar 14, 2025
2f30d2d
Merge branch 'main' into drizzle-run-next
rphlmr Mar 14, 2025
199f49e
doc
rphlmr Mar 14, 2025
ebb918f
wip pipeline
rphlmr Mar 14, 2025
6129665
test
rphlmr Mar 14, 2025
a35c6bc
wip
rphlmr Mar 14, 2025
6bd3683
fix
rphlmr Mar 14, 2025
d444ed1
fix double workflow
rphlmr Mar 14, 2025
b8f01f1
oups
rphlmr Mar 14, 2025
b855125
fix types export
rphlmr Mar 14, 2025
7aa0f6a
test
rphlmr Mar 14, 2025
a3da660
test
rphlmr Mar 14, 2025
2eab73d
test style fix
rphlmr Mar 14, 2025
56572ff
test
rphlmr Mar 14, 2025
44ce35d
test
rphlmr Mar 14, 2025
276294c
fix style
rphlmr Mar 14, 2025
6f1b825
enhance pipeline
rphlmr Mar 15, 2025
0d5621c
fix export to png
rphlmr Mar 15, 2025
d3d1a84
new linter
rphlmr Mar 15, 2025
ffd6ae3
fix ci
rphlmr Mar 15, 2025
aef01f4
test
rphlmr Mar 15, 2025
f55fd22
test
rphlmr Mar 15, 2025
1da45a9
test
rphlmr Mar 15, 2025
2447c38
test
rphlmr Mar 15, 2025
629ad7c
try again
rphlmr Mar 15, 2025
ffe1a6c
try again
rphlmr Mar 15, 2025
1606021
try again
rphlmr Mar 15, 2025
18c516e
..
rphlmr Mar 15, 2025
4ac37e7
rollup ?
rphlmr Mar 15, 2025
bf6755c
fix dep
rphlmr Mar 15, 2025
c61939f
...
rphlmr Mar 15, 2025
53657be
simplify
rphlmr Mar 15, 2025
a40e0d7
test again
rphlmr Mar 15, 2025
55ebe53
try something else
rphlmr Mar 15, 2025
17fca16
...
rphlmr Mar 15, 2025
c066ee9
lint
rphlmr Mar 15, 2025
f335b00
update linter
rphlmr Mar 15, 2025
8028643
remove scripts on published
rphlmr Mar 15, 2025
c6cdd77
optim
rphlmr Mar 15, 2025
51a1f31
test cache
rphlmr Mar 15, 2025
7e90f21
test cache 2
rphlmr Mar 15, 2025
e766e64
migrate to pnpm
rphlmr Mar 15, 2025
abf45c7
i should rest
rphlmr Mar 15, 2025
c11d932
try fixing preinstall
rphlmr Mar 15, 2025
249d8f8
update pipeline
rphlmr Mar 15, 2025
c84badf
clean deps
rphlmr Mar 16, 2025
09ac096
chore updates
rphlmr Mar 16, 2025
4ee8839
wip vscode rewrite
rphlmr Mar 16, 2025
c061ffb
clean code
rphlmr Mar 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .eslintrc.cjs

This file was deleted.

83 changes: 83 additions & 0 deletions .github/workflows/publish-commit.drizzle-visualizer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: "[Drizzle Visualizer] 🚀 pkg-pr-new"

concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
paths:
- "packages/visualizer/**"

defaults:
run:
working-directory: packages/visualizer

jobs:
lint:
name: ⬣ Linting
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: biomejs/setup-biome@v2
- run: biome ci . --reporter=github

typecheck:
name: 🔎 Type check
runs-on: ubuntu-latest

steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: 👷 Install pnpm
uses: pnpm/action-setup@v4

- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version-file: "package.json"
cache: "pnpm"
cache-dependency-path: |
packages/visualizer/pnpm-lock.yaml
packages/cli/pnpm-lock.yaml

- name: 📥 Install dependencies
run: pnpm install

- name: 🔎 Type check
run: pnpm typecheck

build:
name: 🏗️ Build
runs-on: ubuntu-latest
needs: [lint, typecheck]

steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: 👷 Install pnpm
uses: pnpm/action-setup@v4

- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version-file: "package.json"
cache: "pnpm"
cache-dependency-path: |
packages/visualizer/pnpm-lock.yaml
packages/cli/pnpm-lock.yaml

- name: 📥 Install dependencies
run: pnpm install

- name: 🏗️ Build
run: pnpm build

- name: 📦 Prepare package
run: pnpm prepublishOnly

- name: 📦 Publish
run: pnpm dlx pkg-pr-new publish --packageManager=pnpm
12 changes: 12 additions & 0 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { exec } = require("node:child_process");

function afterAllResolved(lockfile) {
exec("pnpm dlx @biomejs/biome format --write package.json");
return lockfile;
}

module.exports = {
hooks: {
afterAllResolved,
},
};
2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

6 changes: 5 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint", "connor4312.esbuild-problem-matchers", "ms-vscode.extension-test-runner"]
"recommendations": [
"connor4312.esbuild-problem-matchers",
"ms-vscode.extension-test-runner",
"biomejs.biome"
]
}
23 changes: 12 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false, // set this to true to hide the "out" folder with the compiled JS files
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
},
"search.exclude": {
"out": true, // set this to false to include "out" folder in search results
"dist": true // set this to false to include "dist" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
"files.exclude": {
"out": false, // set this to true to hide the "out" folder with the compiled JS files
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
},
"search.exclude": {
"out": true, // set this to false to include "out" folder in search results
"dist": true // set this to false to include "dist" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
"editor.defaultFormatter": "biomejs.biome"
}
35 changes: 22 additions & 13 deletions apps/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const visualizer = command({
"env-path": envPath,
},
async transform(options) {
disclaimer();
checkNodeVersion();
await assertOrmCoreVersion();

const DRIZZLE_LAB_CWD = process.cwd();

const cliEnvs = {
Expand Down Expand Up @@ -84,10 +88,6 @@ const visualizer = command({
return options;
},
async handler() {
disclaimer();

await assertOrmCoreVersion();

process.env.NODE_ENV === "development"
? spawnSync("vite", ["--host"], {
stdio: "inherit",
Expand All @@ -113,6 +113,10 @@ const snapshot = command({
"env-path": envPath,
},
transform: async (options) => {
disclaimer();
checkNodeVersion();
await assertOrmCoreVersion();

process.env[DRIZZLE_LAB_ENV_KEY.DEBUG] = String(options.debug);
process.env[DRIZZLE_LAB_ENV_KEY.TS_CONFIG_PATH] = options["ts-config"];
process.env[DRIZZLE_LAB_ENV_KEY.ENV_FILE_PATH] = options["env-path"];
Expand All @@ -127,10 +131,6 @@ const snapshot = command({
return config;
},
async handler(config) {
disclaimer();

await assertOrmCoreVersion();

let snapshot = {};

switch (config.dialect) {
Expand Down Expand Up @@ -177,6 +177,10 @@ const sql = command({
"env-path": envPath,
},
transform: async (options) => {
disclaimer();
checkNodeVersion();
await assertOrmCoreVersion();

process.env[DRIZZLE_LAB_ENV_KEY.DEBUG] = String(options.debug);
process.env[DRIZZLE_LAB_ENV_KEY.TS_CONFIG_PATH] = options["ts-config"];
process.env[DRIZZLE_LAB_ENV_KEY.ENV_FILE_PATH] = options["env-path"];
Expand All @@ -191,10 +195,6 @@ const sql = command({
return config;
},
async handler(config) {
disclaimer();

await assertOrmCoreVersion();

let sql = "";

switch (config.dialect) {
Expand Down Expand Up @@ -249,7 +249,7 @@ function disclaimer() {
console.log(
chalk.yellow(
`Drizzle Lab is a community-driven work in progress, and it is not guaranteed to work as expected.
If you want to help improve it, feel free to create an issue on GitHub: https://github.com/rphlmr/drizzle-lab/issues/new or reach out to me on Discord, X, or BlueSky at @rphlmr.`,
If you want to help improve it, feel free to create an issue on GitHub: https://github.com/rphlmr/drizzle-lab/issues/new or reach out to me on Discord (https://discord.com/channels/1043890932593987624/1310703894329819166), X, or BlueSky at @rphlmr.`,
),
);
}
Expand All @@ -270,3 +270,12 @@ async function assertOrmCoreVersion() {
throw e;
}
}

function checkNodeVersion() {
const [major, minor] = process.version.split("v")[1].split(".").map(Number);
if (major <= 20 && minor < 12) {
const msg = `Drizzle Visualizer requires Node.js 20.12.0 or higher. You have ${process.version}`;
console.log(chalk.red(msg));
throw new Error(msg);
}
}
28 changes: 28 additions & 0 deletions apps/cli/example/multi-packages/drizzle.config.dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* This is the configuration for the server-side database.
*/

import { defineConfig } from "drizzle-kit";

const base = "./example/multi-packages";

export default defineConfig({
dialect: "postgresql",
dbCredentials: {
url: process.env.ADMIN_DATABASE_URL!,
},
schema: [`${base}/**/database/schema.ts`, `${base}/**/database/relations.ts`],
out: `${base}/migrations`,
verbose: false,
schemaFilter: ["public"],
casing: "snake_case",
migrations: {
prefix: "timestamp",
},
entities: {
roles: {
provider: "supabase",
exclude: ["supabase_auth_admin"],
},
},
});
4 changes: 2 additions & 2 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "drizzle-lab",
"version": "0.10.0",
"version": "0.11.0",
"description": "Drizzle Lab CLI",
"sideEffects": false,
"type": "module",
Expand Down Expand Up @@ -96,6 +96,6 @@
"vite-tsconfig-paths": "^4.2.1"
},
"engines": {
"node": ">=20.0.0"
"node": ">=22.0.0"
}
}
2 changes: 1 addition & 1 deletion apps/drizzle-run/app/routes/_/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ export default function MainLayout() {
<>
{dialog.type === "new_playground" && (
<Dialog open onOpenChange={dialog.toggle}>
<DialogContent className="h-96 md:max-w-[80%]">
<DialogContent className="md:max-w-[80%] h-96">
<NewPlaygroundWizard />
</DialogContent>
</Dialog>
Expand Down
8 changes: 2 additions & 6 deletions apps/drizzle-run/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
"dependencies": {
"@conform-to/react": "^1.1.3",
"@conform-to/zod": "^1.1.3",
"@drizzle-lab/api": "*",
"@drizzle-lab/visualizer": "*",
"@electric-sql/pglite": "^0.2.3",
"@electric-sql/pglite-v1": "npm:@electric-sql/pglite@0.1.5",
"@epic-web/cachified": "^5.2.0",
Expand Down Expand Up @@ -66,7 +64,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-resizable-panels": "^2.0.22",
"react-router-hono-server": "^0.1.0",
"react-router-hono-server": "^1.2.0",
"remix-utils": "^7.6.0",
"sonner": "^1.4.41",
"use-debounce": "^10.0.3",
Expand All @@ -77,8 +75,6 @@
"devDependencies": {
"@flydotio/dockerfile": "^0.5.8",
"@remix-run/dev": "^2.14.0",
"@repo/eslint-config": "*",
"@repo/typescript-config": "*",
"@shikijs/monaco": "^1.14.1",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
Expand All @@ -96,6 +92,6 @@
"vitest": "^2.0.5"
},
"engines": {
"node": ">=20.0.0"
"node": ">=22.0.0"
}
}
20 changes: 14 additions & 6 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"include": ["apps/cli/**/*"]
"ignore": ["dist", "build", "styles.css", ".pnpmfile.cjs", "node_modules"]
},
"vcs": {
"enabled": true,
Expand All @@ -11,7 +11,7 @@
},
"formatter": {
"enabled": true,
"formatWithErrors": true,
"formatWithErrors": false,
"indentStyle": "space",
"lineEnding": "lf",
"lineWidth": 120
Expand All @@ -21,29 +21,37 @@
},
"linter": {
"enabled": true,
"ignore": ["package.json"],
"rules": {
"recommended": true,
"suspicious": {
"recommended": true,
"noExplicitAny": "off",
"noConfusingVoidType": "off"
"useAwait": "error"
},
"style": {
"recommended": true,
"noParameterAssign": "info",
"noUnusedTemplateLiteral": "warn",
"noNonNullAssertion": "warn"
},
"complexity": {
"recommended": true
"recommended": true,
"noForEach": "warn",
"useLiteralKeys": "warn",
"noUselessCatch": "warn"
},
"security": {
"recommended": true
"recommended": true,
"noDangerouslySetInnerHtml": "off"
},
"performance": {
"recommended": true
},
"correctness": {
"recommended": true
"recommended": true,
"noUnusedImports": "warn",
"useExhaustiveDependencies": "warn"
},
"a11y": {
"recommended": true
Expand Down
Loading