UNPKG

next13-starter

Version:

Start a Next13 Zustand TypeScript project in few second!

31 lines (23 loc) 699 B
#!/usr/bin/env node import { execSync } from 'child_process'; const runCommand = command => { try { execSync(command, { stdio: 'inherit' }); return true; } catch (e) { console.error(`Failed to execute ${command}`, e); return false; } }; const repoName = process.argv[2]; const gitCheckoutCommand = `git clone --depth 1 https://github.com/ryan-ahn/npm-next13-starter ${repoName}`; const installDepsCommand = `cd ${repoName} && npm install`; const checkedOut = runCommand(gitCheckoutCommand); if (!checkedOut) { process.exit(-1); } const installedDeps = runCommand(installDepsCommand); if (!installedDeps) { process.exit(-1); } console.log('======= Success =======');