add convex

This commit is contained in:
Aman Varshney
2025-04-28 11:42:11 +05:30
parent 7ef3cfce9e
commit 2a5358a105
70 changed files with 2330 additions and 1139 deletions

View File

@@ -28,44 +28,46 @@ import {
export async function createProject(options: ProjectConfig) {
const projectDir = path.resolve(process.cwd(), options.projectName);
const isConvex = options.backend === "convex";
try {
await fs.ensureDir(projectDir);
await copyBaseTemplate(projectDir, options);
await setupFrontendTemplates(projectDir, options);
await setupBackendFramework(projectDir, options);
await setupBackendDependencies(options);
await setupDbOrmTemplates(projectDir, options);
await setupDatabase(options);
await setupAuthTemplate(projectDir, options);
await setupAuth(options);
if (!isConvex) {
await setupDbOrmTemplates(projectDir, options);
await setupAuthTemplate(projectDir, options);
}
if (options.examples.length > 0 && options.examples[0] !== "none") {
await setupExamplesTemplate(projectDir, options);
}
await setupAddonsTemplate(projectDir, options);
await setupApi(options);
if (!isConvex) {
await setupBackendDependencies(options);
await setupDatabase(options);
await setupRuntime(options);
if (options.examples.length > 0 && options.examples[0] !== "none") {
await setupExamples(options);
}
}
if (options.addons.length > 0 && options.addons[0] !== "none") {
await setupAddons(options);
}
await setupExamplesTemplate(projectDir, options);
await handleExtras(projectDir, options);
if (options.examples.length > 0 && options.examples[0] !== "none") {
await setupExamples(options);
if (!isConvex && options.auth) {
await setupAuth(options);
}
await setupApi(options);
await setupRuntime(options);
await handleExtras(projectDir, options);
await setupEnvironmentVariables(options);
await updatePackageConfigurations(projectDir, options);
await createReadme(projectDir, options);
await initializeGit(projectDir, options.git);
log.success("Project template successfully scaffolded!");
@@ -89,6 +91,10 @@ export async function createProject(options: ProjectConfig) {
cancel(pc.red(`Error during project creation: ${error.message}`));
console.error(error.stack);
process.exit(1);
} else {
cancel(pc.red(`An unexpected error occurred: ${String(error)}`));
console.error(error);
process.exit(1);
}
}
}