create-ereo 0.1.35 → 0.2.1

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 (2) hide show
  1. package/dist/index.js +31 -27
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -184,16 +184,20 @@ async function generateMinimalProject(projectDir, projectName, typescript, trace
184
184
  "@ereo/client": EREO_VERSION,
185
185
  "@ereo/data": EREO_VERSION,
186
186
  "@ereo/cli": EREO_VERSION,
187
+ "@ereo/runtime-bun": EREO_VERSION,
187
188
  ...trace ? { "@ereo/trace": EREO_VERSION } : {},
188
189
  react: "^18.2.0",
189
190
  "react-dom": "^18.2.0"
190
191
  },
191
- devDependencies: typescript ? {
192
- "@types/bun": "^1.1.0",
193
- "@types/react": "^18.2.0",
194
- "@types/react-dom": "^18.2.0",
195
- typescript: "^5.4.0"
196
- } : {}
192
+ devDependencies: {
193
+ "@ereo/bundler": EREO_VERSION,
194
+ ...typescript ? {
195
+ "@types/bun": "^1.1.0",
196
+ "@types/react": "^18.2.0",
197
+ "@types/react-dom": "^18.2.0",
198
+ typescript: "^5.4.0"
199
+ } : {}
200
+ }
197
201
  };
198
202
  await Bun.write(join(projectDir, "package.json"), JSON.stringify(packageJson, null, 2));
199
203
  const ereoConfig = `
@@ -2542,7 +2546,7 @@ export function TaskCard({ task }${ts ? ": TaskCardProps" : ""}) {
2542
2546
  const rootLayout = `
2543
2547
  import { Navigation } from '~/components/Navigation';
2544
2548
  import { Footer } from '~/components/Footer';
2545
- import { useAuth } from '@ereo/auth';
2549
+ import { getAuth } from '@ereo/auth';
2546
2550
 
2547
2551
  ${ts ? `interface RootLayoutProps {
2548
2552
  children: React.ReactNode;
@@ -2552,7 +2556,7 @@ ${ts ? `interface RootLayoutProps {
2552
2556
  export async function loader({ context }${ts ? ": { context: any }" : ""}) {
2553
2557
  let user = null;
2554
2558
  try {
2555
- const auth = useAuth(context);
2559
+ const auth = getAuth(context);
2556
2560
  if (auth.isAuthenticated()) {
2557
2561
  user = auth.getUser();
2558
2562
  }
@@ -2585,11 +2589,11 @@ export default function RootLayout({ children, loaderData }${ts ? ": RootLayoutP
2585
2589
  `.trim();
2586
2590
  await Bun.write(join(projectDir, `app/routes/_layout.${ext}`), rootLayout);
2587
2591
  const indexPage = `
2588
- import { useAuth } from '@ereo/auth';
2592
+ import { getAuth } from '@ereo/auth';
2589
2593
 
2590
2594
  export async function loader({ context }${ts ? ": { context: any }" : ""}) {
2591
2595
  try {
2592
- const auth = useAuth(context);
2596
+ const auth = getAuth(context);
2593
2597
  if (auth.isAuthenticated()) {
2594
2598
  return new Response(null, {
2595
2599
  status: 302,
@@ -2704,7 +2708,7 @@ export default function LandingPage() {
2704
2708
  <pre className="px-5 py-4 font-mono text-sm text-primary-300 leading-relaxed overflow-x-auto">
2705
2709
  {\`// Server loader \u2014 fetches data
2706
2710
  export async function loader({ context }) {
2707
- const auth = useAuth(context);
2711
+ const auth = getAuth(context);
2708
2712
  const user = auth.getUser();
2709
2713
  const tasks = getTasksByUser(user.id);
2710
2714
  return { tasks };
@@ -2732,7 +2736,7 @@ export default function Tasks({ loaderData }) {
2732
2736
  <pre className="px-5 py-4 font-mono text-sm text-primary-300 leading-relaxed overflow-x-auto">
2733
2737
  {\`// Server action \u2014 handles mutations
2734
2738
  export async function action({ request, context }) {
2735
- const auth = useAuth(context);
2739
+ const auth = getAuth(context);
2736
2740
  const user = auth.getUser();
2737
2741
  const form = await request.formData();
2738
2742
 
@@ -2766,11 +2770,11 @@ export async function action({ request, context }) {
2766
2770
  `.trim();
2767
2771
  await Bun.write(join(projectDir, `app/routes/index.${ext}`), indexPage);
2768
2772
  const loginPage = `
2769
- import { useAuth } from '@ereo/auth';
2773
+ import { getAuth } from '@ereo/auth';
2770
2774
 
2771
2775
  export async function loader({ context }${ts ? ": { context: any }" : ""}) {
2772
2776
  try {
2773
- const auth = useAuth(context);
2777
+ const auth = getAuth(context);
2774
2778
  if (auth.isAuthenticated()) {
2775
2779
  return new Response(null, { status: 302, headers: { Location: '/tasks' } });
2776
2780
  }
@@ -2792,7 +2796,7 @@ export async function action({ request, context }${ts ? ": { request: Request; c
2792
2796
  }
2793
2797
 
2794
2798
  try {
2795
- const auth = useAuth(context);
2799
+ const auth = getAuth(context);
2796
2800
  await auth.signIn('credentials', { email, password });
2797
2801
 
2798
2802
  return new Response(null, {
@@ -2887,12 +2891,12 @@ export default function LoginPage({ actionData }${ts ? ": LoginPageProps" : ""})
2887
2891
  `.trim();
2888
2892
  await Bun.write(join(projectDir, `app/routes/(auth)/login.${ext}`), loginPage);
2889
2893
  const registerPage = `
2890
- import { useAuth } from '@ereo/auth';
2894
+ import { getAuth } from '@ereo/auth';
2891
2895
  import { emailExists, createUser, hashPassword } from '~/lib/db';
2892
2896
 
2893
2897
  export async function loader({ context }${ts ? ": { context: any }" : ""}) {
2894
2898
  try {
2895
- const auth = useAuth(context);
2899
+ const auth = getAuth(context);
2896
2900
  if (auth.isAuthenticated()) {
2897
2901
  return new Response(null, { status: 302, headers: { Location: '/tasks' } });
2898
2902
  }
@@ -2929,7 +2933,7 @@ export async function action({ request, context }${ts ? ": { request: Request; c
2929
2933
 
2930
2934
  // Sign in the new user
2931
2935
  try {
2932
- const auth = useAuth(context);
2936
+ const auth = getAuth(context);
2933
2937
  await auth.signIn('credentials', { email, password });
2934
2938
 
2935
2939
  return new Response(null, {
@@ -3052,11 +3056,11 @@ export default function RegisterPage({ actionData }${ts ? ": RegisterPageProps"
3052
3056
  `.trim();
3053
3057
  await Bun.write(join(projectDir, `app/routes/(auth)/register.${ext}`), registerPage);
3054
3058
  const logoutRoute = `
3055
- import { useAuth } from '@ereo/auth';
3059
+ import { getAuth } from '@ereo/auth';
3056
3060
 
3057
3061
  export async function action({ context }${ts ? ": { context: any }" : ""}) {
3058
3062
  try {
3059
- const auth = useAuth(context);
3063
+ const auth = getAuth(context);
3060
3064
  await auth.signOut();
3061
3065
  } catch {
3062
3066
  // Already signed out
@@ -3078,14 +3082,14 @@ export default function LogoutPage() {
3078
3082
  `.trim();
3079
3083
  await Bun.write(join(projectDir, `app/routes/logout.${ext}`), logoutRoute);
3080
3084
  const tasksIndex = `
3081
- import { useAuth, requireAuth } from '@ereo/auth';
3085
+ import { getAuth, requireAuth } from '@ereo/auth';
3082
3086
  import { getTasksByUser, getTaskStats } from '~/lib/db';
3083
3087
  import { TaskCard } from '~/components/TaskCard';
3084
3088
 
3085
3089
  export const config = { ...requireAuth({ redirect: '/login' }) };
3086
3090
 
3087
3091
  export async function loader({ request, context }${ts ? ": { request: Request; context: any }" : ""}) {
3088
- const auth = useAuth(context);
3092
+ const auth = getAuth(context);
3089
3093
  if (!auth.isAuthenticated()) {
3090
3094
  return new Response(null, { status: 302, headers: { Location: '/login' } });
3091
3095
  }
@@ -3226,13 +3230,13 @@ export default function TasksPage({ loaderData }${ts ? ": TasksPageProps" : ""})
3226
3230
  `.trim();
3227
3231
  await Bun.write(join(projectDir, `app/routes/tasks/index.${ext}`), tasksIndex);
3228
3232
  const newTaskPage = `
3229
- import { useAuth, requireAuth } from '@ereo/auth';
3233
+ import { getAuth, requireAuth } from '@ereo/auth';
3230
3234
  import { createTask } from '~/lib/db';
3231
3235
 
3232
3236
  export const config = { ...requireAuth({ redirect: '/login' }) };
3233
3237
 
3234
3238
  export async function action({ request, context }${ts ? ": { request: Request; context: any }" : ""}) {
3235
- const auth = useAuth(context);
3239
+ const auth = getAuth(context);
3236
3240
  if (!auth.isAuthenticated()) {
3237
3241
  return new Response(null, { status: 302, headers: { Location: '/login' } });
3238
3242
  }
@@ -3340,13 +3344,13 @@ export default function NewTaskPage({ actionData }${ts ? ": NewTaskPageProps" :
3340
3344
  `.trim();
3341
3345
  await Bun.write(join(projectDir, `app/routes/tasks/new.${ext}`), newTaskPage);
3342
3346
  const taskDetailPage = `
3343
- import { useAuth, requireAuth } from '@ereo/auth';
3347
+ import { getAuth, requireAuth } from '@ereo/auth';
3344
3348
  import { getTaskById, updateTask, deleteTask } from '~/lib/db';
3345
3349
 
3346
3350
  export const config = { ...requireAuth({ redirect: '/login' }) };
3347
3351
 
3348
3352
  export async function loader({ params, context }${ts ? ": { params: { id: string }; context: any }" : ""}) {
3349
- const auth = useAuth(context);
3353
+ const auth = getAuth(context);
3350
3354
  if (!auth.isAuthenticated()) {
3351
3355
  return new Response(null, { status: 302, headers: { Location: '/login' } });
3352
3356
  }
@@ -3363,7 +3367,7 @@ export async function loader({ params, context }${ts ? ": { params: { id: string
3363
3367
  }
3364
3368
 
3365
3369
  export async function action({ request, params, context }${ts ? ": { request: Request; params: { id: string }; context: any }" : ""}) {
3366
- const auth = useAuth(context);
3370
+ const auth = getAuth(context);
3367
3371
  if (!auth.isAuthenticated()) {
3368
3372
  return new Response(null, { status: 302, headers: { Location: '/login' } });
3369
3373
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ereo",
3
- "version": "0.1.35",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "author": "Ereo Team",
6
6
  "homepage": "https://ereojs.github.io/ereoJS",