0pflow 0.1.0-dev.00aaa03 → 0.1.0-dev.06e289c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.d.ts +5 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +26 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/install.d.ts +13 -4
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +93 -71
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/mcp/config.d.ts +0 -1
- package/dist/cli/mcp/config.d.ts.map +1 -1
- package/dist/cli/mcp/config.js +2 -4
- package/dist/cli/mcp/config.js.map +1 -1
- package/dist/cli/mcp/tools/createApp.d.ts.map +1 -1
- package/dist/cli/mcp/tools/createApp.js +6 -6
- package/dist/cli/mcp/tools/createApp.js.map +1 -1
- package/dist/cli/mcp/tools/setupAppSchema.d.ts.map +1 -1
- package/dist/cli/mcp/tools/setupAppSchema.js +5 -2
- package/dist/cli/mcp/tools/setupAppSchema.js.map +1 -1
- package/package.json +3 -2
- package/templates/app/.env.example +13 -0
- package/templates/app/README.md +29 -0
- package/templates/app/biome.jsonc +81 -0
- package/templates/app/drizzle.config.ts +12 -0
- package/templates/app/next.config.js +10 -0
- package/templates/app/package.json +52 -0
- package/templates/app/postcss.config.js +5 -0
- package/templates/app/public/favicon.ico +0 -0
- package/templates/app/src/app/_components/.gitkeep +0 -0
- package/templates/app/src/app/api/trpc/[trpc]/route.ts +34 -0
- package/templates/app/src/app/layout.tsx +29 -0
- package/templates/app/src/app/page.tsx +18 -0
- package/templates/app/src/env.js +46 -0
- package/templates/app/src/server/api/root.ts +21 -0
- package/templates/app/src/server/api/routers/.gitkeep +0 -0
- package/templates/app/src/server/api/trpc.ts +106 -0
- package/templates/app/src/server/db/index.ts +18 -0
- package/templates/app/src/server/db/schema.ts +14 -0
- package/templates/app/src/styles/globals.css +6 -0
- package/templates/app/src/styles/globals.css.orange +126 -0
- package/templates/app/src/trpc/query-client.ts +25 -0
- package/templates/app/src/trpc/react.tsx +78 -0
- package/templates/app/src/trpc/server.ts +30 -0
- package/templates/app/tsconfig.check.json +23 -0
- package/templates/app/tsconfig.json +42 -0
- package/templates/app/tsconfig.server.json +5 -0
- package/templates/app/tsconfig.test.json +21 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "tw-animate-css";
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
@theme {
|
|
7
|
+
--font-sans: var(--font-geist-sans), ui-sans-serif, system-ui, sans-serif,
|
|
8
|
+
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@theme inline {
|
|
12
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
13
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
14
|
+
--radius-lg: var(--radius);
|
|
15
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
16
|
+
--color-background: var(--background);
|
|
17
|
+
--color-foreground: var(--foreground);
|
|
18
|
+
--color-card: var(--card);
|
|
19
|
+
--color-card-foreground: var(--card-foreground);
|
|
20
|
+
--color-popover: var(--popover);
|
|
21
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
22
|
+
--color-primary: var(--primary);
|
|
23
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
24
|
+
--color-secondary: var(--secondary);
|
|
25
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
26
|
+
--color-muted: var(--muted);
|
|
27
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
28
|
+
--color-accent: var(--accent);
|
|
29
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
30
|
+
--color-destructive: var(--destructive);
|
|
31
|
+
--color-border: var(--border);
|
|
32
|
+
--color-input: var(--input);
|
|
33
|
+
--color-ring: var(--ring);
|
|
34
|
+
--color-chart-1: var(--chart-1);
|
|
35
|
+
--color-chart-2: var(--chart-2);
|
|
36
|
+
--color-chart-3: var(--chart-3);
|
|
37
|
+
--color-chart-4: var(--chart-4);
|
|
38
|
+
--color-chart-5: var(--chart-5);
|
|
39
|
+
--color-sidebar: var(--sidebar);
|
|
40
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
41
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
42
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
43
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
44
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
45
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
46
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:root {
|
|
50
|
+
--radius: 0.65rem;
|
|
51
|
+
--background: oklch(1 0 0);
|
|
52
|
+
--foreground: oklch(0.141 0.005 285.823);
|
|
53
|
+
--card: oklch(1 0 0);
|
|
54
|
+
--card-foreground: oklch(0.141 0.005 285.823);
|
|
55
|
+
--popover: oklch(1 0 0);
|
|
56
|
+
--popover-foreground: oklch(0.141 0.005 285.823);
|
|
57
|
+
--primary: oklch(0.646 0.222 41.116);
|
|
58
|
+
--primary-foreground: oklch(0.98 0.016 73.684);
|
|
59
|
+
--secondary: oklch(0.967 0.001 286.375);
|
|
60
|
+
--secondary-foreground: oklch(0.21 0.006 285.885);
|
|
61
|
+
--muted: oklch(0.967 0.001 286.375);
|
|
62
|
+
--muted-foreground: oklch(0.552 0.016 285.938);
|
|
63
|
+
--accent: oklch(0.967 0.001 286.375);
|
|
64
|
+
--accent-foreground: oklch(0.21 0.006 285.885);
|
|
65
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
66
|
+
--border: oklch(0.92 0.004 286.32);
|
|
67
|
+
--input: oklch(0.92 0.004 286.32);
|
|
68
|
+
--ring: oklch(0.75 0.183 55.934);
|
|
69
|
+
--chart-1: oklch(0.837 0.128 66.29);
|
|
70
|
+
--chart-2: oklch(0.705 0.213 47.604);
|
|
71
|
+
--chart-3: oklch(0.646 0.222 41.116);
|
|
72
|
+
--chart-4: oklch(0.553 0.195 38.402);
|
|
73
|
+
--chart-5: oklch(0.47 0.157 37.304);
|
|
74
|
+
--sidebar: oklch(0.985 0 0);
|
|
75
|
+
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
|
76
|
+
--sidebar-primary: oklch(0.646 0.222 41.116);
|
|
77
|
+
--sidebar-primary-foreground: oklch(0.98 0.016 73.684);
|
|
78
|
+
--sidebar-accent: oklch(0.967 0.001 286.375);
|
|
79
|
+
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
|
80
|
+
--sidebar-border: oklch(0.92 0.004 286.32);
|
|
81
|
+
--sidebar-ring: oklch(0.75 0.183 55.934);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.dark {
|
|
85
|
+
--background: oklch(0.141 0.005 285.823);
|
|
86
|
+
--foreground: oklch(0.985 0 0);
|
|
87
|
+
--card: oklch(0.21 0.006 285.885);
|
|
88
|
+
--card-foreground: oklch(0.985 0 0);
|
|
89
|
+
--popover: oklch(0.21 0.006 285.885);
|
|
90
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
91
|
+
--primary: oklch(0.705 0.213 47.604);
|
|
92
|
+
--primary-foreground: oklch(0.98 0.016 73.684);
|
|
93
|
+
--secondary: oklch(0.274 0.006 286.033);
|
|
94
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
95
|
+
--muted: oklch(0.274 0.006 286.033);
|
|
96
|
+
--muted-foreground: oklch(0.705 0.015 286.067);
|
|
97
|
+
--accent: oklch(0.274 0.006 286.033);
|
|
98
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
99
|
+
--destructive: oklch(0.704 0.191 22.216);
|
|
100
|
+
--border: oklch(1 0 0 / 10%);
|
|
101
|
+
--input: oklch(1 0 0 / 15%);
|
|
102
|
+
--ring: oklch(0.408 0.123 38.172);
|
|
103
|
+
--chart-1: oklch(0.837 0.128 66.29);
|
|
104
|
+
--chart-2: oklch(0.705 0.213 47.604);
|
|
105
|
+
--chart-3: oklch(0.646 0.222 41.116);
|
|
106
|
+
--chart-4: oklch(0.553 0.195 38.402);
|
|
107
|
+
--chart-5: oklch(0.47 0.157 37.304);
|
|
108
|
+
--sidebar: oklch(0.21 0.006 285.885);
|
|
109
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
110
|
+
--sidebar-primary: oklch(0.705 0.213 47.604);
|
|
111
|
+
--sidebar-primary-foreground: oklch(0.98 0.016 73.684);
|
|
112
|
+
--sidebar-accent: oklch(0.274 0.006 286.033);
|
|
113
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
114
|
+
--sidebar-border: oklch(1 0 0 / 10%);
|
|
115
|
+
--sidebar-ring: oklch(0.408 0.123 38.172);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@layer base {
|
|
119
|
+
* {
|
|
120
|
+
@apply border-border outline-ring/50;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
body {
|
|
124
|
+
@apply bg-background text-foreground;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultShouldDehydrateQuery,
|
|
3
|
+
QueryClient,
|
|
4
|
+
} from "@tanstack/react-query";
|
|
5
|
+
import SuperJSON from "superjson";
|
|
6
|
+
|
|
7
|
+
export const createQueryClient = () =>
|
|
8
|
+
new QueryClient({
|
|
9
|
+
defaultOptions: {
|
|
10
|
+
queries: {
|
|
11
|
+
// With SSR, we usually want to set some default staleTime
|
|
12
|
+
// above 0 to avoid refetching immediately on the client
|
|
13
|
+
staleTime: 30 * 1000,
|
|
14
|
+
},
|
|
15
|
+
dehydrate: {
|
|
16
|
+
serializeData: SuperJSON.serialize,
|
|
17
|
+
shouldDehydrateQuery: (query) =>
|
|
18
|
+
defaultShouldDehydrateQuery(query) ||
|
|
19
|
+
query.state.status === "pending",
|
|
20
|
+
},
|
|
21
|
+
hydrate: {
|
|
22
|
+
deserializeData: SuperJSON.deserialize,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { QueryClientProvider, type QueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { httpBatchStreamLink, loggerLink } from "@trpc/client";
|
|
5
|
+
import { createTRPCReact } from "@trpc/react-query";
|
|
6
|
+
import { type inferRouterInputs, type inferRouterOutputs } from "@trpc/server";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import SuperJSON from "superjson";
|
|
9
|
+
|
|
10
|
+
import { type AppRouter } from "~/server/api/root";
|
|
11
|
+
import { createQueryClient } from "./query-client";
|
|
12
|
+
|
|
13
|
+
let clientQueryClientSingleton: QueryClient | undefined = undefined;
|
|
14
|
+
const getQueryClient = () => {
|
|
15
|
+
if (typeof window === "undefined") {
|
|
16
|
+
// Server: always make a new query client
|
|
17
|
+
return createQueryClient();
|
|
18
|
+
}
|
|
19
|
+
// Browser: use singleton pattern to keep the same query client
|
|
20
|
+
clientQueryClientSingleton ??= createQueryClient();
|
|
21
|
+
|
|
22
|
+
return clientQueryClientSingleton;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const api = createTRPCReact<AppRouter>();
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Inference helper for inputs.
|
|
29
|
+
*
|
|
30
|
+
* @example type HelloInput = RouterInputs['example']['hello']
|
|
31
|
+
*/
|
|
32
|
+
export type RouterInputs = inferRouterInputs<AppRouter>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Inference helper for outputs.
|
|
36
|
+
*
|
|
37
|
+
* @example type HelloOutput = RouterOutputs['example']['hello']
|
|
38
|
+
*/
|
|
39
|
+
export type RouterOutputs = inferRouterOutputs<AppRouter>;
|
|
40
|
+
|
|
41
|
+
export function TRPCReactProvider(props: { children: React.ReactNode }) {
|
|
42
|
+
const queryClient = getQueryClient();
|
|
43
|
+
|
|
44
|
+
const [trpcClient] = useState(() =>
|
|
45
|
+
api.createClient({
|
|
46
|
+
links: [
|
|
47
|
+
loggerLink({
|
|
48
|
+
enabled: (op) =>
|
|
49
|
+
process.env.NODE_ENV === "development" ||
|
|
50
|
+
(op.direction === "down" && op.result instanceof Error),
|
|
51
|
+
}),
|
|
52
|
+
httpBatchStreamLink({
|
|
53
|
+
transformer: SuperJSON,
|
|
54
|
+
url: `${getBaseUrl()}/api/trpc`,
|
|
55
|
+
headers: () => {
|
|
56
|
+
const headers = new Headers();
|
|
57
|
+
headers.set("x-trpc-source", "nextjs-react");
|
|
58
|
+
return headers;
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
],
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<QueryClientProvider client={queryClient}>
|
|
67
|
+
<api.Provider client={trpcClient} queryClient={queryClient}>
|
|
68
|
+
{props.children}
|
|
69
|
+
</api.Provider>
|
|
70
|
+
</QueryClientProvider>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function getBaseUrl() {
|
|
75
|
+
if (typeof window !== "undefined") return window.location.origin;
|
|
76
|
+
if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`;
|
|
77
|
+
return `http://localhost:${process.env.PORT ?? 3000}`;
|
|
78
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
|
|
3
|
+
import { createHydrationHelpers } from "@trpc/react-query/rsc";
|
|
4
|
+
import { headers } from "next/headers";
|
|
5
|
+
import { cache } from "react";
|
|
6
|
+
|
|
7
|
+
import { createCaller, type AppRouter } from "~/server/api/root";
|
|
8
|
+
import { createTRPCContext } from "~/server/api/trpc";
|
|
9
|
+
import { createQueryClient } from "./query-client";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when
|
|
13
|
+
* handling a tRPC call from a React Server Component.
|
|
14
|
+
*/
|
|
15
|
+
const createContext = cache(async () => {
|
|
16
|
+
const heads = new Headers(await headers());
|
|
17
|
+
heads.set("x-trpc-source", "rsc");
|
|
18
|
+
|
|
19
|
+
return createTRPCContext({
|
|
20
|
+
headers: heads,
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const getQueryClient = cache(createQueryClient);
|
|
25
|
+
const caller = createCaller(createContext);
|
|
26
|
+
|
|
27
|
+
export const { trpc: api, HydrateClient } = createHydrationHelpers<AppRouter>(
|
|
28
|
+
caller,
|
|
29
|
+
getQueryClient
|
|
30
|
+
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"noUnusedLocals": true,
|
|
5
|
+
"noUnusedParameters": true,
|
|
6
|
+
"allowUnreachableCode": false,
|
|
7
|
+
"allowUnusedLabels": false
|
|
8
|
+
},
|
|
9
|
+
"exclude": [
|
|
10
|
+
"node_modules",
|
|
11
|
+
".next",
|
|
12
|
+
"dist",
|
|
13
|
+
"coverage",
|
|
14
|
+
"**/*.test.ts",
|
|
15
|
+
"**/*.test.tsx",
|
|
16
|
+
"**/*.spec.ts",
|
|
17
|
+
"**/*.spec.tsx",
|
|
18
|
+
"src/**/__tests__/**",
|
|
19
|
+
"tests/**",
|
|
20
|
+
"vitest.config.*",
|
|
21
|
+
"vitest.setup.*"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Base Options: */
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"target": "es2022",
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"moduleDetection": "force",
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"verbatimModuleSyntax": true,
|
|
12
|
+
|
|
13
|
+
/* Strictness */
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noUncheckedIndexedAccess": true,
|
|
16
|
+
"checkJs": true,
|
|
17
|
+
|
|
18
|
+
/* Bundled projects */
|
|
19
|
+
"lib": ["dom", "dom.iterable", "ES2022"],
|
|
20
|
+
"noEmit": true,
|
|
21
|
+
"module": "ESNext",
|
|
22
|
+
"moduleResolution": "Bundler",
|
|
23
|
+
"jsx": "preserve",
|
|
24
|
+
"plugins": [{ "name": "next" }],
|
|
25
|
+
"incremental": true,
|
|
26
|
+
|
|
27
|
+
/* Path Aliases */
|
|
28
|
+
"baseUrl": ".",
|
|
29
|
+
"paths": {
|
|
30
|
+
"~/*": ["./src/*"]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"include": [
|
|
34
|
+
"next-env.d.ts",
|
|
35
|
+
"**/*.ts",
|
|
36
|
+
"**/*.tsx",
|
|
37
|
+
"**/*.cjs",
|
|
38
|
+
"**/*.js",
|
|
39
|
+
".next/types/**/*.ts"
|
|
40
|
+
],
|
|
41
|
+
"exclude": ["node_modules", "generated"]
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"noUnusedLocals": true,
|
|
5
|
+
"noUnusedParameters": true,
|
|
6
|
+
"allowUnreachableCode": false,
|
|
7
|
+
},
|
|
8
|
+
"include": [
|
|
9
|
+
"**/*.test.ts",
|
|
10
|
+
"**/*.test.tsx",
|
|
11
|
+
"**/*.spec.ts",
|
|
12
|
+
"**/*.spec.tsx",
|
|
13
|
+
"src/**/__tests__/*.ts",
|
|
14
|
+
"src/**/__tests__/*.tsx",
|
|
15
|
+
"src/tests/**/*.ts",
|
|
16
|
+
"tests/**/*.ts",
|
|
17
|
+
"tests/**/*.tsx",
|
|
18
|
+
"vitest.config.*",
|
|
19
|
+
"vitest.setup.*"
|
|
20
|
+
]
|
|
21
|
+
}
|