mirror of https://github.com/buster-so/buster.git
update imports and type checks
This commit is contained in:
parent
6eb2709dd9
commit
7b9892129c
|
@ -1,37 +0,0 @@
|
|||
# Custom Base Image - Published base with tools + dependencies
|
||||
# ================================================================
|
||||
# This image contains:
|
||||
# - Node 22 + npm
|
||||
# - pnpm + bun
|
||||
# - All workspace dependencies pre-installed
|
||||
#
|
||||
# Build and publish this multi-platform image:
|
||||
# docker buildx build --platform linux/amd64,linux/arm64 \
|
||||
# -f apps/server/Dockerfile.custom-base \
|
||||
# -t ghcr.io/buster-so/server-base:latest \
|
||||
# --push .
|
||||
|
||||
FROM node:22-alpine
|
||||
WORKDIR /app
|
||||
|
||||
# Install tools: pnpm + bun
|
||||
RUN echo "=== Installing build tools: $(date) ===" && \
|
||||
apk add --no-cache curl bash git && \
|
||||
npm install -g pnpm@9.15.0 turbo && \
|
||||
curl -fsSL https://bun.sh/install | bash && \
|
||||
echo "=== Tools installed: $(date) ==="
|
||||
|
||||
ENV PATH="/root/.bun/bin:$PATH"
|
||||
|
||||
# Copy package configuration files
|
||||
COPY package.json pnpm-lock.yaml* turbo.json* pnpm-workspace.yaml* ./
|
||||
COPY packages/ ./packages/
|
||||
COPY apps/server/package.json ./apps/server/
|
||||
|
||||
# Install ALL dependencies (this is the heavy lifting)
|
||||
RUN echo "=== Installing all dependencies: $(date) ===" && \
|
||||
time pnpm install --ignore-scripts && \
|
||||
echo "=== Dependencies installed: $(date) ===" && \
|
||||
echo "Base image ready with $(du -sh node_modules | cut -f1) of dependencies"
|
||||
|
||||
# This base image is now ready to be published and reused!
|
|
@ -1,51 +0,0 @@
|
|||
# Buster Server Docker Workflow
|
||||
Two-step build process for maximum efficiency
|
||||
|
||||
## 🔐 GitHub Container Registry Setup
|
||||
|
||||
First, authenticate with GitHub Container Registry:
|
||||
|
||||
- The password to login must be a github access token (made with token classic) with write and write package permissions
|
||||
|
||||
```bash
|
||||
docker login ghcr.io
|
||||
```
|
||||
|
||||
## 🏗️ Step 1: Build & Publish Base Image (Do this occasionally)
|
||||
|
||||
The base image contains all heavy dependencies and build tools.
|
||||
|
||||
```bash
|
||||
# Build the base image with all dependencies
|
||||
docker build -f apps/server/Dockerfile.custom-base -t ghcr.io/buster-so/server-base:latest .
|
||||
|
||||
# Publish to GitHub Container Registry
|
||||
docker push ghcr.io/buster-so/server-base:latest
|
||||
```
|
||||
|
||||
**When to rebuild the base:**
|
||||
- Major dependency updates
|
||||
- New packages added to workspace
|
||||
- Tool version updates (pnpm, bun)
|
||||
- Weekly/monthly maintenance
|
||||
|
||||
## ⚡ Step 2: Ultra-Fast App Builds (CI/CD)
|
||||
|
||||
Use the published base for lightning-fast builds:
|
||||
|
||||
```bash
|
||||
# Pull the latest base (in CI/CD)
|
||||
docker pull ghcr.io/buster-so/buster-server-base:latest
|
||||
|
||||
# Build your app (super fast!)
|
||||
docker build -f apps/server/Dockerfile.ultra-fast -t buster-server:latest .
|
||||
```
|
||||
|
||||
|
||||
### Update Base Image (periodically):
|
||||
```bash
|
||||
# Rebuild and push new base
|
||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||
-f apps/server/Dockerfile.custom-base \
|
||||
-t ghcr.io/buster-so/server-base:latest \
|
||||
--push .
|
|
@ -7,8 +7,8 @@
|
|||
}
|
||||
},
|
||||
"scripts": {
|
||||
"prebuild": "bun run scripts/validate-env.js",
|
||||
"build": "bun build src/index.ts --outdir ./dist --target bun --external pino-pretty",
|
||||
"prebuild": "bun run scripts/validate-env.js && pnpm run typecheck",
|
||||
"build": "bun build src/index.ts --outdir ./dist --target bun",
|
||||
"dev": "bun --max-old-space-size=512 run --hot src/index.ts",
|
||||
"lint": "biome check",
|
||||
"prod": "pnpm run build:vercel && pnpm run start:vercel",
|
||||
|
@ -31,13 +31,13 @@
|
|||
"@trigger.dev/sdk": "catalog:",
|
||||
"drizzle-orm": "catalog:",
|
||||
"hono": "catalog:",
|
||||
"hono-pino": "^0.8.0",
|
||||
"hono-pino": "^0.9.1",
|
||||
"pino": "^9.7.0",
|
||||
"pino-pretty": "^13.0.0",
|
||||
"zod": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/node": "^5.3.3",
|
||||
"@vercel/node": "^5.3.4",
|
||||
"tsup": "^8.5.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { randomUUID } from 'node:crypto';
|
||||
import { db, organizations, users, usersToOrganizations } from '@buster/database';
|
||||
import type { Organization, User } from '@buster/database';
|
||||
import type { User } from '@buster/database';
|
||||
import type { UserOrganizationRole } from '@buster/server-shared/user';
|
||||
import type { InferInsertModel, InferSelectModel } from 'drizzle-orm';
|
||||
|
||||
type Organization = InferSelectModel<typeof organizations>;
|
||||
import { and, eq, isNull } from 'drizzle-orm';
|
||||
|
||||
export async function createTestUserInDb(userData: Partial<User> = {}): Promise<User> {
|
||||
|
@ -48,26 +52,28 @@ export async function createTestOrganizationInDb(
|
|||
const id = randomUUID();
|
||||
// Use a unique domain for each organization to avoid conflicts with the trigger
|
||||
const uniqueDomain = `test-${id.substring(0, 8)}.com`;
|
||||
const org = {
|
||||
const org: Organization = {
|
||||
id,
|
||||
name: `Test Organization ${id}`,
|
||||
domains: orgData.domains !== undefined ? orgData.domains : [uniqueDomain],
|
||||
restrictNewUserInvitations: false,
|
||||
defaultRole: 'restricted_querier',
|
||||
defaultRole: 'restricted_querier' as const,
|
||||
createdAt: new Date().toISOString(),
|
||||
updatedAt: new Date().toISOString(),
|
||||
deletedAt: null,
|
||||
domain: null,
|
||||
paymentRequired: true,
|
||||
...orgData,
|
||||
};
|
||||
|
||||
await db.insert(organizations).values(org);
|
||||
return org as Organization;
|
||||
return org;
|
||||
}
|
||||
|
||||
export async function createTestOrgMemberInDb(
|
||||
userId: string,
|
||||
organizationId: string,
|
||||
role = 'querier'
|
||||
role: UserOrganizationRole = 'querier'
|
||||
): Promise<void> {
|
||||
// First check if there's already a membership
|
||||
const existing = await db
|
||||
|
@ -80,7 +86,7 @@ export async function createTestOrgMemberInDb(
|
|||
await db.delete(usersToOrganizations).where(eq(usersToOrganizations.userId, userId));
|
||||
}
|
||||
|
||||
const member = {
|
||||
const member: InferInsertModel<typeof usersToOrganizations> = {
|
||||
userId,
|
||||
organizationId,
|
||||
role,
|
||||
|
|
|
@ -111,8 +111,8 @@ async function updateOrganizationSettings(
|
|||
restrictNewUserInvitations: updateData.restrictNewUserInvitations,
|
||||
}),
|
||||
...(updateData.defaultRole !== undefined &&
|
||||
updateData.defaultRole !== 'none' && {
|
||||
defaultRole: updateData.defaultRole as Exclude<OrganizationRole, 'none'>,
|
||||
updateData.defaultRole && {
|
||||
defaultRole: updateData.defaultRole,
|
||||
}),
|
||||
};
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import type { userOrganizationRoleEnum } from '@buster/database'; //we import as type to avoid postgres dependency in the frontend ☹️
|
||||
import { z } from 'zod/v4';
|
||||
|
||||
type UserOrganizationRoleBase = (typeof userOrganizationRoleEnum.enumValues)[number] | 'none';
|
||||
type UserOrganizationRoleBase = (typeof userOrganizationRoleEnum.enumValues)[number];
|
||||
|
||||
const UserOrganizationRoleEnums: Record<UserOrganizationRoleBase, UserOrganizationRoleBase> =
|
||||
Object.freeze({
|
||||
none: 'none',
|
||||
viewer: 'viewer',
|
||||
workspace_admin: 'workspace_admin',
|
||||
data_admin: 'data_admin',
|
||||
|
|
|
@ -130,8 +130,8 @@ importers:
|
|||
specifier: 'catalog:'
|
||||
version: 4.8.3
|
||||
hono-pino:
|
||||
specifier: ^0.8.0
|
||||
version: 0.8.0(hono@4.8.3)(pino@9.7.0)
|
||||
specifier: ^0.9.1
|
||||
version: 0.9.1(hono@4.8.3)(pino@9.7.0)
|
||||
pino:
|
||||
specifier: ^9.7.0
|
||||
version: 9.7.0
|
||||
|
@ -143,8 +143,8 @@ importers:
|
|||
version: 3.25.67
|
||||
devDependencies:
|
||||
'@vercel/node':
|
||||
specifier: ^5.3.3
|
||||
version: 5.3.3(rollup@4.44.2)
|
||||
specifier: ^5.3.4
|
||||
version: 5.3.4(rollup@4.44.2)
|
||||
tsup:
|
||||
specifier: ^8.5.0
|
||||
version: 8.5.0(jiti@2.4.2)(postcss@8.5.6)(tsx@4.20.3)(typescript@4.9.5)(yaml@2.8.0)
|
||||
|
@ -5382,8 +5382,8 @@ packages:
|
|||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@vercel/build-utils@10.6.4':
|
||||
resolution: {integrity: sha512-7qmpqKdp8cQwV1NaBoONZVvR5leIdxI/AB85VsIiNhYXIgK4z5j52PfzKAlivDYQUTgYMwQv2FWOEBUh4KQoyw==}
|
||||
'@vercel/build-utils@10.6.5':
|
||||
resolution: {integrity: sha512-bNw+CcAr1i7nSnoUfRtxx9reX/iuKo/kM61jpFmu32cW36BZzS8KLIz6wvIlWnU7HTTmxENR3tc2PT3yi7yEow==}
|
||||
|
||||
'@vercel/error-utils@2.0.3':
|
||||
resolution: {integrity: sha512-CqC01WZxbLUxoiVdh9B/poPbNpY9U+tO1N9oWHwTl5YAZxcqXmmWJ8KNMFItJCUUWdY3J3xv8LvAuQv2KZ5YdQ==}
|
||||
|
@ -5402,8 +5402,8 @@ packages:
|
|||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
'@vercel/node@5.3.3':
|
||||
resolution: {integrity: sha512-r+9vBv0JabLVwzfvS1sAl/M9FfRSzRt53rrj5Ge4ZSNEvrLCtw89Zs6zLipcVkHfYSDkDp6esNalHwyOdmPGRA==}
|
||||
'@vercel/node@5.3.4':
|
||||
resolution: {integrity: sha512-U3VvStXs608RYjczrrZQtU8Q/hDF0FShJPYrTCJq64ppfvgjiRJra+33bd32Gqmn19QjuQNLE2qxGjKZGjsYDw==}
|
||||
|
||||
'@vercel/static-config@3.1.1':
|
||||
resolution: {integrity: sha512-IRtKnm9N1Uqd2ayIbLPjRtdwcl1GTWvqF1PuEVNm9O43kmoI+m9VpGlW8oga+5LQq1LmJ2Y67zHr7NbjrH1rrw==}
|
||||
|
@ -7854,8 +7854,8 @@ packages:
|
|||
zod-openapi:
|
||||
optional: true
|
||||
|
||||
hono-pino@0.8.0:
|
||||
resolution: {integrity: sha512-JFQcOIHApa22NUqZpyNCYf/ni2kwnn85vABjpAzssiQeEt7rkN/sRW19Z+WQzdHDluZVSNnF6Mk7nY13MJzJDA==}
|
||||
hono-pino@0.9.1:
|
||||
resolution: {integrity: sha512-5HopJgf7FBAHw1NBXNSDMB9Iuxp6RD0IkXDqmA+MxNQk6s566B0a8GtdSkApbow9wbrhghtHE8aLri9RsvzG1A==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
hono: '>=4.0.0'
|
||||
|
@ -14071,7 +14071,7 @@ snapshots:
|
|||
consola: 3.4.2
|
||||
detect-libc: 2.0.4
|
||||
https-proxy-agent: 7.0.6
|
||||
node-fetch: 2.6.9
|
||||
node-fetch: 2.7.0
|
||||
nopt: 8.1.0
|
||||
semver: 7.7.2
|
||||
tar: 7.4.3
|
||||
|
@ -17390,7 +17390,7 @@ snapshots:
|
|||
'@unrs/resolver-binding-win32-x64-msvc@1.11.0':
|
||||
optional: true
|
||||
|
||||
'@vercel/build-utils@10.6.4': {}
|
||||
'@vercel/build-utils@10.6.5': {}
|
||||
|
||||
'@vercel/error-utils@2.0.3': {}
|
||||
|
||||
|
@ -17417,13 +17417,13 @@ snapshots:
|
|||
- rollup
|
||||
- supports-color
|
||||
|
||||
'@vercel/node@5.3.3(rollup@4.44.2)':
|
||||
'@vercel/node@5.3.4(rollup@4.44.2)':
|
||||
dependencies:
|
||||
'@edge-runtime/node-utils': 2.3.0
|
||||
'@edge-runtime/primitives': 4.1.0
|
||||
'@edge-runtime/vm': 3.2.0
|
||||
'@types/node': 16.18.11
|
||||
'@vercel/build-utils': 10.6.4
|
||||
'@vercel/build-utils': 10.6.5
|
||||
'@vercel/error-utils': 2.0.3
|
||||
'@vercel/nft': 0.29.2(rollup@4.44.2)
|
||||
'@vercel/static-config': 3.1.1
|
||||
|
@ -19351,8 +19351,8 @@ snapshots:
|
|||
'@typescript-eslint/parser': 8.35.1(eslint@8.57.1)(typescript@5.8.3)
|
||||
eslint: 8.57.1
|
||||
eslint-import-resolver-node: 0.3.9
|
||||
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@8.57.1)
|
||||
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1)
|
||||
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1)
|
||||
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1)
|
||||
eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.1)
|
||||
eslint-plugin-react: 7.37.5(eslint@8.57.1)
|
||||
eslint-plugin-react-hooks: 5.2.0(eslint@8.57.1)
|
||||
|
@ -19375,7 +19375,7 @@ snapshots:
|
|||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0)(eslint@8.57.1):
|
||||
eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1):
|
||||
dependencies:
|
||||
'@nolyfill/is-core-module': 1.0.39
|
||||
debug: 4.4.1
|
||||
|
@ -19386,22 +19386,22 @@ snapshots:
|
|||
tinyglobby: 0.2.14
|
||||
unrs-resolver: 1.11.0
|
||||
optionalDependencies:
|
||||
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1)
|
||||
eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
eslint-module-utils@2.12.1(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1):
|
||||
eslint-module-utils@2.12.1(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1):
|
||||
dependencies:
|
||||
debug: 3.2.7
|
||||
optionalDependencies:
|
||||
'@typescript-eslint/parser': 8.35.1(eslint@8.57.1)(typescript@5.8.3)
|
||||
eslint: 8.57.1
|
||||
eslint-import-resolver-node: 0.3.9
|
||||
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@8.57.1)
|
||||
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1):
|
||||
eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1):
|
||||
dependencies:
|
||||
'@rtsao/scc': 1.1.0
|
||||
array-includes: 3.1.9
|
||||
|
@ -19412,7 +19412,7 @@ snapshots:
|
|||
doctrine: 2.1.0
|
||||
eslint: 8.57.1
|
||||
eslint-import-resolver-node: 0.3.9
|
||||
eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@8.57.1)
|
||||
eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.35.1(eslint@8.57.1)(typescript@5.8.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1)
|
||||
hasown: 2.0.2
|
||||
is-core-module: 2.16.1
|
||||
is-glob: 4.0.3
|
||||
|
@ -20255,7 +20255,7 @@ snapshots:
|
|||
hono: 4.8.4
|
||||
zod: 3.25.67
|
||||
|
||||
hono-pino@0.8.0(hono@4.8.3)(pino@9.7.0):
|
||||
hono-pino@0.9.1(hono@4.8.3)(pino@9.7.0):
|
||||
dependencies:
|
||||
defu: 6.1.4
|
||||
hono: 4.8.3
|
||||
|
|
Loading…
Reference in New Issue