Skip to content

Commit

Permalink
fix deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
Wundero committed Dec 20, 2024
1 parent 7a2a969 commit ef84301
Show file tree
Hide file tree
Showing 9 changed files with 2,284 additions and 251 deletions.
1 change: 1 addition & 0 deletions apps/app-manager/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ next-env.d.ts
# Cloudflare related
/.save.next
/.worker-next
/.open-next
/.wrangler

# wrangler files
Expand Down
3 changes: 3 additions & 0 deletions apps/app-manager/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ interface CloudflareEnv {
AUTH_SECRET: string;
AUTH_GITHUB_ID: string;
AUTH_GITHUB_SECRET: string;
DEPLOYMENT_ENV: string;
DEPLOYMENT_URL: string;
NEXTJS_ENV: string;
DATABASE: D1Database;
ASSETS: Fetcher;
}
25 changes: 25 additions & 0 deletions apps/app-manager/open-next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import cache from "@opennextjs/cloudflare/kvCache";

const config = {
default: {
override: {
wrapper: "cloudflare-node",
converter: "edge",
// Set `incrementalCache` to "dummy" to disable KV cache
incrementalCache: async () => cache,
tagCache: "dummy",
queue: "dummy",
},
},

middleware: {
external: true,
override: {
wrapper: "cloudflare-edge",
converter: "edge",
proxyExternalRequest: "fetch",
},
},
};

export default config;
38 changes: 21 additions & 17 deletions apps/app-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"deploy": "cloudflare && wrangler deploy",
"preview": "cloudflare && wrangler dev",
"build:worker": "opennextjs-cloudflare",
"dev:worker": "wrangler dev --port 8771",
"preview:worker": "npm run build:worker && npm run dev:worker",
"deploy:worker": "npm run build:worker && wrangler deploy",
"cf-typegen": "wrangler types --env-interface CloudflareEnv env.d.ts --experimental-include-runtime"
},
"dependencies": {
Expand All @@ -20,21 +22,21 @@
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@tanstack/react-query": "^5.62.7",
"@trpc/client": "^11.0.0-rc.660",
"@trpc/react-query": "^11.0.0-rc.660",
"@trpc/server": "^11.0.0-rc.660",
"@tanstack/react-query": "^5.62.8",
"@trpc/client": "^11.0.0-rc.666",
"@trpc/react-query": "^11.0.0-rc.666",
"@trpc/server": "^11.0.0-rc.666",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"drizzle-orm": "^0.38.1",
"drizzle-orm": "^0.38.2",
"geist": "^1.3.1",
"lucide-react": "^0.468.0",
"next": "15.1.0",
"lucide-react": "^0.469.0",
"next": "15.1.2",
"next-auth": "5.0.0-beta.25",
"react": "^19.0.0",
"react-day-picker": "9.4.3",
"react-day-picker": "9.4.4",
"react-dom": "^19.0.0",
"react-hook-form": "^7.54.0",
"react-hook-form": "^7.54.2",
"superjson": "^2.2.2",
"tailwind-merge": "^2.5.5",
"tailwindcss-animate": "^1.0.7",
Expand All @@ -44,22 +46,24 @@
"prettier": "@sinkr/prettier-config",
"devDependencies": {
"@auth/core": "^0.37.4",
"@cloudflare/workers-types": "^4.20241205.0",
"@cloudflare/workers-types": "^4.20241218.0",
"@miniflare/d1": "^2.14.4",
"@opennextjs/cloudflare": "^0.2.1",
"@opennextjs/aws": "^3.3.0",
"@opennextjs/cloudflare": "^0.3.0",
"@sinkr/eslint-config": "workspace:*",
"@sinkr/prettier-config": "workspace:*",
"@sinkr/tsconfig": "workspace:*",
"@types/node": "catalog:",
"@types/react": "npm:types-react@rc",
"@types/react-dom": "npm:types-react-dom@rc",
"drizzle-kit": "^0.30.0",
"caniuse-lite": "^1.0.30001690",
"drizzle-kit": "^0.30.1",
"eslint": "catalog:",
"eslint-config-next": "15.1.0",
"eslint-config-next": "15.1.2",
"postcss": "^8.4.49",
"prettier": "catalog:",
"tailwindcss": "^3.4.16",
"tailwindcss": "^3.4.17",
"typescript": "catalog:",
"wrangler": "^3.95.0"
"wrangler": "^3.99.0"
}
}
18 changes: 17 additions & 1 deletion apps/app-manager/src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,23 @@ function rewriteRequestUrl(req: NextRequest) {
req.nextUrl.port = baseUrl.port;
req.nextUrl.hostname = baseUrl.hostname;
req.nextUrl.protocol = baseUrl.protocol;
return new NextRequest(req.nextUrl, req);
const newReq = new NextRequest(req.nextUrl, {
method: req.method,
headers: req.headers,
body: req.body,
cache: req.cache,
cf: req.cf,
credentials: req.credentials,
redirect: req.redirect,
fetcher: req.fetcher,
integrity: req.integrity,
keepalive: req.keepalive,
mode: req.mode,
referrer: req.referrer,
referrerPolicy: req.referrerPolicy,
signal: req.signal,
});
return newReq;
}

const { GET: _get, POST: _post } = handlers;
Expand Down
2 changes: 1 addition & 1 deletion apps/app-manager/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"module": "esnext"
},
"include": [".", "src/app/.well-known/**/*.ts", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "open-next.config.ts"]
}
4 changes: 2 additions & 2 deletions apps/app-manager/wrangler.example.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#:schema node_modules/wrangler/config-schema.json
name = "sinkr-app-manager"
main = ".worker-next/index.mjs"
main = ".open-next/worker.js"

compatibility_date = "2024-12-01"
compatibility_flags = ["nodejs_compat"]
Expand All @@ -9,7 +9,7 @@ compatibility_flags = ["nodejs_compat"]
minify = true

# Use the new Workers + Assets to host the static frontend files
assets = { directory = ".worker-next/assets", binding = "ASSETS" }
assets = { directory = ".open-next/assets", binding = "ASSETS" }

routes = [
{ pattern = "<your domain>", custom_domain = true }
Expand Down
8 changes: 4 additions & 4 deletions apps/deployment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
"cf-typegen": "wrangler types"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20241205.0",
"@cloudflare/workers-types": "^4.20241218.0",
"@sinkr/eslint-config": "workspace:*",
"@sinkr/prettier-config": "workspace:*",
"@sinkr/tsconfig": "workspace:*",
"@types/node": "catalog:",
"drizzle-kit": "^0.30.0",
"drizzle-kit": "^0.30.1",
"eslint": "catalog:",
"prettier": "catalog:",
"typescript": "catalog:",
"wrangler": "^3.95.0"
"wrangler": "^3.99.0"
},
"prettier": "@sinkr/prettier-config",
"dependencies": {
"@sinkr/validators": "workspace:*",
"crossws": "catalog:",
"drizzle-orm": "^0.38.1",
"drizzle-orm": "^0.38.2",
"uuid": "^11.0.3",
"zod": "^3.24.1"
}
Expand Down
Loading

0 comments on commit ef84301

Please sign in to comment.