Skip to content

Commit

Permalink
Update according to new schema
Browse files Browse the repository at this point in the history
  • Loading branch information
HuakunShen committed May 28, 2024
1 parent a01462d commit ebe2151
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 43 deletions.
21 changes: 11 additions & 10 deletions ci/build-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,15 @@ for (const buildResult of buildResults) {
.from("extensions")
.select("*")
.eq("identifier", buildResult.pkg.jarvis.identifier);

if (!extFetchDBResult.data || extFetchDBResult.data.length === 0) {
await supabase
.from("extensions")
.insert([
{
name: buildResult.pkg.name,
description: buildResult.pkg.jarvis.description,
short_description: buildResult.pkg.jarvis.short_description,
long_description: buildResult.pkg.jarvis.long_description,
identifier: buildResult.pkg.jarvis.identifier,
readme: readme,
downloads: 0,
Expand All @@ -139,25 +141,24 @@ for (const buildResult of buildResults) {
.map((p) => join(buildResult.extPath, p))
.filter((p) => fs.existsSync(p));
const demoImgsDBPaths = await Promise.all(demoImgPaths.map((p) => uploadImage(p))); // file storage paths
const icon = buildResult.pkg.jarvis.icon;
let iconUrl: string | null = null;
const pkgIcon = buildResult.pkg.jarvis.icon;
const iconClone = { ...pkgIcon };
if (buildResult.pkg.jarvis.icon.type === "asset") {
const iconPath = join(buildResult.extPath, icon.icon);
const iconPath = join(buildResult.extPath, pkgIcon.icon);
if (fs.existsSync(iconPath)) {
} else {
console.error(`Icon file not found: ${iconPath}`);
}

iconUrl = await uploadImage(iconPath);
} else if (icon.type === "remote-url") {
iconUrl = icon.icon;
iconClone.icon = await uploadImage(iconPath);
}
/* ---------- Update README, icon, description in extensions table ---------- */
await supabase
.from("extensions")
.update({
description: buildResult.pkg.jarvis.description,
icon: iconUrl,
name: buildResult.pkg.jarvis.name,
short_description: buildResult.pkg.jarvis.short_description,
long_description: buildResult.pkg.jarvis.long_description,
icon: iconClone,
readme,
})
.eq("identifier", buildResult.pkg.jarvis.identifier)
Expand Down
2 changes: 1 addition & 1 deletion ci/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@aws-sdk/client-s3": "^3.583.0",
"@supabase/supabase-js": "^2.43.4",
"jarvis-api": "0.0.2-alpha.4",
"jarvis-api": "0.0.2-alpha.5",
"sharp": "^0.33.4",
"zod": "^3.23.8"
}
Expand Down
15 changes: 9 additions & 6 deletions ci/supabase/types/supabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,30 +83,33 @@ export type Database = {
extensions: {
Row: {
created_at: string
description: string
downloads: number
icon: string | null
icon: Json | null
identifier: string
long_description: string | null
name: string
readme: string | null
short_description: string
}
Insert: {
created_at?: string
description: string
downloads: number
icon?: string | null
icon?: Json | null
identifier: string
long_description?: string | null
name: string
readme?: string | null
short_description: string
}
Update: {
created_at?: string
description?: string
downloads?: number
icon?: string | null
icon?: Json | null
identifier?: string
long_description?: string | null
name?: string
readme?: string | null
short_description?: string
}
Relationships: []
}
Expand Down
39 changes: 20 additions & 19 deletions extensions/download-twitter-video/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,33 @@
"type": "module",
"jarvis": {
"name": "Download Twitter Video",
"description": "Download Twitter Video",
"short_description": "Download Twitter Video",
"long_description": "Prodivde a Tweet URL, the video in the given tweet will be downloaded for you",
"identifier": "tech.huakun.jarvis-ext-twitter-download-video",
"demoImages": [
"./demo/download-twitter.png"
],
"icon": {
"type": "iconify",
"icon": "skill-icons:twitter"
"type": "iconify",
"icon": "skill-icons:twitter"
},
"uiCmds": [
{
"main": "dist",
"name": "Download Twitter Video",
"devMain": "http://localhost:5173",
"window": {
"titleBarStyle": "overlay",
"width": 700,
"height": 300
},
"cmds": [
{
"type": "text",
"value": "twitter"
}
]
}
{
"main": "dist",
"name": "Download Twitter Video",
"devMain": "http://localhost:5173",
"window": {
"titleBarStyle": "overlay",
"width": 700,
"height": 300
},
"cmds": [
{
"type": "text",
"value": "twitter"
}
]
}
]
},
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion extensions/ip-info/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
},
"jarvis": {
"name": "IP Info",
"description": "Show your current IP Info and Search for IP Address",
"short_description": "Show your current IP Info and Search for IP Address",
"long_description": "Will display you IP Address and more information about this IP address, including Geo Location, ASN, ISP. You can also search for a specific IP.",
"identifier": "tech.huakun.jarvis-ext-ip-info",
"demoImages": [
"./demo/ip-info.png"
Expand Down
4 changes: 3 additions & 1 deletion extensions/jwt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"description": "JWT Inspector",
"jarvis": {
"name": "JWT Inspector",
"description": "Inspect JWT Token",
"short_description": "Inspect JWT Token",
"long_description": "Same as jwt.io; Display decoded JWT Token.",
"identifier": "tech.huakun.jarvis-jwt-inspector",
"demoImages": [
"./demo/jwt-view.png",
Expand Down Expand Up @@ -37,6 +38,7 @@
{
"main": "dist/search.html",
"name": "Search Decoded JWT",
"description": "Decode JWT and display in a list.",
"devMain": "http://localhost:5173/search",
"window": {
"width": 800,
Expand Down
3 changes: 2 additions & 1 deletion extensions/qrcode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"description": "Jarvis QRCode Extension",
"jarvis": {
"name": "QRCode",
"description": "Generate QRCode from text and Detect QRCode from Screenshot",
"short_description": "Generate QRCode from text and Detect QRCode",
"long_description": "Copy a url or any text and open the QRCode generation command, a QRCode will be displayed. Also supports detecting QRCode from screenshot.",
"identifier": "tech.huakun.jarvis-qrcode-ext",
"demoImages": [
"./demo/gen-qrcode.png"
Expand Down
8 changes: 4 additions & 4 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 ebe2151

Please sign in to comment.