diff --git a/packages/typegpu-cli/src/create.ts b/packages/typegpu-cli/src/create.ts index fdcc02124e..171d455590 100644 --- a/packages/typegpu-cli/src/create.ts +++ b/packages/typegpu-cli/src/create.ts @@ -15,8 +15,8 @@ import { type ProjectTemplate, } from './options.ts'; -const GRADIENT_START = [0.831, 0.553, 1.0] as const; -const GRADIENT_END = [0.32, 0.4, 0.95] as const; +const GRADIENT_START = [0.867, 0.663, 1.0] as const; +const GRADIENT_END = [0.384, 0.439, 0.964] as const; const coloredLabelsTemplates = PROJECT_TEMPLATES.map((template, i) => { const t = i / (PROJECT_TEMPLATES.length - 1); @@ -54,8 +54,6 @@ export async function createProject(cwd: string, options?: CreateProjectOptions) options?.projectDir ?? (nonInteractive ? DEFAULT_PROJECT_DIR : await getProjectName(DEFAULT_PROJECT_DIR)); - const root = await prepareDirectory(cwd, projectName, { interactive: !nonInteractive }); - const packageName = getDefaultPackageName(cwd, projectName) ?? (nonInteractive ? undefined : await getPackageName()); @@ -72,6 +70,8 @@ export async function createProject(cwd: string, options?: CreateProjectOptions) p.log.step(`Scaffolding project in ${projectName}...`); + const root = await prepareDirectory(cwd, projectName, { interactive: !nonInteractive }); + const templateDir = path.resolve( import.meta.dirname, '../templates', diff --git a/packages/typegpu-cli/src/enhance.ts b/packages/typegpu-cli/src/enhance.ts index 4ed7f0bb72..a00d007140 100644 --- a/packages/typegpu-cli/src/enhance.ts +++ b/packages/typegpu-cli/src/enhance.ts @@ -13,7 +13,7 @@ import { askForVite, setupVite } from './steps/vite.ts'; import { addAgentSkills, askForAgentSkills } from './steps/skills.ts'; import type { EnhanceProjectOptions } from './options.ts'; -const PROJECT_KINDS = [{ value: 'vite', label: rgbText('Vite', 175, 105, 245) }]; +const PROJECT_KINDS = [{ value: 'vite', label: rgbText('Vite', 221, 169, 255) }]; async function runViteFlow( cwd: string, diff --git a/packages/typegpu-cli/src/index.ts b/packages/typegpu-cli/src/index.ts index b254217332..0a70b86bf7 100644 --- a/packages/typegpu-cli/src/index.ts +++ b/packages/typegpu-cli/src/index.ts @@ -12,8 +12,9 @@ import { parsePackageManager, parseTemplate, } from './options.ts'; -import { failAndExit } from './utils/prompts.ts'; +import { colorsEnabled, failAndExit } from './utils/prompts.ts'; import { typegpuPkgs } from './utils/pkg.ts'; +import { typegpuAsciiLogoColor, typegpuAsciiLogoNoColor } from './utils/logo.ts'; function formatHelpEntries(entries: readonly { value: string; label?: string; hint?: string }[]) { const maxLength = Math.max(...entries.map((entry) => entry.value.length)); @@ -74,6 +75,8 @@ const commonOptions = { ...(packageManager ? { packageManager } : {}), }; +console.log(colorsEnabled ? typegpuAsciiLogoColor : typegpuAsciiLogoNoColor); + if (argv.enhance) { const targetDir = positionals[0] ? path.resolve(cwd, positionals[0]) : cwd; if (!fs.existsSync(targetDir) || !fs.statSync(targetDir).isDirectory()) { diff --git a/packages/typegpu-cli/src/utils/logo.ts b/packages/typegpu-cli/src/utils/logo.ts new file mode 100644 index 0000000000..a8c7d75a5b --- /dev/null +++ b/packages/typegpu-cli/src/utils/logo.ts @@ -0,0 +1,5 @@ +export const typegpuAsciiLogoColor = + '\n \x1b[38;2;221;169;255m /|\x1b[0m\n \x1b[38;2;207;159;255m \\|____\x1b[0m\n \x1b[38;2;176;145;255m , `\\ \\\x1b[0m\n \x1b[38;2;147;136;255m/ `\\ \\ \\\x1b[0m\n \x1b[38;2;113;124;255m\\ `\\| /\x1b[0m\n \x1b[38;2;95;112;255m \\_____/\x1b[0m\n'; + +export const typegpuAsciiLogoNoColor = + '\n /|\n \\|____\n , `\\ \\\n / `\\ \\ \\\n \\ `\\| /\n \\_____/\n'; diff --git a/packages/typegpu-cli/src/utils/prompts.ts b/packages/typegpu-cli/src/utils/prompts.ts index 3344be6bf2..5557d3dee2 100644 --- a/packages/typegpu-cli/src/utils/prompts.ts +++ b/packages/typegpu-cli/src/utils/prompts.ts @@ -1,5 +1,8 @@ +import { styleText } from 'node:util'; import * as p from '@clack/prompts'; +export const colorsEnabled = styleText('red', '_', { stream: process.stdout }) !== '_'; + export function cancelExit(): never { p.cancel('Operation cancelled.'); process.exit(0); @@ -22,5 +25,6 @@ export async function confirmStep(message: string, initialValue?: boolean) { // 0-255 range export function rgbText(text: string, r: number, g: number, b: number) { + if (!colorsEnabled) return text; return `\x1b[38;2;${r};${g};${b}m${text}\x1b[39m`; }