fix types

This commit is contained in:
Aman Varshney
2025-02-11 11:24:29 +05:30
parent 23f9b0adb7
commit e02ee56d74
3 changed files with 16 additions and 18 deletions

View File

@@ -2,15 +2,7 @@ import { execa } from "execa";
import fs from "fs-extra";
import ora from "ora";
import path from "node:path";
interface ProjectOptions {
projectName: string;
typescript: boolean;
git: boolean;
database: "libsql" | "postgres";
auth: boolean;
features: string[];
}
import type { ProjectOptions } from "./types";
export async function createProject(options: ProjectOptions) {
const spinner = ora("Creating project directory...").start();

View File

@@ -3,7 +3,11 @@ import chalk from "chalk";
import { Command } from "commander";
import { createProject } from "./create-project.js";
import { renderTitle } from "./render-title.js";
import type { ProjectOptions } from "./types.js";
import type {
ProjectFeature,
ProjectDatabase,
ProjectOptions,
} from "./types.js";
const program = new Command();
@@ -17,7 +21,7 @@ async function main() {
default: "my-better-t-app",
});
const database = await select({
const database = await select<ProjectDatabase>({
message: chalk.cyan("Select database:"),
choices: [
{
@@ -40,7 +44,7 @@ async function main() {
default: true,
});
const features = await checkbox({
const features = await checkbox<ProjectFeature>({
message: chalk.cyan("Select additional features:"),
choices: [
{
@@ -69,7 +73,7 @@ async function main() {
features,
};
await createProject(projectOptions as ProjectOptions);
await createProject(projectOptions);
}
program

View File

@@ -1,8 +1,10 @@
export interface ProjectOptions {
export type ProjectFeature = "docker" | "github-actions" | "SEO";
export type ProjectDatabase = "libsql" | "postgres";
export type ProjectOptions = {
projectName: string;
typescript: boolean;
git: boolean;
database: "libsql" | "postgres";
database: ProjectDatabase;
auth: boolean;
features: string[];
}
features: ProjectFeature[];
};