UNPKG

create-turbosvelte

Version:

This is an unofficial SvelteKit monorepo starter powered by Turborepo.

31 lines (23 loc) 957 B
#!/usr/bin/env node const { execSync } = require('child_process'); const runCommand = (command) => { try { execSync(`${command}`, { stdio: 'inherit' }); } catch (err) { console.error(`Failed to execute ${command}`, err); return false; } return true; }; const repoName = process.argv[2] ? process.argv[2] : 'turbo-svelte'; const gitCheckoutCommand = `npx degit brisklemonade/turbosvelte ${repoName}`; const installDepsCommand = `cd ${repoName} && git init && npm i`; console.log(`Cloning the repository with name ${repoName}`); const checkedOut = runCommand(gitCheckoutCommand); if (!checkedOut) process.exit(-1); console.log(`Initializing an empty repo and Installing dependencies for ${repoName}`); const installedDeps = runCommand(installDepsCommand); if (!installedDeps) process.exit(-1); console.log('\nCongratulations your project is ready! Follow the step(s) below to start'); console.log(`1. cd ${repoName}`); console.log(`Enjoy!`);