Scripts by austincrim

Vite Scaffolder

Put together a quick script to scaffold Vite projects using a variety of my common choices. I've got plans to expand beyond Vite to include Next.js, SvelteKit, etc. as well as setting up individual libraries like Tailwind.

// Menu: project-scaffolder 👷‍♂️
// Description: Step by step project scaffolding with Vite
const projectsDirectory = '/Users/austin/repos';
const folder = await arg({
placeholder: 'Enter project name 📁',
validate: (choice) => (choice ? true : 'Please enter a folder name.')
});
const framework = await arg('Pick a framework 👨‍💻', [
'react',
'svelte',
'preact',
'vanilla'
]);
const useTypescript =
framework === 'vanilla'
? 'false'
: await arg('Pick a flavor 🍦', [
{ name: 'TypeScript', value: true },
{ name: 'JavaScript', value: false }
]);
const packageManager = await arg('Package Manager?', ['npm', 'yarn', 'pnpm']);
setPlaceholder('building...🔨');
const command = `${packageManager} ${
packageManager === 'yarn' ? 'create' : 'init'
} @vitejs/app ${folder} -- --template ${framework}${useTypescript ? '-ts' : ''}`;
cd(projectsDirectory);
exec(command);
edit(`${projectsDirectory}/${folder}`);
Discuss Post