Skip to content

Commit

Permalink
handle @web deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinh · divn.dev committed Dec 2, 2023
1 parent d9c0bfe commit 688f1dd
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 41 deletions.
8 changes: 4 additions & 4 deletions @api/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ WEB_URL = "http://localhost:3000"
# ------------------------------------------------------------------------------------------------------------

# [env.preview.route]
# pattern = "preview.api.dinstack.ai"
# pattern = "preview.api.example.com"
# custom_domain = true

[env.preview.vars]
WORKER_ENV = "development"
WEB_URL = "https://preview.dinstack.ai"
WEB_URL = "https://preview.example.com"

# ------------------------------------------------------------------------------------------------------------

[env.production]
logpush = true

# [env.production.route]
# pattern = "api.dinstack.ai"
# pattern = "api.example.com"
# custom_domain = true

[env.production.vars]
WORKER_ENV = "production"
WEB_URL = "https://app.dinstack.ai"
WEB_URL = "https://app.example.com"

# ------------------------------------------------------------------------------------------------------------
1 change: 0 additions & 1 deletion @web/.env.example

This file was deleted.

1 change: 1 addition & 0 deletions @web/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_API_URL=http://localhost:8000
1 change: 1 addition & 0 deletions @web/.env.preview
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_API_URL=https://preview.api.example.com
1 change: 1 addition & 0 deletions @web/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_API_URL=https://api.example.com
3 changes: 1 addition & 2 deletions @web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ yarn-debug.log*
yarn-error.log*

# local env files
.env*
!.env.example
# .env*.local

# vercel
.vercel
Expand Down
1 change: 1 addition & 0 deletions @web/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default function Home() {
const { status, data } = api.ping.useQuery()
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
{process.env.NEXT_PUBLIC_API_URL}
<code className="text-2xl">
{status} {JSON.stringify(data)}
</code>
Expand Down
5 changes: 3 additions & 2 deletions @web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"preview": "next build && pnpx serve@latest out",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"deploy:preview": "env-cmd -f .env.preview next build && wrangler pages deploy --project-name=dinstack-web-preview --branch=main ./dist",
"deploy:production": "env-cmd -f .env.production next build && wrangler pages deploy --project-name=dinstack-web-production --branch=main ./dist"
},
"dependencies": {
"@dinstack/ui": "workspace:^",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"env-cmd": "^10.1.0",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-react": "^7.33.2",
Expand Down
44 changes: 12 additions & 32 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 688f1dd

Please sign in to comment.