create-ereo 0.1.29 → 0.1.32
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/index.js +23 -43
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -95,27 +95,21 @@ function parseArgs(args) {
|
|
|
95
95
|
}
|
|
96
96
|
return { projectName, options };
|
|
97
97
|
}
|
|
98
|
-
function generateDockerfile(
|
|
99
|
-
|
|
100
|
-
` : "";
|
|
101
|
-
return `# syntax=docker/dockerfile:1
|
|
102
|
-
|
|
103
|
-
# ---- Stage 1: Install production dependencies ----
|
|
104
|
-
FROM oven/bun:1-slim AS deps
|
|
105
|
-
WORKDIR /app
|
|
106
|
-
COPY package.json bun.lockb* ./
|
|
107
|
-
RUN --mount=type=cache,target=/root/.bun/install/cache \\
|
|
108
|
-
bun install --frozen-lockfile --production --ignore-scripts
|
|
109
|
-
|
|
110
|
-
# ---- Stage 2: Install all deps + build ----
|
|
98
|
+
function generateDockerfile(_typescript) {
|
|
99
|
+
return `# ---- Stage 1: Install all deps + build ----
|
|
111
100
|
FROM oven/bun:1-slim AS builder
|
|
112
101
|
WORKDIR /app
|
|
113
102
|
COPY package.json bun.lockb* ./
|
|
114
|
-
RUN
|
|
115
|
-
bun install --frozen-lockfile --ignore-scripts
|
|
103
|
+
RUN bun install --ignore-scripts
|
|
116
104
|
COPY . .
|
|
117
105
|
RUN bun run build
|
|
118
106
|
|
|
107
|
+
# ---- Stage 2: Production dependencies only ----
|
|
108
|
+
FROM oven/bun:1-slim AS deps
|
|
109
|
+
WORKDIR /app
|
|
110
|
+
COPY package.json bun.lockb* ./
|
|
111
|
+
RUN bun install --production --ignore-scripts
|
|
112
|
+
|
|
119
113
|
# ---- Stage 3: Production image ----
|
|
120
114
|
FROM oven/bun:1-slim AS runner
|
|
121
115
|
WORKDIR /app
|
|
@@ -126,21 +120,21 @@ ENV NODE_ENV=production
|
|
|
126
120
|
RUN groupadd --system --gid 1001 ereo && \\
|
|
127
121
|
useradd --system --uid 1001 --gid ereo --no-create-home ereo
|
|
128
122
|
|
|
129
|
-
# Copy
|
|
130
|
-
COPY --from=deps
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
COPY --from=builder --chown=ereo:ereo /app
|
|
134
|
-
|
|
135
|
-
COPY --from=builder --chown=ereo:ereo /app/public
|
|
123
|
+
# Copy production node_modules
|
|
124
|
+
COPY --from=deps --chown=ereo:ereo /app/node_modules ./node_modules
|
|
125
|
+
|
|
126
|
+
# Copy build output and runtime files
|
|
127
|
+
COPY --from=builder --chown=ereo:ereo /app/.ereo ./.ereo
|
|
128
|
+
COPY --from=builder --chown=ereo:ereo /app/app ./app
|
|
129
|
+
COPY --from=builder --chown=ereo:ereo /app/public ./public
|
|
130
|
+
COPY --from=builder --chown=ereo:ereo /app/package.json ./
|
|
131
|
+
COPY --from=builder --chown=ereo:ereo /app/ereo.config.* ./
|
|
132
|
+
COPY --from=builder --chown=ereo:ereo /app/tsconfig.* ./
|
|
136
133
|
|
|
137
134
|
USER ereo
|
|
138
135
|
|
|
139
136
|
EXPOSE 3000
|
|
140
137
|
|
|
141
|
-
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \\
|
|
142
|
-
CMD bun -e "fetch('http://localhost:3000').then(r=>{if(!r.ok)throw 1}).catch(()=>process.exit(1))"
|
|
143
|
-
|
|
144
138
|
CMD ["bun", "run", "start"]
|
|
145
139
|
`;
|
|
146
140
|
}
|
|
@@ -478,7 +472,7 @@ async function generateTailwindProject(projectDir, projectName, typescript, trac
|
|
|
478
472
|
};
|
|
479
473
|
await Bun.write(join(projectDir, "package.json"), JSON.stringify(packageJson, null, 2));
|
|
480
474
|
const ereoConfig = `
|
|
481
|
-
import { defineConfig
|
|
475
|
+
import { defineConfig } from '@ereo/core';
|
|
482
476
|
import tailwind from '@ereo/plugin-tailwind';
|
|
483
477
|
|
|
484
478
|
export default defineConfig({
|
|
@@ -490,13 +484,6 @@ export default defineConfig({
|
|
|
490
484
|
build: {
|
|
491
485
|
target: 'bun',
|
|
492
486
|
},
|
|
493
|
-
// Environment variable validation
|
|
494
|
-
env: {
|
|
495
|
-
NODE_ENV: env.enum(['development', 'production', 'test'] as const).default('development'),
|
|
496
|
-
// Add your environment variables here:
|
|
497
|
-
// DATABASE_URL: env.string().required(),
|
|
498
|
-
// API_KEY: env.string(),
|
|
499
|
-
},
|
|
500
487
|
plugins: [
|
|
501
488
|
tailwind(),
|
|
502
489
|
],
|
|
@@ -1383,7 +1370,8 @@ export default function BlogLayout({ children }${ts ? ": BlogLayoutProps" : ""})
|
|
|
1383
1370
|
const blogIndex = `
|
|
1384
1371
|
import { PostCard } from '~/components/PostCard';
|
|
1385
1372
|
import { getAllPosts, simulateDelay } from '~/lib/data';
|
|
1386
|
-
|
|
1373
|
+
${ts ? `import type { Post } from '~/lib/types';
|
|
1374
|
+
` : ""}
|
|
1387
1375
|
/**
|
|
1388
1376
|
* Loader for the blog index page.
|
|
1389
1377
|
*/
|
|
@@ -1395,15 +1383,7 @@ export async function loader() {
|
|
|
1395
1383
|
|
|
1396
1384
|
${ts ? `interface BlogIndexProps {
|
|
1397
1385
|
loaderData: {
|
|
1398
|
-
posts:
|
|
1399
|
-
slug: string;
|
|
1400
|
-
title: string;
|
|
1401
|
-
excerpt: string;
|
|
1402
|
-
author: string;
|
|
1403
|
-
date: string;
|
|
1404
|
-
readTime: string;
|
|
1405
|
-
tags: string[];
|
|
1406
|
-
}>;
|
|
1386
|
+
posts: Post[];
|
|
1407
1387
|
};
|
|
1408
1388
|
}
|
|
1409
1389
|
` : ""}
|