@evjs/create-app 0.0.1-rc.27

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.
Files changed (48) hide show
  1. package/dist/index.js +97 -0
  2. package/package.json +54 -0
  3. package/templates/basic-csr/README.md +23 -0
  4. package/templates/basic-csr/index.html +11 -0
  5. package/templates/basic-csr/package.json +22 -0
  6. package/templates/basic-csr/src/main.tsx +22 -0
  7. package/templates/basic-csr/src/pages/__root.tsx +28 -0
  8. package/templates/basic-csr/src/pages/about.tsx +19 -0
  9. package/templates/basic-csr/src/pages/home.tsx +19 -0
  10. package/templates/basic-csr/src/pages/posts/index.tsx +63 -0
  11. package/templates/basic-csr/tsconfig.json +17 -0
  12. package/templates/basic-server-fns/README.md +24 -0
  13. package/templates/basic-server-fns/index.html +11 -0
  14. package/templates/basic-server-fns/package.json +22 -0
  15. package/templates/basic-server-fns/src/api/users.server.ts +31 -0
  16. package/templates/basic-server-fns/src/main.tsx +12 -0
  17. package/templates/basic-server-fns/src/routes.tsx +103 -0
  18. package/templates/basic-server-fns/tsconfig.json +16 -0
  19. package/templates/complex-routing/README.md +27 -0
  20. package/templates/complex-routing/index.html +11 -0
  21. package/templates/complex-routing/package.json +22 -0
  22. package/templates/complex-routing/src/api/data.server.ts +86 -0
  23. package/templates/complex-routing/src/main.tsx +29 -0
  24. package/templates/complex-routing/src/pages/__root.tsx +60 -0
  25. package/templates/complex-routing/src/pages/catch.tsx +26 -0
  26. package/templates/complex-routing/src/pages/dashboard.tsx +79 -0
  27. package/templates/complex-routing/src/pages/home.tsx +35 -0
  28. package/templates/complex-routing/src/pages/posts/index.tsx +100 -0
  29. package/templates/complex-routing/src/pages/search.tsx +71 -0
  30. package/templates/complex-routing/src/pages/user.tsx +28 -0
  31. package/templates/complex-routing/tsconfig.json +13 -0
  32. package/templates/configured-server-fns/README.md +24 -0
  33. package/templates/configured-server-fns/ev.config.ts +56 -0
  34. package/templates/configured-server-fns/index.html +11 -0
  35. package/templates/configured-server-fns/package.json +22 -0
  36. package/templates/configured-server-fns/src/api/users.server.ts +22 -0
  37. package/templates/configured-server-fns/src/main.tsx +12 -0
  38. package/templates/configured-server-fns/src/routes.tsx +95 -0
  39. package/templates/configured-server-fns/tsconfig.json +16 -0
  40. package/templates/with-tailwind/ev.config.ts +20 -0
  41. package/templates/with-tailwind/index.html +11 -0
  42. package/templates/with-tailwind/package.json +29 -0
  43. package/templates/with-tailwind/postcss.config.mjs +5 -0
  44. package/templates/with-tailwind/src/main.tsx +15 -0
  45. package/templates/with-tailwind/src/pages/__root.tsx +30 -0
  46. package/templates/with-tailwind/src/pages/home.tsx +85 -0
  47. package/templates/with-tailwind/src/styles.css +2 -0
  48. package/templates/with-tailwind/tsconfig.json +17 -0
@@ -0,0 +1,95 @@
1
+ import {
2
+ createAppRootRoute,
3
+ createRoute,
4
+ Link,
5
+ Outlet,
6
+ serverFn,
7
+ useMutation,
8
+ useQuery,
9
+ useQueryClient,
10
+ } from "@evjs/client";
11
+ import { useState } from "react";
12
+ import { createUser, getUsers } from "./api/users.server";
13
+
14
+ // ── Root Route ──
15
+
16
+ function Root() {
17
+ return (
18
+ <div style={{ fontFamily: "system-ui, sans-serif", padding: "2rem" }}>
19
+ <h1>Configured Server Functions</h1>
20
+ <p style={{ color: "#666" }}>
21
+ Custom <code>ev.config.ts</code> with server function queries.
22
+ </p>
23
+ <nav style={{ marginBottom: "1rem" }}>
24
+ <Link to="/" style={{ textDecoration: "none", fontWeight: "bold" }}>
25
+ Users
26
+ </Link>
27
+ </nav>
28
+ <Outlet />
29
+ </div>
30
+ );
31
+ }
32
+
33
+ const rootRoute = createAppRootRoute({ component: Root });
34
+
35
+ // ── Users Route ──
36
+
37
+ function UsersPage() {
38
+ const [name, setName] = useState("");
39
+ const [email, setEmail] = useState("");
40
+
41
+ const { data: users = [], isLoading } = useQuery(getUsers);
42
+
43
+ const queryClient = useQueryClient();
44
+ const { mutateAsync: doCreateUser } = useMutation({
45
+ mutationFn: createUser,
46
+ onSuccess: () => {
47
+ queryClient.invalidateQueries({ queryKey: serverFn(getUsers).queryKey });
48
+ },
49
+ });
50
+
51
+ async function handleCreate(e: { preventDefault: () => void }) {
52
+ e.preventDefault();
53
+ if (!name || !email) return;
54
+ await doCreateUser({ name, email });
55
+ setName("");
56
+ setEmail("");
57
+ }
58
+
59
+ if (isLoading) return <p>Loading users from server…</p>;
60
+
61
+ return (
62
+ <div>
63
+ <h2>Users</h2>
64
+ <ul>
65
+ {users.map((u) => (
66
+ <li key={u.id}>
67
+ {u.name} — {u.email}
68
+ </li>
69
+ ))}
70
+ </ul>
71
+ <h3>Add User</h3>
72
+ <form onSubmit={handleCreate} style={{ display: "flex", gap: "0.5rem" }}>
73
+ <input
74
+ placeholder="Name"
75
+ value={name}
76
+ onChange={(e) => setName(e.target.value)}
77
+ />
78
+ <input
79
+ placeholder="Email"
80
+ value={email}
81
+ onChange={(e) => setEmail(e.target.value)}
82
+ />
83
+ <button type="submit">Create</button>
84
+ </form>
85
+ </div>
86
+ );
87
+ }
88
+
89
+ const usersRoute = createRoute({
90
+ getParentRoute: () => rootRoute,
91
+ path: "/",
92
+ component: UsersPage,
93
+ });
94
+
95
+ export const routeTree = rootRoute.addChildren([usersRoute]);
@@ -0,0 +1,16 @@
1
+ {
2
+ "include": ["src"],
3
+ "compilerOptions": {
4
+ "target": "ESNext",
5
+ "jsx": "react-jsx",
6
+ "module": "ESNext",
7
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
8
+ "moduleResolution": "Bundler",
9
+ "outDir": "./dist",
10
+ "rootDir": "./src",
11
+ "skipLibCheck": true,
12
+ "strict": true,
13
+ "noEmit": true,
14
+ "verbatimModuleSyntax": true
15
+ }
16
+ }
@@ -0,0 +1,20 @@
1
+ import { defineConfig } from "@evjs/cli";
2
+
3
+ /**
4
+ * Example: Using client plugins to add Tailwind CSS support.
5
+ */
6
+ export default defineConfig({
7
+ client: {
8
+ plugins: [
9
+ {
10
+ name: "tailwind",
11
+ loaders: [
12
+ {
13
+ test: /\.css$/,
14
+ use: ["style-loader", "css-loader", "postcss-loader"],
15
+ },
16
+ ],
17
+ },
18
+ ],
19
+ },
20
+ });
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>ev — CSS Plugin Example</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ </body>
11
+ </html>
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "example-with-tailwind",
3
+ "version": "0.0.1-rc.27",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "ev dev",
7
+ "build": "ev build",
8
+ "check-types": "tsc --noEmit"
9
+ },
10
+ "dependencies": {
11
+ "@tailwindcss/typography": "^0.5.19",
12
+ "react": "^19.2.4",
13
+ "react-dom": "^19.2.4"
14
+ },
15
+ "devDependencies": {
16
+ "@evjs/cli": "*",
17
+ "@evjs/client": "*",
18
+ "@evjs/server": "*",
19
+ "@tailwindcss/postcss": "^4.1.10",
20
+ "@types/react": "^19.0.8",
21
+ "@types/react-dom": "^19.0.3",
22
+ "css-loader": "^7.1.2",
23
+ "postcss": "^8.5.6",
24
+ "postcss-loader": "^8.1.1",
25
+ "style-loader": "^4.0.0",
26
+ "tailwindcss": "^4.1.10",
27
+ "typescript": "^5.7.3"
28
+ }
29
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ plugins: {
3
+ "@tailwindcss/postcss": {},
4
+ },
5
+ };
@@ -0,0 +1,15 @@
1
+ import { createApp } from "@evjs/client";
2
+ import { rootRoute } from "./pages/__root";
3
+ import { homeRoute } from "./pages/home";
4
+
5
+ const routeTree = rootRoute.addChildren([homeRoute]);
6
+
7
+ const app = createApp({ routeTree });
8
+
9
+ declare module "@tanstack/react-router" {
10
+ interface Register {
11
+ router: typeof app.router;
12
+ }
13
+ }
14
+
15
+ app.render("#app");
@@ -0,0 +1,30 @@
1
+ import { createRootRoute, Link, Outlet } from "@evjs/client";
2
+ import "../styles.css";
3
+
4
+ function Root() {
5
+ return (
6
+ <div className="min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 text-white">
7
+ <nav className="border-b border-white/10 backdrop-blur-sm bg-white/5">
8
+ <div className="max-w-4xl mx-auto px-6 py-4 flex items-center gap-6">
9
+ <Link
10
+ to="/"
11
+ className="text-lg font-bold bg-gradient-to-r from-blue-400 to-violet-400 bg-clip-text text-transparent"
12
+ >
13
+ evjs
14
+ </Link>
15
+ <Link
16
+ to="/"
17
+ className="text-sm text-slate-300 hover:text-white transition-colors"
18
+ >
19
+ Home
20
+ </Link>
21
+ </div>
22
+ </nav>
23
+ <Outlet />
24
+ </div>
25
+ );
26
+ }
27
+
28
+ export const rootRoute = createRootRoute({
29
+ component: Root,
30
+ });
@@ -0,0 +1,85 @@
1
+ import { createRoute } from "@evjs/client";
2
+ import { rootRoute } from "./__root";
3
+
4
+ export const homeRoute = createRoute({
5
+ getParentRoute: () => rootRoute,
6
+ path: "/",
7
+ component: () => (
8
+ <main className="max-w-4xl mx-auto px-6 py-16">
9
+ {/* Hero */}
10
+ <div className="text-center mb-16">
11
+ <h1
12
+ className="text-5xl font-extrabold tracking-tight bg-gradient-to-r from-blue-400 via-violet-400 to-fuchsia-400 bg-clip-text text-transparent"
13
+ data-testid="title"
14
+ >
15
+ Tailwind Plugin Example
16
+ </h1>
17
+ <p
18
+ className="mt-4 text-lg text-slate-400 max-w-xl mx-auto"
19
+ data-testid="subtitle"
20
+ >
21
+ Styled with Tailwind CSS v4 via the evjs plugin system — no webpack
22
+ config needed.
23
+ </p>
24
+ </div>
25
+
26
+ {/* Feature cards */}
27
+ <div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-16">
28
+ <div className="rounded-xl border border-white/10 bg-white/5 backdrop-blur-sm p-6 hover:bg-white/10 transition-colors">
29
+ <div className="text-3xl mb-3">🔌</div>
30
+ <h3 className="font-semibold text-white mb-1">Plugin Loaders</h3>
31
+ <p className="text-sm text-slate-400">
32
+ Declare loaders in ev.config.ts. The framework handles the rest.
33
+ </p>
34
+ </div>
35
+
36
+ <div className="rounded-xl border border-white/10 bg-white/5 backdrop-blur-sm p-6 hover:bg-white/10 transition-colors">
37
+ <div className="text-3xl mb-3">🎨</div>
38
+ <h3 className="font-semibold text-white mb-1">Tailwind CSS v4</h3>
39
+ <p className="text-sm text-slate-400">
40
+ Full utility-first styling with zero configuration overhead.
41
+ </p>
42
+ </div>
43
+
44
+ <div className="rounded-xl border border-white/10 bg-white/5 backdrop-blur-sm p-6 hover:bg-white/10 transition-colors">
45
+ <div className="text-3xl mb-3">⚡</div>
46
+ <h3 className="font-semibold text-white mb-1">Zero Config</h3>
47
+ <p className="text-sm text-slate-400">
48
+ evjs works out of the box. Plugins extend it cleanly.
49
+ </p>
50
+ </div>
51
+ </div>
52
+
53
+ {/* Typography plugin demo */}
54
+ <div className="rounded-xl border border-white/10 bg-white/5 backdrop-blur-sm p-8 mb-16">
55
+ <div className="prose prose-invert max-w-none" data-testid="prose">
56
+ <h2>Typography Plugin</h2>
57
+ <p>
58
+ This section uses <code>@tailwindcss/typography</code> via the{" "}
59
+ <code>prose</code> class. It automatically styles headings,
60
+ paragraphs, code blocks, lists, and more with beautiful defaults.
61
+ </p>
62
+ <ul>
63
+ <li>Automatic heading styles</li>
64
+ <li>Beautiful paragraph spacing</li>
65
+ <li>
66
+ Styled <code>code</code> elements
67
+ </li>
68
+ </ul>
69
+ </div>
70
+ </div>
71
+
72
+ {/* Config preview */}
73
+ <div className="rounded-xl border border-white/10 bg-white/5 backdrop-blur-sm p-6">
74
+ <h2 className="text-lg font-semibold text-white mb-4">ev.config.ts</h2>
75
+ <pre className="text-sm text-slate-300 bg-black/30 rounded-lg p-4 overflow-x-auto">
76
+ <code>{`export default defineConfig({
77
+ client: {
78
+ plugins: [tailwind()],
79
+ },
80
+ });`}</code>
81
+ </pre>
82
+ </div>
83
+ </main>
84
+ ),
85
+ });
@@ -0,0 +1,2 @@
1
+ @import "tailwindcss";
2
+ @plugin "@tailwindcss/typography";
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "jsx": "react-jsx",
5
+ "module": "ESNext",
6
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
7
+ "moduleResolution": "Bundler",
8
+ "verbatimModuleSyntax": true,
9
+ "noEmit": true,
10
+ "skipLibCheck": true,
11
+ "strict": true,
12
+ "noUnusedLocals": true,
13
+ "noUnusedParameters": true,
14
+ "noFallthroughCasesInSwitch": true
15
+ },
16
+ "include": ["src"]
17
+ }