mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
fix types
This commit is contained in:
@@ -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();
|
||||
|
||||
12
src/index.ts
12
src/index.ts
@@ -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
|
||||
|
||||
12
src/types.ts
12
src/types.ts
@@ -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[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user