UNPKG

validstart

Version:

ValidStart is a powerful and intuitive command-line interface (CLI) tool meticulously crafted to streamline the project setup process.

44 lines (43 loc) • 2.08 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.scaffoldHTMLCSS = scaffoldHTMLCSS; const fs_extra_1 = __importDefault(require("fs-extra")); const path_1 = __importDefault(require("path")); const chalk_1 = __importDefault(require("chalk")); ; async function scaffoldHTMLCSS(options) { const { projectName, selectedTools } = options; const projectPath = path_1.default.resolve(process.cwd(), projectName); console.log(chalk_1.default.cyan(`\nšŸ“ Creating basic HTML/CSS project: ${chalk_1.default.bold(projectName)}`)); await fs_extra_1.default.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_extra_1.default.writeFile(path_1.default.join(projectPath, "index.html"), htmlContent); await fs_extra_1.default.writeFile(path_1.default.join(projectPath, "styles.css"), cssContent); if (selectedTools.includes("TailwindCSS")) { console.log(chalk_1.default.yellow(`āš ļø TailwindCSS isn't auto-setup for raw HTML/CSS yet. You must configure it manually.`)); } console.log(chalk_1.default.gray(`šŸ”§ Initializing git...`)); await fs_extra_1.default.writeFile(path_1.default.join(projectPath, ".gitignore"), "node_modules/\n.DS_Store\n"); await fs_extra_1.default.writeFile(path_1.default.join(projectPath, "README.md"), `# ${projectName}\n\nBasic HTML/CSS project generated by ValidStart.\n`); console.log(chalk_1.default.green(`\nāœ… HTML/CSS project '${projectName}' created at ${projectPath}\n`)); }