-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use latest versions for everything
- Loading branch information
Showing
41 changed files
with
2,053 additions
and
633 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@solid-mediakit/auth': patch | ||
'@solid-mediakit/trpc': patch | ||
--- | ||
|
||
fix: use latest versions for everything |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import { defineConfig } from '@solidjs/start/config' | ||
|
||
export default defineConfig({ | ||
start: { | ||
ssr: true, | ||
}, | ||
ssr: true, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"extends": [ | ||
"plugin:solid/typescript", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"rules": { | ||
"@typescript-eslint/consistent-type-imports": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
dist | ||
.solid | ||
.output | ||
.vercel | ||
.netlify | ||
netlify | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
*.launch | ||
.settings/ | ||
|
||
# Temp | ||
gitignore | ||
|
||
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
This project was created using [Create JD App](https://github.com/OrJDev/create-jd-app) | ||
|
||
## Start Dev Server | ||
|
||
```bash | ||
pnpm dev | ||
``` | ||
|
||
This will start a dev server on port `3000` and will watch for changes. | ||
|
||
## Testing Production Build | ||
|
||
### Build | ||
|
||
```bash | ||
pnpm build | ||
``` | ||
|
||
### Start | ||
|
||
```bash | ||
pnpm start | ||
``` | ||
|
||
This will start a production server on port `3000`. | ||
|
||
### Enviroment Variables | ||
|
||
|
||
|
||
[Sponsor Create JD App](https://github.com/sponsors/OrJDev) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defineConfig } from '@solidjs/start/config' | ||
import prpc from '~/prpc/plugin' | ||
|
||
export default defineConfig({ | ||
ssr: true, | ||
vite: { | ||
plugins: [prpc({ log: true })], | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "dev-prpc", | ||
"private": true, | ||
"scripts": { | ||
"dev": "vinxi dev", | ||
"build": "vinxi build", | ||
"start": "vinxi start", | ||
"lint": "eslint --fix \"**/*.{ts,tsx,js,jsx}\"" | ||
}, | ||
"type": "module", | ||
"devDependencies": { | ||
"@types/node": "^18.14.0", | ||
"@typescript-eslint/eslint-plugin": "^5.52.0", | ||
"@typescript-eslint/parser": "^5.52.0", | ||
"autoprefixer": "^10.4.13", | ||
"eslint": "^8.34.0", | ||
"eslint-plugin-solid": "^0.9.4", | ||
"postcss": "^8.4.21", | ||
"tailwindcss": "^3.2.7", | ||
"typescript": "^4.9.5", | ||
"vite": "^5.1.6", | ||
"@types/babel__core": "^7.20.0", | ||
"@rollup/pluginutils": "^5.0.2" | ||
}, | ||
"dependencies": { | ||
"@solidjs/router": "^0.13.0", | ||
"@solidjs/start": "^0.7.4", | ||
"solid-js": "^1.8.15", | ||
"vinxi": "^0.3.10", | ||
"@solidjs/meta": "^0.29.3", | ||
"@tanstack/solid-query": "^5.28.5", | ||
"zod": "^3.22.4", | ||
"@babel/core": "^7.20.12", | ||
"@babel/preset-typescript": "^7.18.6" | ||
}, | ||
"engines": { | ||
"node": ">=16" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// @refresh reload | ||
import { MetaProvider, Title } from '@solidjs/meta' | ||
import { Router } from '@solidjs/router' | ||
import { FileRoutes } from '@solidjs/start/router' | ||
import { Suspense } from 'solid-js' | ||
import './app.css' | ||
import { QueryClientProvider, QueryClient } from '@tanstack/solid-query' | ||
|
||
export default function App() { | ||
const queryClient = new QueryClient() | ||
return ( | ||
<Router | ||
root={(props) => ( | ||
<MetaProvider> | ||
<Title>SolidStart - Basic</Title> | ||
<Suspense> | ||
<QueryClientProvider client={queryClient}> | ||
{props.children} | ||
</QueryClientProvider> | ||
</Suspense> | ||
</MetaProvider> | ||
)} | ||
> | ||
<FileRoutes /> | ||
</Router> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { mount, StartClient } from '@solidjs/start/client' | ||
|
||
mount(() => <StartClient />, document.getElementById('app')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { createHandler, StartServer } from '@solidjs/start/server' | ||
|
||
export default createHandler(() => ( | ||
<StartServer | ||
document={({ assets, children, scripts }) => ( | ||
<html lang='en'> | ||
<head> | ||
<meta charset='utf-8' /> | ||
<meta name='viewport' content='width=device-width, initial-scale=1' /> | ||
<link rel='icon' href='/favicon.ico' /> | ||
{assets} | ||
</head> | ||
<body> | ||
<div id='app'>{children}</div> | ||
{scripts} | ||
</body> | ||
</html> | ||
)} | ||
/> | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export const makeKey = ( | ||
type: 'query' | 'mutation', | ||
key: string, | ||
input?: any | ||
) => { | ||
if (type === 'mutation') { | ||
return ['prpc.mutation', key] | ||
} | ||
return ['prpc.query', key, input] | ||
} | ||
|
||
export const unwrapValue = (value: any) => { | ||
if (typeof value === 'function') { | ||
return { payload: value() } | ||
} | ||
return { payload: value } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { | ||
FunctionedParams, | ||
QueryKey, | ||
SolidMutationOptions, | ||
SolidQueryOptions, | ||
} from '@tanstack/solid-query' | ||
import type zod from 'zod' | ||
|
||
export type EmptySchema = void | undefined | ||
|
||
export type ExpectedSchema = zod.ZodSchema | EmptySchema | ||
|
||
export type Infer$PayLoad<ZObj extends ExpectedSchema> = | ||
ZObj extends zod.ZodSchema ? zod.infer<ZObj> : never | ||
|
||
export type ExpectedFn<ZObject = EmptySchema> = ZObject extends EmptySchema | ||
? (input: Fn$Input) => any | ||
: ZObject extends zod.ZodSchema | ||
? (input: Fn$Input<ZObject>) => any | ||
: (input: Fn$Input) => any | ||
|
||
export type Fn$Input<ZObj extends ExpectedSchema = EmptySchema> = { | ||
payload: Infer$PayLoad<ZObj> | ||
request$: Request | ||
} | ||
|
||
export type Fn$Output<Fn extends ExpectedFn> = ReturnType<Fn> extends Promise< | ||
infer T | ||
> | ||
? T | ||
: ReturnType<Fn> | ||
|
||
export type FCreateQueryOptions< | ||
TQueryFnData = unknown, | ||
TError = Error, | ||
TData = TQueryFnData, | ||
TQueryKey extends QueryKey = QueryKey | ||
> = FunctionedParams< | ||
OmitQueryData<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey>> | ||
> | ||
export type OmitQueryData<T> = Omit< | ||
T, | ||
'queryKey' | 'queryFn' | 'mutationFn' | 'mutationKey' | ||
> | ||
|
||
export type FCreateMutationOptions< | ||
TData = unknown, | ||
TError = Error, | ||
TVariables = void, | ||
TContext = unknown | ||
> = FunctionedParams< | ||
OmitQueryData<SolidMutationOptions<TData, TError, TVariables, TContext>> | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ZodSchema } from 'zod' | ||
|
||
export const validateZod = async <Schema extends ZodSchema>( | ||
payload: any, | ||
schema: Schema | ||
) => { | ||
const res = await schema.safeParseAsync( | ||
typeof payload === 'object' ? payload : JSON.parse(payload) | ||
) | ||
if (!res.success) { | ||
return error$(res.error.flatten()) | ||
} | ||
return res.data | ||
} | ||
|
||
export const error$ = (error: any, init?: ResponseInit): Response => { | ||
const headers = new Headers(init?.headers) | ||
headers.set('Content-Type', 'application/json') | ||
headers.set('X-Prpc-Error', '1') | ||
return new Response( | ||
JSON.stringify({ | ||
error: typeof error === 'string' ? { message: error } : error, | ||
}), | ||
{ | ||
status: init?.status ?? 400, | ||
headers, | ||
} | ||
) as any | ||
} |
Oops, something went wrong.