A real development environment.
Web-based so you can connect to it from anywhere.
The editor should, however, be familiar.
Github is spinning up a virtual computer in their data center that is connected on one side to your Github repository and on the other to a development environment that runs in your browser.
It may take a minute to open up.
When your codespace is open, at the bottom left there is an indicator of what branch you are on.
You can also click on it to get a menu to switch to a different branch or create a new one.
You will use this to create new branches and to switch to existing branches.
Close the Codespace tab when you’re done.
You can use the same Code menu later to reconnect.
Just to get the feel of things we’re going to create a couple files and commit them to git.
The next dozen or so slides will walk you though the process, step by step.
Open your codespace and make sure the branch indicator shows that you are on the main
branch.
If, for some reason, you are not on main, click the indicator and use the menu to switch to main
.
Create a branch named setup
Create a file named .gitignore
.
Make sure you haven’t selected a folder and then click the new file icon. Then type the name, with the leading dot.
In the editor type: node_modules/
Create another file, this time named start-project
.
Go to http://bit.ly/3jNmGX2 and copy the contents and paste them into this new file.
Now we need to do one little bit of magic to make our lives easier later on.
To do that we’re going to have to venture into the command line.
Right click on the start-project
file in the file explorer and choose “Open in Integrated Terminal”
That will open a terminal under the editor. This is kind of like the REPL in our old environment.
Your prompt will look a little different than mine but basically the same.
Like the REPL, you type things at the terminal and hit return to execute them.
However it doesn’t understand Javascript.
Instead it understands commands in a language called bash
.
At the terminal, first type:
chmod +x start-project
and hit return.
There’s no output from running this command but it has marked start-project
as a progam that we can run later.
Click the version control icon
The “2” indicates there are two changes and the “U”s next to the two new files indicates they aren’t yet in git.
This is a brief description of the changes you are making.
This causes the changes to be saved to be “commited” to the current branch also “pushed” to your Github repository.
You’ll probably get this warning. Click “Yes”.
Then you’ll probably get this warning. Click “Yes” here too.
Go to Github website and create a pull request for the setup
branch and request my review.
When I approve it, merge the PR and delete the branch.