Skip to content

Commit

Permalink
Add @types/semver and fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
proudparrot2 committed Sep 18, 2024
1 parent b322653 commit 7e240e8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.2",
"@types/semver": "^7.5.8",
"autoprefixer": "^10.4.19",
"browser-fs-access": "^0.35.0",
"class-variance-authority": "^0.7.0",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/lib/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import store from "store2"
import { toast } from "sonner"
import { atom } from "nanostores"
import type { Plugin } from "./types"
import { createSDK } from "./sdk"
import { SDK } from "./sdk"

store.set("savedPlugins", [], false)
store.set("disabledPlugins", [], false)
Expand All @@ -12,7 +12,7 @@ export const $plugins = atom<Plugin[]>([])
export function readyEvent() {
$plugins.get().forEach((plugin) => {
if (!plugin.onReady) return
plugin.onReady(createSDK(plugin.id))
plugin.onReady({ sdk: new SDK(plugin.id) })
})
}

Expand Down Expand Up @@ -119,7 +119,7 @@ export function registerPlugin(plugin: Plugin): Plugin | undefined | void {
$plugins.set([...$plugins.get(), plugin])
console.log(plugin)

if (plugin.onReady) plugin.onReady(createSDK(plugin.id))
if (plugin.onReady) plugin.onReady({ sdk: new SDK(plugin.id) })
return plugin
}

Expand Down
21 changes: 10 additions & 11 deletions src/lib/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { atom } from "nanostores"
import { $plugins } from "./plugins"

interface Setting {
pluginId: string
id: string
name: string
}
// interface Setting {
// pluginId: string
// id: string
// name: string
// }

interface ExposedFunction {
pluginId: string
fnName: string
fn: Function
}
// interface ExposedFunction {
// pluginId: string
// fnName: string
// fn: Function
// }

export class SDK {
private id: string
Expand Down
3 changes: 2 additions & 1 deletion src/routes/home.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { $plugins } from "@/lib/plugins"
import { SDK } from "@/lib/sdk"
import { useStore } from "@nanostores/react"

export default function Home() {
Expand All @@ -18,7 +19,7 @@ export default function Home() {
<CardTitle>{plugin.name}</CardTitle>
</CardHeader>
<CardContent>
<plugin.tile />
<plugin.tile sdk={new SDK(plugin.id)} />
</CardContent>
</Card>
)
Expand Down
4 changes: 2 additions & 2 deletions src/routes/pluginrouter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { $plugins } from "@/lib/plugins"
import { createSDK } from "@/lib/sdk"
import { SDK } from "@/lib/sdk"
import { useStore } from "@nanostores/react"
import { useParams } from "react-router-dom"

Expand All @@ -20,7 +20,7 @@ export default function PluginRouter() {

return (
<div className="h-screen w-[calc(100vw-4rem)] overflow-auto">
<selectedPlugin.page sdk={createSDK(selectedPlugin.id)} />
<selectedPlugin.page sdk={new SDK(selectedPlugin.id)} />
</div>
)
}

0 comments on commit 7e240e8

Please sign in to comment.