mirror of
https://github.com/kunkunsh/kunkun.git
synced 2025-04-11 17:29:44 +00:00

* chore: add vendor submodules * feat: add packages for db,ci,schema,api,jarvis cmds * feat: add tauri-jarvis-plugin * feat: implement extension commands list * fix(desktop): import path errors after packages refactor * chore: add self signed cert * fix: prevent prerender for desktop * fix(desktop): desktop sveltekit static build, use csr for dynamic route * feat: add error handling page and components * refactor: component lib * refactor: move more types, functions and components out of desktop * refactor(ui): more refactor * refactor(ui): move store components to @kksh/ui * ci: add CI for build & test * refactor: rename @kksh/extensions to @kksh/extension * ci: add 2 more ci * ci: fix * fix: CI env var * chore: add changeset * feat: implement extension store item detail view * feat: implement extension store install, uninstall, upgrade * format * revert: upgradable logic, the new one doesn't work yet * refactor: make @kksh/ui dependent only on @kksh/api Reason: @kksh/ui may be published later for building website, all its dependency packages must be also published. To avoid trouble it should be standalone, depend only on packages already published * refactor: cleanup * fixed: some typescript error * chore: got typedoc working on @kksh/api * ci: disable manifest schema upload CI on push
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
/**
|
|
* Initialize .env files for packages
|
|
* All env variables here are public
|
|
*/
|
|
import { writeFileSync } from "fs"
|
|
import { join } from "path"
|
|
import { REPO_ROOT } from "@/path"
|
|
|
|
console.log("Init Env")
|
|
|
|
const defaultEnvUrl = `https://storage.kunkun.sh/env.json`
|
|
const res = await fetch(defaultEnvUrl)
|
|
const env = await res.json()
|
|
|
|
let envContent = ""
|
|
|
|
if (!process.env.SUPABASE_ANON_KEY) {
|
|
process.env.SUPABASE_ANON_KEY = env.SUPABASE_ANON_KEY
|
|
}
|
|
if (!process.env.SUPABASE_PROJECT_ID) {
|
|
process.env.SUPABASE_PROJECT_ID = env.SUPABASE_PROJECT_ID
|
|
}
|
|
|
|
if (process.env.SUPABASE_ANON_KEY) {
|
|
envContent += `SUPABASE_ANON_KEY=${process.env.SUPABASE_ANON_KEY}\n`
|
|
}
|
|
if (process.env.SUPABASE_PROJECT_ID) {
|
|
const supabaseUrl = `https://${process.env.SUPABASE_PROJECT_ID}.supabase.co`
|
|
const supabaseGraphqlEndpoint = `${supabaseUrl}/graphql/v1`
|
|
envContent += `
|
|
SUPABASE_GRAPHQL_ENDPOINT=${supabaseGraphqlEndpoint}
|
|
SUPABASE_URL=${supabaseUrl}
|
|
`
|
|
}
|
|
if (process.env.SUPABASE_SERVICE_ROLE_KEY) {
|
|
envContent += `\nSUPABASE_SERVICE_ROLE_KEY=${process.env.SUPABASE_SERVICE_ROLE_KEY}\n`
|
|
}
|
|
if (process.env.POSTHOG_PUBLIC_KEY && process.env.POSTHOG_HOST) {
|
|
envContent += `
|
|
POSTHOG_PUBLIC_KEY=${process.env.POSTHOG_PUBLIC_KEY}
|
|
POSTHOG_HOST=${process.env.POSTHOG_HOST}
|
|
`
|
|
}
|
|
|
|
// writeFileSync(join(__dirname, "../apps/desktop/.env"), envContent)
|
|
writeFileSync(
|
|
join(REPO_ROOT, "apps/desktop/.env"),
|
|
`
|
|
PUBLIC_SUPABASE_ANON_KEY=${process.env.SUPABASE_ANON_KEY}
|
|
PUBLIC_SUPABASE_PROJECT_ID=${process.env.SUPABASE_PROJECT_ID}
|
|
`
|
|
)
|
|
// writeFileSync(join(__dirname, "../packages/gql/.env"), envContent)
|
|
writeFileSync(join(REPO_ROOT, "packages/schema/.env"), envContent)
|