You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This assignment gets you from a clean dev container to a deployed GitHub Pages site using GitHub Actions, and introduces components, props, states and .map().
Reminder, Nov 7th lecture is extended workshop ( join in for atleast an hour via zoom with Kuri to work on this lab)
If you had issues setting this up during the lecture on Oct 31, Feel free to just use locally installed node.js
However, Please copy the error on KF6's React Discussion Page have these resolved next week with prof.C's office hours
0.2 Publish to GitHub
Inside the dev container window, under the "Source Control Tab", You should see a button to publish the repo to GitHub. If not, use the Command Palette (F1 or Ctrl+Shift+P) and select Publish to GitHub.
Make sure you choose a "Public" repo and name it profiles-app.
Checkpoint
Dev container with Node.js is running.
Repo profiles-app created and published to GitHub. Make sure it is public and visible online.
0.3 Enable Github Pages
In your repo on GitHub, go to Settings → Pages. Under Build and deployment, set the Source to GitHub Actions. This will allow the GitHub Actions workflow we create later to publish the site.
Part 2 - Deploy to GitHub Pages with GitHub Actions (CI)
We’ll use a single workflow that builds the Vite app and publishes dist/ to GitHub Pages.
2.1 Set the correct base path for a project site
For a project site hosted at https://<username>.github.io/<repo>/, Vite must know the base path:
vite.config.js (or vite.config.ts)
import{defineConfig}from'vite'importreactfrom'@vitejs/plugin-react'exportdefaultdefineConfig({plugins: [react()],base: '/profiles-app/'// <-- set to '/<repo-name>/'})
Tip: For React Router or other client-side routing, enable Vite's SPA fallback by placing a _redirects file if you use another host. GitHub Pages serves static files; with the base set, typical Vite SPA works for direct links to routes within the project path.
Link to commit diff that introduced components and .map().
README Template (can be added to your repo's README.md)
# Profiles App (Lab 1)## Dev Container> Talk about the image you are using here.!
For eg, if i were to use the Node.js dev container, I would write:
- Node.js dev container (image: `mcr.microsoft.com/devcontainers/javascript-node:20`)
-`corepack enable` to use npm/yarn/pnpm reliably
## Getting Started
\ ```bash
npm install
npm run dev
# open the shown URL (e.g., http://localhost:5173)
\ ```
## Build
\ ```bash
npm run build
\ ```
## Deploy (GitHub Pages via Actions)- Ensure `base: '/profiles-app/'` in `vite.config.js`- Push to `main`; the CI workflow will build and deploy automatically.
- Settings → Pages → Source: **GitHub Actions****Live URL:** https://<username>.github.io/profiles-app/
## Notes- Uses React + React-Bootstrap.
- We use components, props, and `.map()`.