mirror of
https://github.com/kunkunsh/kunkun.git
synced 2025-04-11 17:29:44 +00:00
fix: handle optional metadata in getInstallExtras for improved extension installation
This commit is contained in:
parent
7e811440b8
commit
f78403eeb6
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kksh/desktop",
|
"name": "@kksh/desktop",
|
||||||
"version": "0.1.14",
|
"version": "0.1.15",
|
||||||
"description": "",
|
"description": "",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -2,13 +2,13 @@ import type { Tables } from "@kksh/api/supabase/types"
|
|||||||
import type { ExtPublishMetadata } from "@kksh/supabase/models"
|
import type { ExtPublishMetadata } from "@kksh/supabase/models"
|
||||||
|
|
||||||
export async function getInstallExtras(
|
export async function getInstallExtras(
|
||||||
ext: Tables<"ext_publish"> & { metadata: ExtPublishMetadata }
|
ext: Tables<"ext_publish"> & { metadata?: ExtPublishMetadata }
|
||||||
): Promise<{ overwritePackageJson?: string }> {
|
): Promise<{ overwritePackageJson?: string }> {
|
||||||
const extras: { overwritePackageJson?: string } = {}
|
const extras: { overwritePackageJson?: string } = {}
|
||||||
if (ext.metadata.sourceType) {
|
if (ext.metadata?.sourceType) {
|
||||||
if (ext.metadata.sourceType === "jsr") {
|
if (ext.metadata?.sourceType === "jsr") {
|
||||||
if (ext.metadata.source) {
|
if (ext.metadata?.source) {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${ext.metadata.source}/package.json`)
|
const res = await fetch(`${ext.metadata.source}/package.json`)
|
||||||
const pkgJsonContent = await res.text()
|
const pkgJsonContent = await res.text()
|
||||||
extras.overwritePackageJson = pkgJsonContent
|
extras.overwritePackageJson = pkgJsonContent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user