Skip to content

Commit

Permalink
fix: and improve some mini bug (#14)
Browse files Browse the repository at this point in the history
* fix typescript

* improve env
  • Loading branch information
unnoq authored Dec 27, 2023
1 parent b0e362a commit 9698829
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 254 deletions.
15 changes: 11 additions & 4 deletions @api/.dev.example.vars
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
WORKER_ENV="development" # development, production
APP_BASE_URL="http://localhost:4000/"

DATABASE_URL=
AUTH_SECRET=
AUTH_SECRET="secret_value"
TURNSTILE_SECRET_KEY="1x0000000000000000000000000000000AA"

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URL="http://localhost:4000/oauth/google/callback"

RESEND_API_KEY=
RESEND_FROM=
RESEND_FROM="Dinh Le <[email protected]>"

GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
TURNSTILE_SECRET_KEY=
GITHUB_CLIENT_SECRET=
2 changes: 1 addition & 1 deletion @api/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { z } from 'zod'

export const envSchema = z.object({
WORKER_ENV: z.enum(['development', 'production']).default('production'),
WEB_URL: z.string().url(),
APP_BASE_URL: z.string().url(),
DATABASE_URL: z.string().url(),
AUTH_SECRET: z.string(),
GOOGLE_CLIENT_ID: z.string(),
Expand Down
4 changes: 2 additions & 2 deletions @api/features/organization/member.invite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export const organizationMemberInviteRoute = authProcedure
ctx.ec.waitUntil(
(async () => {
const invitationAcceptUrl = new URL(
`/invitation-accept?secret-key=${invitation.secretKey}`,
ctx.env.WEB_URL,
`invitation-accept?secret-key=${invitation.secretKey}`,
ctx.env.APP_BASE_URL,
)
const { subject, html } = generateOrganizationInvitationEmail({
inviterName: user.name,
Expand Down
16 changes: 0 additions & 16 deletions @api/wrangler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ mode = "smart"

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

[env.local.vars]
WORKER_ENV = "development"
WEB_URL = "http://localhost:3000"
GOOGLE_REDIRECT_URL = "http://localhost:3000/oauth/google/callback"
TURNSTILE_SECRET_KEY = "1x0000000000000000000000000000000AA"

[[env.local.r2_buckets]]
binding = 'PUBLIC_BUCKET'
bucket_name = 'dinstack-public-local'
Expand All @@ -23,11 +17,6 @@ bucket_name = 'dinstack-public-local'
# pattern = "preview.api.example.com"
# custom_domain = true

[env.preview.vars]
WORKER_ENV = "development"
WEB_URL = "https://preview.example.com"
GOOGLE_REDIRECT_URL = "https://preview.example.com/oauth/google/callback"

[[env.preview.r2_buckets]]
binding = 'PUBLIC_BUCKET'
bucket_name = 'dinstack-public-preview'
Expand All @@ -41,11 +30,6 @@ logpush = true
# pattern = "api.example.com"
# custom_domain = true

[env.production.vars]
WORKER_ENV = "production"
WEB_URL = "https://example.com"
GOOGLE_REDIRECT_URL = "https://example.com/oauth/google/callback"

[[env.production.r2_buckets]]
binding = 'PUBLIC_BUCKET'
bucket_name = 'dinstack-public-production'
Expand Down
4 changes: 2 additions & 2 deletions @tsconfig/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {},
"devDependencies": {
"@cloudflare/workers-types": "^4.20230922.0",
"@types/node": "^20.10.4",
"@types/node": "20.10.1",
"@total-typescript/ts-reset": "^0.5.1"
}
}
}
4 changes: 2 additions & 2 deletions @web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
"devDependencies": {
"@dinstack/tsconfig": "workspace:^",
"@swc-jotai/react-refresh": "^0.1.0",
"@types/node": "^20.10.4",
"@types/node": "20.10.1",
"@types/react": "^18.2.43",
"@types/react-dom": "^18.2.17",
"autoprefixer": "^10.4.16",
"postcss": "^8.4.32",
"tailwindcss": "^3.3.6",
"typescript": "^5.3.3"
}
}
}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"env-cmd": "^10.1.0",
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.0.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"tsc-alias": "^1.8.8",
"turbo": "^1.10.16",
"typescript": "^5.3.2",
"wrangler": "^3.18.0"
"turbo": "^1.11.2",
"typescript": "^5.3.3",
"wrangler": "^3.22.1"
}
}
Loading

0 comments on commit 9698829

Please sign in to comment.