create-ereo 0.2.25 → 0.2.28
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 +30 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -66,7 +66,7 @@ function printHelp() {
|
|
|
66
66
|
`);
|
|
67
67
|
}
|
|
68
68
|
function parseArgs(args) {
|
|
69
|
-
const
|
|
69
|
+
const options2 = {};
|
|
70
70
|
let projectName = null;
|
|
71
71
|
for (let i = 0;i < args.length; i++) {
|
|
72
72
|
const arg = args[i];
|
|
@@ -86,20 +86,20 @@ function parseArgs(args) {
|
|
|
86
86
|
`);
|
|
87
87
|
process.exit(1);
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
options2.template = tmpl;
|
|
90
90
|
} else if (arg === "--no-typescript") {
|
|
91
|
-
|
|
91
|
+
options2.typescript = false;
|
|
92
92
|
} else if (arg === "--no-git") {
|
|
93
|
-
|
|
93
|
+
options2.git = false;
|
|
94
94
|
} else if (arg === "--no-install") {
|
|
95
|
-
|
|
95
|
+
options2.install = false;
|
|
96
96
|
} else if (arg === "--trace") {
|
|
97
|
-
|
|
97
|
+
options2.trace = true;
|
|
98
98
|
} else if (!arg.startsWith("-") && !projectName) {
|
|
99
99
|
projectName = arg;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
return { projectName, options };
|
|
102
|
+
return { projectName, options: options2 };
|
|
103
103
|
}
|
|
104
104
|
function generateDockerfile(_typescript) {
|
|
105
105
|
return `# ---- Stage 1: Install all deps + build ----
|
|
@@ -1113,7 +1113,25 @@ export default function RootLayout({ children }${ts ? ": RootLayoutProps" : ""})
|
|
|
1113
1113
|
}
|
|
1114
1114
|
`.trim();
|
|
1115
1115
|
await Bun.write(join(projectDir, `app/routes/_layout.${ext}`), rootLayout);
|
|
1116
|
-
const clientEntry = `
|
|
1116
|
+
const clientEntry = options.trace ? `
|
|
1117
|
+
/**
|
|
1118
|
+
* Client Entry Point
|
|
1119
|
+
*
|
|
1120
|
+
* This file initializes the client-side runtime:
|
|
1121
|
+
* - Hydrates island components marked with 'use client'
|
|
1122
|
+
* - Sets up client-side navigation
|
|
1123
|
+
* - Enables link prefetching
|
|
1124
|
+
* - Enables client-side tracing (sends spans to the server)
|
|
1125
|
+
*/
|
|
1126
|
+
import { initClient } from '@ereo/client';
|
|
1127
|
+
import { initClientTracing } from '@ereo/trace/client';
|
|
1128
|
+
|
|
1129
|
+
// Initialize the EreoJS client runtime
|
|
1130
|
+
initClient();
|
|
1131
|
+
|
|
1132
|
+
// Initialize client-side tracing
|
|
1133
|
+
initClientTracing();
|
|
1134
|
+
`.trim() : `
|
|
1117
1135
|
/**
|
|
1118
1136
|
* Client Entry Point
|
|
1119
1137
|
*
|
|
@@ -3865,8 +3883,8 @@ This project includes \`@ereo/trace\` for full-stack observability.
|
|
|
3865
3883
|
`;
|
|
3866
3884
|
await Bun.write(join(projectDir, "README.md"), readme);
|
|
3867
3885
|
}
|
|
3868
|
-
async function generateProject(projectDir, projectName,
|
|
3869
|
-
const { template, typescript, trace } =
|
|
3886
|
+
async function generateProject(projectDir, projectName, options2) {
|
|
3887
|
+
const { template, typescript, trace } = options2;
|
|
3870
3888
|
if (template === "minimal") {
|
|
3871
3889
|
await generateMinimalProject(projectDir, projectName, typescript, trace);
|
|
3872
3890
|
} else if (template === "tasks") {
|
|
@@ -3902,7 +3920,7 @@ async function main() {
|
|
|
3902
3920
|
printBanner();
|
|
3903
3921
|
await checkForUpdates();
|
|
3904
3922
|
const args = process.argv.slice(2);
|
|
3905
|
-
const { projectName, options } = parseArgs(args);
|
|
3923
|
+
const { projectName, options: options2 } = parseArgs(args);
|
|
3906
3924
|
if (!projectName) {
|
|
3907
3925
|
console.error(` \x1B[31m\u2717\x1B[0m Please provide a project name
|
|
3908
3926
|
`);
|
|
@@ -3914,7 +3932,7 @@ async function main() {
|
|
|
3914
3932
|
`);
|
|
3915
3933
|
process.exit(1);
|
|
3916
3934
|
}
|
|
3917
|
-
const finalOptions = { ...defaultOptions, ...
|
|
3935
|
+
const finalOptions = { ...defaultOptions, ...options2 };
|
|
3918
3936
|
const projectDir = resolve(process.cwd(), projectName);
|
|
3919
3937
|
if (!projectDir.startsWith(process.cwd())) {
|
|
3920
3938
|
console.error(` \x1B[31m\u2717\x1B[0m Invalid project name: path traversal detected.
|