update template repo url and add degit

This commit is contained in:
Aman Varshney
2025-02-14 19:13:58 +05:30
parent 9f9c3ce60f
commit e9ecdbff93
4 changed files with 27 additions and 156 deletions

View File

@@ -21,16 +21,16 @@
"@clack/prompts": "^0.10.0",
"chalk": "^5.3.0",
"commander": "^13.1.0",
"degit": "^2.8.4",
"execa": "^8.0.1",
"fs-extra": "^11.2.0",
"gradient-string": "^3.0.0"
},
"devDependencies": {
"@types/degit": "^2.8.6",
"@types/fs-extra": "^11.0.4",
"@types/inquirer": "^9.0.7",
"@types/node": "^20.10.5",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"vitest": "^1.1.0"
"typescript": "^5.3.3"
}
}

View File

@@ -1,6 +1,7 @@
import path from "node:path";
import { cancel, confirm, isCancel, log, spinner, tasks } from "@clack/prompts";
import chalk from "chalk";
import degit from "degit";
import { $ } from "execa";
import fs from "fs-extra";
import type { ProjectConfig } from "../types";
@@ -23,7 +24,10 @@ export async function createProject(options: ProjectConfig) {
title: "📥 Cloning template repository",
task: async () => {
try {
await $`npx degit AmanVarshney01/Better-T-Stack ${projectDir}`;
const emitter = degit("better-t-stack/Better-T-Stack#bare", {
cache: true,
});
await emitter.clone(projectDir);
} catch (error) {
log.error("Failed to clone template repository");
if (error instanceof Error) {
@@ -39,7 +43,9 @@ export async function createProject(options: ProjectConfig) {
tasksList.push({
title: "🗃️ Initializing git repository",
task: async () => {
await $`git init ${projectDir}`;
await $({
cwd: projectDir,
})`git init`;
},
});
}