Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update SolidStart example #984

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions examples/minimal-solidstart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@
"private": true,
"scripts": {
"dev": "NODE_ENV=development vinxi dev",
"clean": "git clean -xdf .solid node_modules",
"build": "vinxi build",
"start": "vinxi start"
"start": "vinxi start",
"version": "vinxi version",
"clean": "git clean -xdf .solid node_modules"
},
"dependencies": {
"@solidjs/meta": "^0.29.3",
"@solidjs/router": "^0.12.4",
"@solidjs/start": "^0.6.0",
"@uploadthing/solid": "7.0.2",
"solid-js": "^1.8.15",
"uploadthing": "7.0.2",
"vinxi": "0.3.11"
},
"devDependencies": {
"@types/node": "^20.14.0",
"postcss": "8.4.38",
"tailwindcss": "^3.4.1",
"typescript": "^5.5.2"
"@solidjs/meta": "^0.29.4",
"@solidjs/router": "^0.14.5",
"@solidjs/start": "^1.0.6",
"@uploadthing/solid": "^7.0.2",
"solid-js": "^1.8.23",
"uploadthing": "^7.0.2",
"vinxi": "^0.4.3"
}
}
5 changes: 0 additions & 5 deletions examples/minimal-solidstart/postcss.config.cjs

This file was deleted.

10 changes: 3 additions & 7 deletions examples/minimal-solidstart/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
// @refresh reload
import "./global.css";

import { MetaProvider, Title } from "@solidjs/meta";
import { MetaProvider } from "@solidjs/meta";
import { Router } from "@solidjs/router";
import { FileRoutes } from "@solidjs/start";
import { FileRoutes } from "@solidjs/start/router";
import { Suspense } from "solid-js";

import { generateUploadButton } from "@uploadthing/solid";
import "@uploadthing/solid/styles.css";

export default function App() {
return (
<Router
root={(props) => (
<MetaProvider>
<Title>SolidStart - Basic</Title>
<Suspense>{props.children}</Suspense>
</MetaProvider>
)}
Expand Down
1 change: 1 addition & 0 deletions examples/minimal-solidstart/src/entry-client.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @refresh reload
import { mount, StartClient } from "@solidjs/start/client";

mount(() => <StartClient />, document.getElementById("app")!);
2 changes: 1 addition & 1 deletion examples/minimal-solidstart/src/entry-server.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @refresh reload
import { createHandler, StartServer } from "@solidjs/start/server";

export default createHandler(() => (
Expand All @@ -7,7 +8,6 @@ export default createHandler(() => (
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
{assets}
</head>
<body>
Expand Down
3 changes: 0 additions & 3 deletions examples/minimal-solidstart/src/global.css

This file was deleted.

6 changes: 5 additions & 1 deletion examples/minimal-solidstart/src/routes/api/uploadthing.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import type { APIEvent } from "@solidjs/start/server";

import { createRouteHandler } from "uploadthing/server";

import { uploadRouter } from "~/server/uploadthing";

const handler = createRouteHandler({
router: uploadRouter,
});
export { handler as GET, handler as POST };

export const GET = (event: APIEvent) => handler(event.request);
export const POST = (event: APIEvent) => handler(event.request);
24 changes: 17 additions & 7 deletions examples/minimal-solidstart/src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ export default function Home() {
/**
* @see https://docs.uploadthing.com/api-reference/react#useuploadthing
*/
onClientUploadComplete: () => {
onUploadBegin: (fileName) => {
console.log("onUploadBegin", fileName);
},
onClientUploadComplete: (res) => {
console.log(`onClientUploadComplete`, res);
alert("Upload Completed");
},
});
Expand All @@ -21,26 +25,32 @@ export default function Home() {
* @see https://docs.uploadthing.com/api-reference/react#uploadbutton
*/
endpoint="videoAndImage"
onUploadBegin={(fileName) => {
console.log("onUploadBegin", fileName);
}}
onUploadAborted={() => {
alert("Upload Aborted");
}}
onClientUploadComplete={(res) => {
console.log(`onClientUploadComplete`, res);
alert("Upload Completed");
}}
onUploadBegin={() => {
console.log("upload begin");
}}
/>
<UploadDropzone
/**
* @see https://docs.uploadthing.com/api-reference/react#uploaddropzone
*/
endpoint="videoAndImage"
onUploadBegin={(fileName) => {
console.log("onUploadBegin", fileName);
}}
onUploadAborted={() => {
alert("Upload Aborted");
}}
onClientUploadComplete={(res) => {
console.log(`onClientUploadComplete`, res);
alert("Upload Completed");
}}
onUploadBegin={() => {
console.log("upload begin");
}}
/>
<input
type="file"
Expand Down
2 changes: 1 addition & 1 deletion examples/minimal-solidstart/src/server/uploadthing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ export const uploadRouter = {
}),
} satisfies FileRouter;

export type OurFileRouter = typeof uploadRouter;
export type UploadRouter = typeof uploadRouter;
8 changes: 4 additions & 4 deletions examples/minimal-solidstart/src/utils/uploadthing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
generateUploadDropzone,
} from "@uploadthing/solid";

import { OurFileRouter } from "~/server/uploadthing";
import { UploadRouter } from "~/server/uploadthing";

const initOpts = {
/**
Expand All @@ -13,7 +13,7 @@ const initOpts = {
url: "http://localhost:3000",
};

export const UploadButton = generateUploadButton<OurFileRouter>(initOpts);
export const UploadDropzone = generateUploadDropzone<OurFileRouter>(initOpts);
export const UploadButton = generateUploadButton<UploadRouter>(initOpts);
export const UploadDropzone = generateUploadDropzone<UploadRouter>(initOpts);
export const { createUploadThing } =
generateSolidHelpers<OurFileRouter>(initOpts);
generateSolidHelpers<UploadRouter>(initOpts);
5 changes: 0 additions & 5 deletions examples/minimal-solidstart/tailwind.config.ts

This file was deleted.

4 changes: 2 additions & 2 deletions examples/minimal-solidstart/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"moduleResolution": "Bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"allowJs": true,
"strict": true,
"noEmit": true,
"types": ["vinxi/client"],
"types": ["vinxi/types/client"],
"isolatedModules": true,
"paths": {
"~/*": ["./src/*"]
Expand Down
Loading
Loading