kunkun/packages/schema/scripts/upload-schema-to-supabase.ts
Huakun Shen 605a7844f2
Feature: Deep Link + Supabase OAuth + open extension in store with deep link (#16)
* feat(auth): add deep link and supabase auth

* fix(deep-link): fix some routing and reactive page rendering

* feat: implement supabase auth with pkce auth flow
2024-11-05 09:27:52 -05:00

27 lines
828 B
TypeScript

import { ExtPackageJson } from "@kksh/api/models"
import { createSB } from "@kksh/supabase"
import { parse, string } from "valibot"
import { getJsonSchema } from "../src"
const supabase = createSB(
parse(string(), process.env.SUPABASE_URL),
parse(string(), process.env.SUPABASE_SERVICE_ROLE_KEY)
)
const schemaStr = getJsonSchema(ExtPackageJson)
const { data, error } = await supabase.storage.from("extensions").upload("schema.json", schemaStr, {
cacheControl: "3600",
upsert: true // overwrite existing file with same name
})
await supabase.storage.from("extensions").upload("nightly.schema.json", schemaStr, {
cacheControl: "3600",
upsert: true // overwrite existing file with same name
})
console.log("data", data)
if (error) {
console.error("Failed to upload schema.json")
console.error(error)
process.exit(1)
}