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 fs from "fs-extra";
|
||||||
import ora from "ora";
|
import ora from "ora";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
import type { ProjectOptions } from "./types";
|
||||||
interface ProjectOptions {
|
|
||||||
projectName: string;
|
|
||||||
typescript: boolean;
|
|
||||||
git: boolean;
|
|
||||||
database: "libsql" | "postgres";
|
|
||||||
auth: boolean;
|
|
||||||
features: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function createProject(options: ProjectOptions) {
|
export async function createProject(options: ProjectOptions) {
|
||||||
const spinner = ora("Creating project directory...").start();
|
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 { Command } from "commander";
|
||||||
import { createProject } from "./create-project.js";
|
import { createProject } from "./create-project.js";
|
||||||
import { renderTitle } from "./render-title.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();
|
const program = new Command();
|
||||||
|
|
||||||
@@ -17,7 +21,7 @@ async function main() {
|
|||||||
default: "my-better-t-app",
|
default: "my-better-t-app",
|
||||||
});
|
});
|
||||||
|
|
||||||
const database = await select({
|
const database = await select<ProjectDatabase>({
|
||||||
message: chalk.cyan("Select database:"),
|
message: chalk.cyan("Select database:"),
|
||||||
choices: [
|
choices: [
|
||||||
{
|
{
|
||||||
@@ -40,7 +44,7 @@ async function main() {
|
|||||||
default: true,
|
default: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const features = await checkbox({
|
const features = await checkbox<ProjectFeature>({
|
||||||
message: chalk.cyan("Select additional features:"),
|
message: chalk.cyan("Select additional features:"),
|
||||||
choices: [
|
choices: [
|
||||||
{
|
{
|
||||||
@@ -69,7 +73,7 @@ async function main() {
|
|||||||
features,
|
features,
|
||||||
};
|
};
|
||||||
|
|
||||||
await createProject(projectOptions as ProjectOptions);
|
await createProject(projectOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
program
|
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;
|
projectName: string;
|
||||||
typescript: boolean;
|
|
||||||
git: boolean;
|
git: boolean;
|
||||||
database: "libsql" | "postgres";
|
database: ProjectDatabase;
|
||||||
auth: boolean;
|
auth: boolean;
|
||||||
features: string[];
|
features: ProjectFeature[];
|
||||||
}
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user