[00:00] Combining the GitHub CLI as well as npm create to launch the Vite template scaffolder, we can create a project locally and push it to GitHub, including a code sandbox link, all in a single command. To walk through this, when we run the GitHub CLI with githubapi user, We'll get back an object that can grab our login. The jq flag will allow us to pluck off the login from that object. So .login and we'll get our username back. From there we can fire off pnpm create-beat, pnpm create-beat, egghead-demo with a template of react And you'll see that created a project.
[00:37] We have to change directories into that and then run all the commands. And then going into this directory, if we git init, git add everything, and git commit with a message of init or whatever. Then we can use github repo create and we'll make this public and just base it on the current directory. You can see we now have a repository called egghead-demo and once we go ahead and git push to the origin of main, we'll bring this back over, refresh, and our local project is now on GitHub. So let's take this one step further to finish out the script.
[01:11] We can github repo delete. I'm going to delete JohnLinquist slash egghead demo, confirm it, then remove this locally, and show our script in action. So share react project, we'll name this egghead demo, and you can see it walks through all of the steps that we walked through, but it grabs the project name as a variable, it grabs the GitHub username as a variable, and then it creates a code sandbox link with the username and project name, and it appends that link to our readme. So now once we bring this back over, This was deleted, I just hadn't refreshed yet, so I'll reload. Now we have this project and it has an edit in code sandbox link at the bottom where we can click this, it takes us to code sandbox, and we'll launch our project to share with anyone.
[01:59] So now we can get back to work on our project and anything we push will also be available in Code Sandbox.