diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 604496ff..485a6087 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,50 +1,52 @@ { - "name": "Sourcebot Development", - "dockerComposeFile": "docker-compose.yml", - "service": "devcontainer", - "workspaceFolder": "/workspaces/sourcebot", + "name": "Sourcebot Development", + "dockerComposeFile": "docker-compose.yml", + "service": "devcontainer", + "workspaceFolder": "/workspaces/sourcebot", - "features": { - "ghcr.io/devcontainers/features/git:1": {}, - "ghcr.io/devcontainers/features/github-cli:1": {} - }, + "features": { + "ghcr.io/devcontainers/features/git:1": {}, + "ghcr.io/devcontainers/features/github-cli:1": {} + }, - "forwardPorts": [3000], - "portsAttributes": { - "3000": { "label": "Web App", "onAutoForward": "notify" } - }, + "remoteEnv": { + "AUTH_URL": "https://${containerEnv:CODESPACE_NAME}-3000.app.github.dev" + }, - "initializeCommand": "git submodule update --init --recursive", - "postCreateCommand": "bash .devcontainer/scripts/post-create.sh", - "postStartCommand": "bash .devcontainer/scripts/post-start.sh", + "forwardPorts": [3000], + "portsAttributes": { + "3000": { "label": "Web App", "onAutoForward": "notify" } + }, - "customizations": { - "vscode": { - "extensions": [ - "dbaeumer.vscode-eslint", - "bradlc.vscode-tailwindcss", - "Prisma.prisma", - "esbenp.prettier-vscode", - "golang.go", - "ms-azuretools.vscode-docker", - "mikestead.dotenv", - "eamodio.gitlens" - ], - "settings": { - "editor.formatOnSave": true, - "editor.defaultFormatter": "esbenp.prettier-vscode", - "[typescript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[typescriptreact]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[prisma]": { - "editor.defaultFormatter": "Prisma.prisma" + "initializeCommand": "git submodule update --init --recursive", + "postCreateCommand": "bash .devcontainer/scripts/post-create.sh", + "postStartCommand": "bash .devcontainer/scripts/post-start.sh", + + "customizations": { + "vscode": { + "extensions": [ + "dbaeumer.vscode-eslint", + "bradlc.vscode-tailwindcss", + "Prisma.prisma", + "esbenp.prettier-vscode", + "golang.go", + "eamodio.gitlens" + ], + "settings": { + "editor.formatOnSave": false, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[prisma]": { + "editor.defaultFormatter": "Prisma.prisma" + } + } } - } - } - }, + }, - "remoteUser": "node" + "remoteUser": "node" } diff --git a/.devcontainer/scripts/post-create.sh b/.devcontainer/scripts/post-create.sh index 26b9a710..7169a093 100755 --- a/.devcontainer/scripts/post-create.sh +++ b/.devcontainer/scripts/post-create.sh @@ -10,14 +10,32 @@ cd /workspaces/sourcebot # 1. Initialize git submodules (in case initializeCommand didn't run) echo "" -echo "[1/2] Initializing git submodules..." +echo "[1/4] Initializing git submodules..." git submodule update --init --recursive # 2. Build Zoekt and install dependencies (uses Makefile) echo "" -echo "[2/2] Building Zoekt and installing dependencies..." +echo "[2/4] Building Zoekt and installing dependencies..." make +echo "" +echo "[3/4] Running database migrations..." +yarn dev:prisma:migrate:dev + +echo "" +echo "[4/4] Creating default config.json..." +cat > config.json << 'EOF' +{ + "$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", + "connections": { + "github": { + "type": "github", + "repos": ["sourcebot-dev/sourcebot"] + } + } +} +EOF + echo "" echo "==========================================" echo "Post-create setup complete!" diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..5fcd8a70 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "tabWidth": 4 +} diff --git a/packages/web/next.config.mjs b/packages/web/next.config.mjs index d344d121..e6f00539 100644 --- a/packages/web/next.config.mjs +++ b/packages/web/next.config.mjs @@ -38,7 +38,18 @@ const nextConfig = { ] }, - turbopack: {} + turbopack: {}, + + // @see: https://github.com/vercel/next.js/issues/58019#issuecomment-1910531929 + ...(process.env.NODE_ENV === 'development' ? { + experimental: { + serverActions: { + allowedOrigins: [ + 'localhost:3000' + ] + } + } + } : {}), }; export default withSentryConfig(nextConfig, {