mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
rename features to addons
This commit is contained in:
@@ -2,21 +2,18 @@ import path from "node:path";
|
||||
import { log } from "@clack/prompts";
|
||||
import fs from "fs-extra";
|
||||
import pc from "picocolors";
|
||||
import type { ProjectFeature } from "../types";
|
||||
import type { ProjectAddons } from "../types";
|
||||
|
||||
export async function setupFeatures(
|
||||
projectDir: string,
|
||||
features: ProjectFeature[],
|
||||
) {
|
||||
if (features.includes("docker")) {
|
||||
export async function setupAddons(projectDir: string, addons: ProjectAddons[]) {
|
||||
if (addons.includes("docker")) {
|
||||
await setupDocker(projectDir);
|
||||
}
|
||||
|
||||
if (features.includes("github-actions")) {
|
||||
if (addons.includes("github-actions")) {
|
||||
await setupGithubActions(projectDir);
|
||||
}
|
||||
|
||||
if (features.includes("SEO")) {
|
||||
if (addons.includes("SEO")) {
|
||||
log.info(
|
||||
pc.yellow(
|
||||
"SEO feature is still a work-in-progress and will be available in a future update.",
|
||||
@@ -5,10 +5,10 @@ import fs from "fs-extra";
|
||||
import pc from "picocolors";
|
||||
import { PKG_ROOT } from "../constants";
|
||||
import type { ProjectConfig } from "../types";
|
||||
import { setupAddons } from "./addons-setup";
|
||||
import { configureAuth } from "./auth-setup";
|
||||
import { createReadme } from "./create-readme";
|
||||
import { setupDatabase } from "./db-setup";
|
||||
import { setupFeatures } from "./feature-setup";
|
||||
import { displayPostInstallInstructions } from "./post-installation";
|
||||
|
||||
export async function createProject(options: ProjectConfig): Promise<string> {
|
||||
@@ -92,8 +92,8 @@ export async function createProject(options: ProjectConfig): Promise<string> {
|
||||
await $({ cwd: projectDir })`git init`;
|
||||
}
|
||||
|
||||
if (options.features.length > 0) {
|
||||
await setupFeatures(projectDir, options.features);
|
||||
if (options.addons.length > 0) {
|
||||
await setupAddons(projectDir, options.addons);
|
||||
}
|
||||
|
||||
const packageJsonPath = path.join(projectDir, "package.json");
|
||||
|
||||
@@ -19,7 +19,7 @@ function generateReadmeContent(options: ProjectConfig): string {
|
||||
packageManager,
|
||||
database,
|
||||
auth,
|
||||
features = [],
|
||||
addons = [],
|
||||
orm = "drizzle",
|
||||
} = options;
|
||||
|
||||
@@ -32,7 +32,7 @@ This project was created with [Better-T-Stack](https://github.com/better-t-stack
|
||||
|
||||
## Features
|
||||
|
||||
${generateFeaturesList(database, auth, features, orm)}
|
||||
${generateFeaturesList(database, auth, addons, orm)}
|
||||
|
||||
## Getting Started
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ export async function setupDatabase(
|
||||
|
||||
if (databaseType === "none") {
|
||||
await fs.remove(path.join(serverDir, "src/db"));
|
||||
log.info(pc.yellow("Database configuration removed"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ export async function installDependencies({
|
||||
packageManager,
|
||||
}: InstallDependenciesOptions) {
|
||||
const s = spinner();
|
||||
log.info(pc.blue(`Installing dependencies using ${packageManager}...`));
|
||||
|
||||
try {
|
||||
s.start(`Running ${packageManager} install...`);
|
||||
@@ -34,7 +33,7 @@ export async function installDependencies({
|
||||
break;
|
||||
}
|
||||
|
||||
s.stop(pc.green("Dependencies installed successfully"));
|
||||
s.stop("Dependencies installed successfully");
|
||||
} catch (error) {
|
||||
s.stop(pc.red("Failed to install dependencies"));
|
||||
if (error instanceof Error) {
|
||||
|
||||
Reference in New Issue
Block a user