create-ereo 0.1.31 → 0.1.33
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 +33 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -95,52 +95,46 @@ 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
|
-
FROM oven/bun:1-
|
|
114
|
+
FROM oven/bun:1-alpine AS runner
|
|
121
115
|
WORKDIR /app
|
|
122
116
|
|
|
123
117
|
ENV NODE_ENV=production
|
|
124
118
|
|
|
125
119
|
# Non-root user for security
|
|
126
|
-
RUN
|
|
127
|
-
|
|
120
|
+
RUN addgroup -S -g 1001 ereo && \\
|
|
121
|
+
adduser -S -u 1001 -G ereo -H ereo
|
|
128
122
|
|
|
129
|
-
# Copy
|
|
130
|
-
COPY --from=deps
|
|
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
|
|
131
127
|
COPY --from=builder --chown=ereo:ereo /app/.ereo ./.ereo
|
|
132
|
-
COPY --from=builder --chown=ereo:ereo /app/
|
|
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 ./
|
|
133
131
|
COPY --from=builder --chown=ereo:ereo /app/ereo.config.* ./
|
|
134
|
-
|
|
135
|
-
COPY --from=builder --chown=ereo:ereo /app/public ./public
|
|
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
|
}
|
|
@@ -459,40 +453,44 @@ async function generateTailwindProject(projectDir, projectName, typescript, trac
|
|
|
459
453
|
"@ereo/data": EREO_VERSION,
|
|
460
454
|
"@ereo/cli": EREO_VERSION,
|
|
461
455
|
"@ereo/runtime-bun": EREO_VERSION,
|
|
462
|
-
"@ereo/plugin-tailwind": EREO_VERSION,
|
|
463
456
|
...trace ? { "@ereo/trace": EREO_VERSION } : {},
|
|
464
457
|
react: "^18.2.0",
|
|
465
458
|
"react-dom": "^18.2.0"
|
|
466
459
|
},
|
|
467
460
|
devDependencies: {
|
|
461
|
+
"@ereo/bundler": EREO_VERSION,
|
|
468
462
|
"@ereo/testing": EREO_VERSION,
|
|
469
463
|
"@ereo/dev-inspector": EREO_VERSION,
|
|
464
|
+
"@ereo/plugin-tailwind": EREO_VERSION,
|
|
465
|
+
tailwindcss: "^3.4.0",
|
|
470
466
|
...ts ? {
|
|
471
467
|
"@types/bun": "^1.1.0",
|
|
472
468
|
"@types/react": "^18.2.0",
|
|
473
469
|
"@types/react-dom": "^18.2.0",
|
|
474
470
|
typescript: "^5.4.0"
|
|
475
|
-
} : {}
|
|
476
|
-
tailwindcss: "^3.4.0"
|
|
471
|
+
} : {}
|
|
477
472
|
}
|
|
478
473
|
};
|
|
479
474
|
await Bun.write(join(projectDir, "package.json"), JSON.stringify(packageJson, null, 2));
|
|
480
475
|
const ereoConfig = `
|
|
481
476
|
import { defineConfig } from '@ereo/core';
|
|
482
|
-
|
|
477
|
+
|
|
478
|
+
const plugins = [];
|
|
479
|
+
|
|
480
|
+
// Tailwind is a dev/build dependency \u2014 skip in production
|
|
481
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
482
|
+
const { default: tailwind } = await import('@ereo/plugin-tailwind');
|
|
483
|
+
plugins.push(tailwind());
|
|
484
|
+
}
|
|
483
485
|
|
|
484
486
|
export default defineConfig({
|
|
485
487
|
server: {
|
|
486
488
|
port: 3000,
|
|
487
|
-
// Enable development features
|
|
488
|
-
development: process.env.NODE_ENV !== 'production',
|
|
489
489
|
},
|
|
490
490
|
build: {
|
|
491
491
|
target: 'bun',
|
|
492
492
|
},
|
|
493
|
-
plugins
|
|
494
|
-
tailwind(),
|
|
495
|
-
],
|
|
493
|
+
plugins,
|
|
496
494
|
});
|
|
497
495
|
`.trim();
|
|
498
496
|
await Bun.write(join(projectDir, `ereo.config.${ts ? "ts" : "js"}`), ereoConfig);
|