LinkORB Engineering

Getting started with GitHub Codespaces in [#github-codespaces]

What is GitHub Codespaces?

GitHub Codespaces is a way to quickly start a complete development environment for the project you’re working on.

More info:

How are GitHub Codespaces used at LinkORB?

We strongly encourage the use of GitHub Codespaces to avoid the complexity of setting up development environments. It’ll help you to work on and contribute code changes quicker by being able to focus on the code, instead of the environment and dependencies (databases, related services, networking, etc).

Am I required to use GitHub Codespaces?

It is absolutely not required to use GitHub Codespaces. If you are comfortable managing your development environments, or are working on improving the environment itself, feel free to use whichever (local or remote) tools you prefer: vscode, vi/vim, joe, nano, emacs or any other setup you like.

Listing your active Codespaces

Visit https://github.com/codespaces to list your active codespaces.

Starting a new Codespace

Once a GitHub Repository has been configured for Codespaces, it’s easy to spin up a development environment:

  1. Open your GitHub repository in your browser
  2. Click the Code dropdown-button
  3. Click the Codespaces tab
  4. Click the + (Plus) sign to create a new Codespace

It’ll open a web-based version of VSCode by default which you can use to edit code, test your application, and commit changes through as a pull request.

Restarting a previous Codespace

Simply visit https://github.com/codespaces to find your active codespaces, and click it’s title to jump back in.

Opening a terminal in VSCode

You can open a terminal to run command-line tools in your Codespace. This is useful to start your app, run tests, initialize databases, etc.

  1. Click the hamburger menu (top left)
  2. Click Terminal
  3. Click New terminal

Shortcut: Ctrl+Shift+Backtick

This will open a bar at the bottom of your IDE (by default), showing tabs like “Problems”, “Output”, “Terminal”, “Ports”.

The “Terminal” tab lists your opened terminals.

You can open and switch between multiple terminals by using the + (Plus) icon. If you’re running multiple terminals, a sidebar in the bottom right allows you to switch between them.

Notes on commonly used Codespaces

Engineering-Astro

The Engineering-Astro Codespace is setup to automatically start the Astro application server. However you may need to run the below commands in the terminal if the server doesn’t start or if it crashes.

$ npm install

The above will install necessary Node packages as defined in the package.json file. You should only need to do this when first setting up the environment.

$ npm run dev

This will start the Node server in the Codespace.

About GitHub Codespaces