So far, Generic Grocery Co.’s site and its whole history have lived in one folder on one laptop. That works fine right up until the laptop meets a cup of coffee. In this course, the site moves to GitHub and from there onto a second computer in the store’s back office, so the work can happen in two places and no longer depends on a single machine.
In this lesson, you’ll get the starting code, either from a ZIP or by updating the repository you already have, and you’ll check that the site runs and that Git remembers every commit. Start with a quick look at what that history already holds.
Look Back at the Site So Far
The first two courses turned a folder of handmade copies into a project that a team could work on. If you took them, then you know these habits. If you’re starting here, then they’re the ones every change in this course follows:
- A
.gitignorebefore the first commit, sonotes.txt,node_modules/,dist/, and.envstay out of the history git statusandgit diffbefore you stage, files staged by name, and one logical change per commit with a short, imperative subject line- Branches for work that breaks the site for a while, merged back into
mainonce they’re ready, using both merge commits and fast-forwards - An npm project with a committed lockfile, run with Vite’s dev server and built into
dist/ - The store’s Generic Curbside key in an ignored
.env, with a committed.env.examplethat shows what goes in.env
The new starting point is that finished site plus one setup commit, “Plan the move to GitHub”. It changes two files:
README.mdreplaces the old to-do list with a short note. From now on, the work arrives as issues on the project’s GitHub repository, and a commit that finishes one hasCloses #followed by the issue’s number in its message. The issue closes once that commit reachesmainon GitHub.scripts/check.jsnow also reports on the project’s GitHub repository and its issues, and on a few things that come up when two computers share one project.
Get the Starting Code
Both routes use the same download, the store’s site at the start of this course:
The ZIP contains a generic-grocery folder with a hidden .git folder inside, so the whole history comes along with the files. If you finished the last course and want to keep your own commits, then continue in your repository. Otherwise, start fresh from the ZIP. Either way, you end up with the same site and the same check script.
Start From the ZIP
For a fresh copy, extract the ZIP wherever you keep your projects. Open the generic-grocery folder in VS Code with File → Open Folder…, then open a terminal with Terminal → New Terminal. As the README’s Run it section says, install the project’s packages once:
$ npm install
added 16 packages, and audited 17 packages in 1s
8 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
On macOS, npm also reports that it blocked an install script for fsevents. Leave it unapproved, because the site doesn’t need it.
The pickup page also needs the store’s publishable key in .env. The ZIP doesn’t include that file, because .gitignore keeps it out of Git. Copy the example file:
$ cp .env.example .env
This command works in macOS and Linux terminals, in Git Bash, and in PowerShell. Open .env and replace the placeholder with the key. Like every key in this course, it’s fake:
.env
# The store's publishable Generic Curbside key (curb_pub_...), never the secret one.
VITE_CURBSIDE_KEY=curb_pub_fake_7Rk3vNw5
The setup commit is already in the ZIP’s history, so you’re ready for the checks below.
Keep Your Own Repository
If you already have your own generic-grocery repository from the last course, then you can keep working in it and bring in only the setup commit’s two files. Extract the ZIP somewhere other than your project, such as your Downloads folder, because the extracted folder has the same name as your project folder. Then, in a terminal in your own generic-grocery folder, copy the files over:
$ cp ~/Downloads/generic-grocery/README.md .
$ cp ~/Downloads/generic-grocery/scripts/check.js scripts/
If you extracted the ZIP somewhere else, then change the ~/Downloads part to match. Before you stage anything, look at what you’re about to record:
$ git status
On branch main
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: README.md
modified: scripts/check.js
no changes added to commit (use "git add" and/or "git commit -a")
$ git diff --stat
README.md | 24 +------
scripts/check.js | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 215 insertions(+), 23 deletions(-)
The README loses its ticked-off to-do list and gains the note about issues. Most of the new lines in scripts/check.js are the GitHub checks. Run git diff to read both changes, and press Q to leave the pager. Then stage the two files by name and commit them:
$ git add README.md scripts/check.js
$ git commit -m "Plan the move to GitHub"
[main 1099ba8] Plan the move to GitHub
2 files changed, 215 insertions(+), 23 deletions(-)
Your hash will be different from 1099ba8 because a commit’s hash depends on its author and time, and those are yours.
Check That Everything Works
Whichever route you took, you now check the same three things. First, the site itself. Start Vite’s dev server:
$ npm run dev
npm notice run [email protected] dev
npm notice run vite
VITE v8.3.8 ready in 210 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
Hold Ctrl, or Cmd on macOS, and click the Local address to open it in VS Code’s integrated browser. The home page shows the “Open now” badge, a line starting with Today:, and the weekly and holiday hours. Click through to the pickup page, too. It should show a Pickup time menu and an Order for pickup button. When you’re done, press Ctrl+C in the terminal to stop the server.
Second, the history. Run git log --oneline and read it from the bottom up:
$ git log --oneline
93c6d8e (HEAD -> main) Plan the move to GitHub
d2b8295 Take curbside pickup orders through Generic Curbside
de7887a Show the deals with their dates once their week has ended
d6009ea Merge branch 'main' into vite
ffbfdd2 Open at 10 a.m. on New Year's Day
33ff508 Close at 3 p.m. on Christmas Eve
389462f Build all four pages with Vite
0ce89bd Show an "Open now" badge on the home page
3086a88 Run the site on Vite's dev server
d3c2c61 Install dayjs for the badge's date math
f7ed937 Turn the site into an npm project
09de33d Plan the move to npm and Vite
b1e655b Close at 2 p.m. on Thanksgiving
1815f51 Fix the spelling of Produce on the departments page
69564a5 Add the bakery to the departments page
1d8c739 Start the deals for the week of November 25
de361ed Tick off the phone number to-do
1c4f029 Mark down the cranberries for the rest of the week
2124b2d Add .gitignore to the README's file table
632dbe3 Update the phone number in the footer
ad57ce5 Remove the hand-made copies of the deals
0aae397 Add the store's site as it arrived
That’s the ZIP’s history, with the merge of the holiday fixes in the middle. If the list ends in (END), then press Q to get back to your prompt. If you kept your own repository, then your hashes will differ, and your setup commit sits on top.
Third, the repository as a whole:
$ npm run check
npm notice run [email protected] check
npm notice run node scripts/check.js
Checking the Git repository in /Users/martin/projects/generic-grocery
✔ Git is installed (git version 2.43.0).
✔ The project folder is a Git repository.
✔ Your commits are labeled Martin Breuss <[email protected]>.
✔ .gitignore keeps notes.txt out of the repository.
✔ .gitignore keeps .DS_Store out of the repository.
✔ The history has 22 commit(s).
✔ npm is version 12 or later.
✔ You're on the main branch.
✔ package.json has "type": "module".
✔ package.json has a "check" script, so npm run check runs this report.
✔ .gitignore keeps node_modules/ out of the repository.
✔ package-lock.json is tracked, so every copy installs the same package versions.
✔ .gitignore keeps .env out of the repository.
✔ .env.example is committed, with a placeholder instead of the key.
✔ No tracked file holds a Generic Curbside secret key (curb_sec_...).
✔ No file has leftover conflict markers.
✔ Everything is committed.
All checks passed.
Your report shows your own name and folder. If you kept your own repository, then you’ll see one more line, Everything on the vite branch is in main. A line marked ✘ or ! comes with a Next step, so follow it and run the check again.
The report doesn’t mention GitHub yet, because your repository isn’t connected to it. The GitHub checks run only after you connect your repository, and from then on, they’ll grow with every lesson. If a line in your report puzzles you, then the button below opens a chat with the mentor and fills in a question. Paste your report after it:
Everything checks out, so the project is ready to leave your laptop. In the next lesson, you’ll create the store’s repository on GitHub and connect your laptop’s repository to it.