create-fate 1.5.2 → 1.6.0
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/README.md +1 -2
- package/bin/create-fate.mjs +14 -50
- package/package.json +1 -1
- package/templates/fate/README.md +1 -2
- package/templates/fate/_shared/vue-app/package.json +4 -3
- package/templates/fate/_shared/vue-app/vite.config.ts +18 -11
- package/templates/fate/drizzle/client/package.json +6 -6
- package/templates/fate/graphql/client/package.json +6 -6
- package/templates/fate/graphql/server/.gitignore +5 -0
- package/templates/fate/graphql/server/node_modules/.bin/esbuild +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/eslint +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/fate +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/intent +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/jiti +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/nft +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/nodemon +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/oxfmt +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/oxlint +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/prisma +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/prisma-json-types-generator +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/prisma-pothos-types +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/tsc +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/tsgolint +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/tsx +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/vitest +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/vp +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/vpr +22 -0
- package/templates/fate/graphql/server/node_modules/.bin/yaml +22 -0
- package/templates/fate/graphql-client/README.md +11 -1
- package/templates/fate/graphql-client/env.ts +6 -0
- package/templates/fate/graphql-client/package.json +6 -6
- package/templates/fate/http/client/package.json +6 -6
- package/templates/fate/prisma/client/package.json +6 -6
- package/templates/fate/void/README.md +12 -0
- package/templates/fate/void/db/migrations/20260918045815_legal_dragon_lord.sql +15 -0
- package/templates/fate/{cloudflare/server/db/migrations/meta/20260508073357_snapshot.json → void/db/migrations/meta/20260918045815_snapshot.json} +174 -124
- package/templates/fate/void/db/migrations/meta/_journal.json +7 -0
- package/templates/fate/void/package.json +6 -7
- package/templates/fate/cloudflare/.github/workflows/push.yml +0 -27
- package/templates/fate/cloudflare/.vite-hooks/pre-commit +0 -1
- package/templates/fate/cloudflare/.vscode/extensions.json +0 -12
- package/templates/fate/cloudflare/.vscode/settings.json +0 -25
- package/templates/fate/cloudflare/AGENTS.md +0 -55
- package/templates/fate/cloudflare/README.md +0 -137
- package/templates/fate/cloudflare/_gitignore +0 -20
- package/templates/fate/cloudflare/client/node_modules/.bin/browserslist +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/cf-wrangler +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/drizzle-kit +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/esbuild +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/fate +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/fbtee +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/intent +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/jiti +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/oxfmt +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/oxlint +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/rolldown +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/tsc +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/tsx +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/vitest +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/void +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/vp +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/vpr +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/workerd +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/wrangler +0 -22
- package/templates/fate/cloudflare/client/node_modules/.bin/wrangler2 +0 -22
- package/templates/fate/cloudflare/client/package.json +0 -62
- package/templates/fate/cloudflare/client/pages/index.tsx +0 -96
- package/templates/fate/cloudflare/client/pages/layout.tsx +0 -68
- package/templates/fate/cloudflare/client/pages/login.tsx +0 -107
- package/templates/fate/cloudflare/client/pages/post/[id].tsx +0 -22
- package/templates/fate/cloudflare/client/pages/search.tsx +0 -99
- package/templates/fate/cloudflare/client/public/icon.svg +0 -1
- package/templates/fate/cloudflare/client/src/App.css +0 -153
- package/templates/fate/cloudflare/client/src/lib/AvailableLanguages.tsx +0 -5
- package/templates/fate/cloudflare/client/src/lib/LocaleContext.tsx +0 -61
- package/templates/fate/cloudflare/client/src/lib/cx.tsx +0 -6
- package/templates/fate/cloudflare/client/src/lib/env.tsx +0 -5
- package/templates/fate/cloudflare/client/src/ui/Badge.tsx +0 -31
- package/templates/fate/cloudflare/client/src/ui/Button.tsx +0 -108
- package/templates/fate/cloudflare/client/src/ui/Card.tsx +0 -32
- package/templates/fate/cloudflare/client/src/ui/CommentCard.tsx +0 -75
- package/templates/fate/cloudflare/client/src/ui/Error.tsx +0 -19
- package/templates/fate/cloudflare/client/src/ui/H2.tsx +0 -15
- package/templates/fate/cloudflare/client/src/ui/H3.tsx +0 -20
- package/templates/fate/cloudflare/client/src/ui/Header.tsx +0 -98
- package/templates/fate/cloudflare/client/src/ui/Input.tsx +0 -17
- package/templates/fate/cloudflare/client/src/ui/Link.tsx +0 -11
- package/templates/fate/cloudflare/client/src/ui/LocaleSwitcher.tsx +0 -34
- package/templates/fate/cloudflare/client/src/ui/PostCard.tsx +0 -303
- package/templates/fate/cloudflare/client/src/ui/Section.tsx +0 -23
- package/templates/fate/cloudflare/client/src/ui/UserCard.tsx +0 -131
- package/templates/fate/cloudflare/client/src/user/AuthClient.tsx +0 -6
- package/templates/fate/cloudflare/client/start.mjs +0 -11
- package/templates/fate/cloudflare/client/translations/de-DE.json +0 -632
- package/templates/fate/cloudflare/client/translations/ja-JP.json +0 -632
- package/templates/fate/cloudflare/client/vite.config.ts +0 -41
- package/templates/fate/cloudflare/client/void.json +0 -29
- package/templates/fate/cloudflare/package.json +0 -42
- package/templates/fate/cloudflare/pnpm-workspace.yaml +0 -41
- package/templates/fate/cloudflare/server/.env.example +0 -1
- package/templates/fate/cloudflare/server/db/db.ts +0 -30
- package/templates/fate/cloudflare/server/db/migrations/20260508073357_initial_schema.sql +0 -134
- package/templates/fate/cloudflare/server/db/migrations/20260508120500_seed_cloudflare_demo.sql +0 -170
- package/templates/fate/cloudflare/server/db/migrations/meta/_journal.json +0 -20
- package/templates/fate/cloudflare/server/db/queries.ts +0 -211
- package/templates/fate/cloudflare/server/db/schema.ts +0 -331
- package/templates/fate/cloudflare/server/node_modules/.bin/cf-wrangler +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/drizzle-kit +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/esbuild +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/fate +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/intent +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/jiti +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/oxfmt +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/oxlint +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/tsc +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/tsx +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/vitest +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/vp +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/vpr +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/workerd +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/wrangler +0 -22
- package/templates/fate/cloudflare/server/node_modules/.bin/wrangler2 +0 -22
- package/templates/fate/cloudflare/server/package.json +0 -34
- package/templates/fate/cloudflare/server/src/fate/commentPermissions.ts +0 -17
- package/templates/fate/cloudflare/server/src/fate/context.ts +0 -15
- package/templates/fate/cloudflare/server/src/fate/live.ts +0 -7
- package/templates/fate/cloudflare/server/src/fate/server.ts +0 -414
- package/templates/fate/cloudflare/server/src/fate/views.ts +0 -164
- package/templates/fate/cloudflare/server/src/index.ts +0 -80
- package/templates/fate/cloudflare/server/src/lib/auth.ts +0 -64
- package/templates/fate/cloudflare/server/src/lib/origins.ts +0 -17
- package/templates/fate/cloudflare/server/src/router.ts +0 -2
- package/templates/fate/cloudflare/server/src/user/SessionUser.tsx +0 -17
- package/templates/fate/cloudflare/server/tsconfig.json +0 -10
- package/templates/fate/cloudflare/server/wrangler.jsonc +0 -29
- package/templates/fate/cloudflare/tsconfig.json +0 -24
- package/templates/fate/cloudflare/vite.config.ts +0 -75
- package/templates/fate/graphql-client/.env.example +0 -3
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { betterAuth } from 'better-auth';
|
|
2
|
-
import { drizzleAdapter } from 'better-auth/adapters/drizzle';
|
|
3
|
-
import { admin, username } from 'better-auth/plugins';
|
|
4
|
-
import { db } from '../../db/db.ts';
|
|
5
|
-
import schema from '../../db/schema.ts';
|
|
6
|
-
import { trustedOrigins } from './origins.ts';
|
|
7
|
-
|
|
8
|
-
const defaultSecret = 'fate-cloudflare-development-secret';
|
|
9
|
-
const betterAuthDefaultSecret = 'better-auth-secret-12345678901234567890';
|
|
10
|
-
|
|
11
|
-
const resolveSecret = (secret?: string) => {
|
|
12
|
-
const value =
|
|
13
|
-
secret ??
|
|
14
|
-
(globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env
|
|
15
|
-
?.BETTER_AUTH_SECRET;
|
|
16
|
-
|
|
17
|
-
return value && value !== betterAuthDefaultSecret ? value : defaultSecret;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const createAuthInstance = (baseURL: string, secret: string) =>
|
|
21
|
-
betterAuth({
|
|
22
|
-
advanced: {
|
|
23
|
-
database: {
|
|
24
|
-
generateId: false,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
basePath: '/api/auth',
|
|
28
|
-
baseURL,
|
|
29
|
-
database: drizzleAdapter(db, {
|
|
30
|
-
provider: 'sqlite',
|
|
31
|
-
schema,
|
|
32
|
-
}),
|
|
33
|
-
emailAndPassword: {
|
|
34
|
-
autoSignIn: true,
|
|
35
|
-
enabled: true,
|
|
36
|
-
maxPasswordLength: 128,
|
|
37
|
-
minPasswordLength: 8,
|
|
38
|
-
},
|
|
39
|
-
plugins: [admin(), username()],
|
|
40
|
-
secret,
|
|
41
|
-
session: {
|
|
42
|
-
cookieCache: {
|
|
43
|
-
enabled: true,
|
|
44
|
-
maxAge: 15 * 24 * 60 * 60,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
telemetry: { enabled: false },
|
|
48
|
-
trustedOrigins,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const authByBaseURL = new Map<string, ReturnType<typeof createAuthInstance>>();
|
|
52
|
-
|
|
53
|
-
export const createAuth = (baseURL = 'http://localhost:8787', secret?: string) => {
|
|
54
|
-
const resolvedSecret = resolveSecret(secret);
|
|
55
|
-
const cacheKey = `${baseURL}\0${resolvedSecret}`;
|
|
56
|
-
const existing = authByBaseURL.get(cacheKey);
|
|
57
|
-
if (existing) {
|
|
58
|
-
return existing;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const auth = createAuthInstance(baseURL, resolvedSecret);
|
|
62
|
-
authByBaseURL.set(cacheKey, auth);
|
|
63
|
-
return auth;
|
|
64
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const localDevOriginPattern = /^https?:\/\/(?:localhost|127\.0\.0\.1)(?::\d+)?$/;
|
|
2
|
-
|
|
3
|
-
export const clientOrigin = 'http://localhost:6001';
|
|
4
|
-
|
|
5
|
-
export const resolveCorsOrigin = (origin: string | null) => {
|
|
6
|
-
if (!origin) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if (origin === clientOrigin || localDevOriginPattern.test(origin)) {
|
|
11
|
-
return origin;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return null;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const trustedOrigins = [clientOrigin, 'http://localhost:*', 'http://127.0.0.1:*'];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { UserRow } from '../../db/schema.ts';
|
|
2
|
-
|
|
3
|
-
export type SessionUser = Pick<UserRow, 'role' | 'id' | 'username'>;
|
|
4
|
-
|
|
5
|
-
export function toSessionUser({
|
|
6
|
-
email,
|
|
7
|
-
id,
|
|
8
|
-
role,
|
|
9
|
-
username,
|
|
10
|
-
}: Readonly<{
|
|
11
|
-
email: string | null | undefined;
|
|
12
|
-
id: string;
|
|
13
|
-
role?: string | null | undefined;
|
|
14
|
-
username?: string | null | undefined;
|
|
15
|
-
}>): SessionUser {
|
|
16
|
-
return { id, role: role || '', username: username || email || '' };
|
|
17
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "node_modules/wrangler/config-schema.json",
|
|
3
|
-
"name": "fate-cloudflare",
|
|
4
|
-
"main": "src/index.ts",
|
|
5
|
-
"compatibility_date": "2026-06-05",
|
|
6
|
-
"compatibility_flags": ["nodejs_compat"],
|
|
7
|
-
"d1_databases": [
|
|
8
|
-
{
|
|
9
|
-
"binding": "DB",
|
|
10
|
-
"database_name": "fate-cloudflare",
|
|
11
|
-
"database_id": "00000000-0000-0000-0000-000000000000",
|
|
12
|
-
"migrations_dir": "db/migrations",
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
"durable_objects": {
|
|
16
|
-
"bindings": [
|
|
17
|
-
{
|
|
18
|
-
"name": "FATE_LIVE",
|
|
19
|
-
"class_name": "FateLiveDurableObject",
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
"migrations": [
|
|
24
|
-
{
|
|
25
|
-
"tag": "fate-live-v1",
|
|
26
|
-
"new_sqlite_classes": ["FateLiveDurableObject"],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"allowJs": true,
|
|
4
|
-
"allowImportingTsExtensions": true,
|
|
5
|
-
"esModuleInterop": true,
|
|
6
|
-
"forceConsistentCasingInFileNames": true,
|
|
7
|
-
"incremental": true,
|
|
8
|
-
"isolatedModules": true,
|
|
9
|
-
"jsx": "react-jsx",
|
|
10
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
11
|
-
"module": "nodenext",
|
|
12
|
-
"moduleResolution": "nodenext",
|
|
13
|
-
"noEmit": true,
|
|
14
|
-
"noImplicitOverride": true,
|
|
15
|
-
"noUnusedLocals": true,
|
|
16
|
-
"resolveJsonModule": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
|
-
"strict": true,
|
|
19
|
-
"target": "es2017",
|
|
20
|
-
"types": ["vite/client", "node"]
|
|
21
|
-
},
|
|
22
|
-
"exclude": ["**/.void/**/*.ts", "node_modules"],
|
|
23
|
-
"include": ["**/.fate/*.ts", "**/*.ts", "**/*.tsx"]
|
|
24
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
|
-
import nkzw from '@nkzw/oxlint-config';
|
|
3
|
-
import dotenv from 'dotenv';
|
|
4
|
-
import { defineConfig } from 'vite-plus';
|
|
5
|
-
|
|
6
|
-
const root = process.cwd();
|
|
7
|
-
|
|
8
|
-
dotenv.config({
|
|
9
|
-
path: join(root, './server', '.env'),
|
|
10
|
-
quiet: true,
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export default defineConfig({
|
|
14
|
-
fmt: {
|
|
15
|
-
experimentalSortImports: {
|
|
16
|
-
newlinesBetween: false,
|
|
17
|
-
},
|
|
18
|
-
experimentalSortPackageJson: {
|
|
19
|
-
sortScripts: true,
|
|
20
|
-
},
|
|
21
|
-
experimentalTailwindcss: {
|
|
22
|
-
stylesheet: 'client/src/App.css',
|
|
23
|
-
},
|
|
24
|
-
ignorePatterns: [
|
|
25
|
-
'coverage/',
|
|
26
|
-
'dist/',
|
|
27
|
-
'.fate/',
|
|
28
|
-
'client/dist/',
|
|
29
|
-
'client/src/translations/',
|
|
30
|
-
'server/dist/',
|
|
31
|
-
'server/.wrangler/',
|
|
32
|
-
'pnpm-lock.yaml',
|
|
33
|
-
],
|
|
34
|
-
singleQuote: true,
|
|
35
|
-
},
|
|
36
|
-
lint: {
|
|
37
|
-
extends: [nkzw],
|
|
38
|
-
ignorePatterns: [
|
|
39
|
-
'coverage',
|
|
40
|
-
'dist',
|
|
41
|
-
'.fate',
|
|
42
|
-
'client/dist',
|
|
43
|
-
'server/dist',
|
|
44
|
-
'server/.wrangler',
|
|
45
|
-
'server/db/migrations/meta/**',
|
|
46
|
-
'vite.config.ts.timestamp-*',
|
|
47
|
-
'client/vite.config.ts.timestamp-*',
|
|
48
|
-
],
|
|
49
|
-
options: { typeAware: true, typeCheck: true },
|
|
50
|
-
overrides: [
|
|
51
|
-
{
|
|
52
|
-
files: ['server/src/index.ts', '**/__tests__/**'],
|
|
53
|
-
rules: {
|
|
54
|
-
'no-console': 'off',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
rules: {
|
|
59
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
run: {
|
|
63
|
-
tasks: {
|
|
64
|
-
'test:all': {
|
|
65
|
-
command: 'vp check && vp test',
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
staged: {
|
|
70
|
-
'*': 'vp check --fix',
|
|
71
|
-
},
|
|
72
|
-
test: {
|
|
73
|
-
passWithNoTests: true,
|
|
74
|
-
},
|
|
75
|
-
});
|