UNPKG

@reliverse/rse

Version:

@reliverse/rse is your all-in-one companion for bootstrapping and improving any kind of projects (especially web apps built with frameworks like Next.js) — whether you're kicking off something new or upgrading an existing app. It is also a little AI-power

43 lines (42 loc) 1.24 kB
import { re } from "@reliverse/relico"; import { relinka } from "@reliverse/relinka"; import { spinner } from "@reliverse/rempts"; import { execa } from "execa"; import path from "node:path"; import { getPackageExecutionCommand } from "../../utils/get-package-execution-command.js"; export async function setupStarlight(config) { const { packageManager, projectDir } = config; const s = spinner(); try { s.start("Setting up Starlight docs..."); const starlightArgs = [ "docs", "--template", "starlight", "--no-install", "--add", "tailwind", "--no-git", "--skip-houston" ]; const starlightArgsString = starlightArgs.join(" "); const commandWithArgs = `create-astro@latest ${starlightArgsString}`; const starlightInitCommand = getPackageExecutionCommand( packageManager, commandWithArgs ); await execa(starlightInitCommand, { cwd: path.join(projectDir, "apps"), env: { CI: "true" }, shell: true }); s.stop("Starlight docs setup successfully!"); } catch (error) { s.stop(re.red("Failed to set up Starlight docs")); if (error instanceof Error) { relinka("error", error.message); } } }