validstart
Version:
ValidStart is a powerful and intuitive command-line interface (CLI) tool meticulously crafted to streamline the project setup process.
61 lines (50 loc) ⢠1.79 kB
text/typescript
import fs from "fs-extra";
import path from "path";
import chalk from "chalk";;
interface Options {
projectName: string;
projectType: string;
language: string;
framework: string;
selectedTools: string[];
}
export async function scaffoldHTMLCSS(options: Options): Promise<void> {
const { projectName, selectedTools } = options;
const projectPath = path.resolve(process.cwd(), projectName);
console.log(chalk.cyan(`\nš Creating basic HTML/CSS project: ${chalk.bold(projectName)}`));
await fs.mkdirp(projectPath);
const htmlContent = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>${projectName}</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1>Hello from ${projectName} š</h1>
</body>
</html>`;
const cssContent = `body {
font-family: sans-serif;
text-align: center;
padding: 50px;
background-color: #f0f0f0;
}`;
await fs.writeFile(path.join(projectPath, "index.html"), htmlContent);
await fs.writeFile(path.join(projectPath, "styles.css"), cssContent);
if (selectedTools.includes("TailwindCSS")) {
console.log(
chalk.yellow(
`ā ļø TailwindCSS isn't auto-setup for raw HTML/CSS yet. You must configure it manually.`,
),
);
}
console.log(chalk.gray(`š§ Initializing git...`));
await fs.writeFile(path.join(projectPath, ".gitignore"), "node_modules/\n.DS_Store\n");
await fs.writeFile(
path.join(projectPath, "README.md"),
`# ${projectName}\n\nBasic HTML/CSS project generated by ValidStart.\n`,
);
console.log(chalk.green(`\nā
HTML/CSS project '${projectName}' created at ${projectPath}\n`));
}