fix(ota): tighten scaffold schema and dev config
This commit is contained in:
parent
4658fd013d
commit
dc3d0c50e2
|
|
@ -35,5 +35,6 @@ describe("otaReleaseSchema", () => {
|
|||
|
||||
expect(parsed.releaseVersion).toBe("0.4.2")
|
||||
expect(parsed.runtimeVersion).toBe("0.4.1")
|
||||
expect(Object.keys(parsed.platforms)).toEqual(["ios"])
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { z } from "zod"
|
|||
|
||||
const semver = z.string().regex(/^\d+\.\d+\.\d+$/)
|
||||
const sha256 = z.string().regex(/^[a-f0-9]{64}$/)
|
||||
const otaPlatformSchema = z.enum(["ios", "android", "macos", "windows", "linux"])
|
||||
|
||||
const assetSchema = z.object({
|
||||
path: z.string().min(1),
|
||||
|
|
@ -15,6 +14,16 @@ const platformSchema = z.object({
|
|||
assets: z.array(assetSchema),
|
||||
})
|
||||
|
||||
const platformsSchema = z
|
||||
.object({
|
||||
ios: platformSchema.optional(),
|
||||
android: platformSchema.optional(),
|
||||
macos: platformSchema.optional(),
|
||||
windows: platformSchema.optional(),
|
||||
linux: platformSchema.optional(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
export const otaReleaseSchema = z.object({
|
||||
schemaVersion: z.literal(1),
|
||||
product: z.enum(["mobile", "desktop"]),
|
||||
|
|
@ -32,5 +41,5 @@ export const otaReleaseSchema = z.object({
|
|||
minSupportedBinaryVersion: semver,
|
||||
message: z.string().nullable(),
|
||||
}),
|
||||
platforms: z.record(otaPlatformSchema, platformSchema.optional()),
|
||||
platforms: platformsSchema,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -37,6 +37,24 @@
|
|||
"dev": {
|
||||
"name": "folo-ota-dev",
|
||||
"workers_dev": true,
|
||||
"kv_namespaces": [
|
||||
{
|
||||
"binding": "OTA_KV",
|
||||
"id": "REPLACE_WITH_DEV_KV_ID",
|
||||
"preview_id": "REPLACE_WITH_DEV_PREVIEW_KV_ID",
|
||||
},
|
||||
],
|
||||
"r2_buckets": [
|
||||
{
|
||||
"binding": "OTA_BUCKET",
|
||||
"bucket_name": "REPLACE_WITH_DEV_BUCKET_NAME",
|
||||
},
|
||||
],
|
||||
"vars": {
|
||||
"GITHUB_OWNER": "RSSNext",
|
||||
"GITHUB_REPO": "Folo",
|
||||
"OTA_SYNC_TOKEN_HEADER": "x-ota-sync-token",
|
||||
},
|
||||
"routes": [
|
||||
{
|
||||
"pattern": "ota.dev.folo.is/*",
|
||||
|
|
|
|||
Loading…
Reference in New Issue