# Setup

Bring a laptop and charger. Try these steps before the meeting so we can spend the hour writing code. If you get stuck, come anyway and we can help you set things up.

## Before Week 1

We need an editor to write code and a browser to see what it does. We'll use VS Code as the editor.

1. Download [Visual Studio Code](https://code.visualstudio.com/download) for your computer and install it. Open it once to make sure it works.
2. Create a folder called `practice-page`, somewhere you can find it again. Documents is fine.
3. In VS Code, open **File > Open Folder** and select `practice-page`.
4. Save [avatar.svg](https://wiki.sitblueprint.com/attachments/17) in that folder. If the link opens the picture, use your browser's Save As option. Keep the filename `avatar.svg`.

This picture is the only file you need before Week 1. We will create the HTML and CSS files during the meeting. You can use your usual browser to open the page.


## Before Week 3

This week, we will use Git from VS Code and its terminal. We will sign in with GitHub CLI, turn the `practice-page` folder into a repository, save its first version, and publish it from VS Code. Do not create a repository or upload the files on GitHub beforehand. We will do that together.

### Install Git and GitHub CLI

VS Code has a Source Control view, but it uses Git installed on your computer. GitHub CLI, whose command is `gh`, will connect Git on your computer to your GitHub account.

1. Follow the [Git installation instructions](https://git-scm.com/downloads) for your operating system. On Windows, keep the installer's default choices. On macOS, run `git --version` and accept the developer tools installation if macOS asks.
2. Follow the [GitHub CLI installation instructions](https://github.com/cli/cli#installation) for your operating system.
3. Close and reopen VS Code after both installations.
4. Open the `practice-page` folder in VS Code. Choose **Terminal > New Terminal**.
5. Enter both commands, pressing Enter after each one:

```sh
git --version
gh --version
```

Each command should show a version number. If the terminal says it cannot find `git` or `gh`, restart your computer and try once more. Bring the error to the meeting if it still does not work.

### Tell Git who you are

Git stores a name and email with each commit. In the VS Code terminal, replace the example values below with your own name and an email connected to your GitHub account:

```sh
git config --global user.name "Your Name"
git config --global user.email "yourname@stevens.edu"
git config --global init.defaultBranch main
```

Git will use this name and email for your commits on this computer. The last command makes new repositories start with a branch named `main`. To check what you saved, run:

```sh
git config --global --get user.name
git config --global --get user.email
```

Your commit email can be visible in a public repository. If you do not want to use a personal address, copy the no-reply address from your [GitHub email settings](https://github.com/settings/emails) and use it in the second command.

### Sign in through GitHub CLI

1. [Create a free GitHub account](https://github.com/signup) if you do not have one. Verify the email and sign in.
2. In the VS Code terminal, run these commands:

```sh
gh auth login --hostname github.com --git-protocol https --web
gh auth setup-git
gh auth status
```

The first command opens a browser so you can approve the sign-in. Return to the VS Code terminal when it finishes. The second command tells Git to use that sign-in when you clone, push, or pull. The last command should show your GitHub username and say that you are logged in to `github.com`.

3. In VS Code, open **Extensions** and install [GitHub Pull Requests](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github), published by GitHub. This extension may ask for its own account connection when we create a pull request. Git itself will still use the account shown by `gh auth status`.
4. Open your Week 2 page and try the button. The folder should contain `index.html`, `styles.css`, `script.js`, and `avatar.svg`. Use the [Week 2 example](downloads/week-02-reference.zip) if you need a copy.
5. Find a partner and exchange GitHub usernames. You will invite each other after the repositories are published during the meeting.

Desktop VS Code is required for this meeting because vscode.dev does not have a terminal or access to Git on your computer. If you cannot install VS Code, Git, or GitHub CLI, come anyway and work beside a partner. We will arrange time to help you finish your own setup.

The [VS Code Git quickstart](https://code.visualstudio.com/docs/sourcecontrol/quickstart), [GitHub CLI login guide](https://cli.github.com/manual/gh_auth_login), and [Git credential setup guide](https://cli.github.com/manual/gh_auth_setup-git) cover these steps.

## Before Week 4

This week, we will keep using the `practice-page` repository and add a React project inside it. The React project needs Node.js and npm. npm downloads the code the project depends on, and Node.js runs the tools that start and check the page.

React runs the page's interface in the browser. This starter uses Vite to process JSX and serve the files during development. Node.js runs those tools on your computer; npm installs their packages and runs commands. We are not setting up a custom store backend. The [Week 4 lesson](lessons/week-04-react.md#how-this-project-reaches-the-browser) explains the files after you open the starter.

### Install Node.js

1. Download and install the current **LTS** version from the [Node.js download page](https://nodejs.org/en/download/). LTS is the version recommended for most people.
2. Close and reopen VS Code after the installation.
3. Open the `practice-page` folder in VS Code. Choose **Terminal > New Terminal**.
4. Run both commands:

```sh
node --version
npm --version
```

Each command should show a version number. The supplied starter accepts Node `v20.19.0` through the rest of the `v20` line, or `v22.12.0` and newer. Installing the current LTS release is the easiest way to meet that requirement. Update Node if your version is older, and bring any error message to the meeting if one of the commands does not work.

### Add the React starter

1. Download the [Week 4 starter](https://wiki.sitblueprint.com/attachments/20) and extract the ZIP.
2. Move the extracted `react-page` folder into `practice-page`. You should have `practice-page/react-page` when you finish.
3. Keep `practice-page` open in VS Code. A terminal runs commands inside a current folder. A new VS Code terminal normally starts in the folder you opened. `cd react-page` means “change directory”: enter the `react-page` folder inside the current one. `cd ..` moves up one folder. If you are unsure where you are, `pwd` shows the path in macOS, Linux, or PowerShell; `cd` by itself shows it in Windows Command Prompt. Start at `practice-page` and run:

```sh
cd react-page
npm install
npm run dev
```

4. Open the **Local** address shown in the terminal. You should see the React starter page.
5. Return to the terminal and press Ctrl+C to stop the development server.
6. Run `cd ..` so the terminal returns to the top of `practice-page`.

Do not initialize another Git repository inside `react-page`. The existing `practice-page` repository will track the React files. Do not commit the starter before the meeting; we will create a branch and save the changes together.

Desktop VS Code is required because this meeting uses the terminal, Node.js, and Git. If your setup does not work, come anyway and work beside a partner.