A simple, responsive Minesweeper game built with React and Vite.
- Classic gameplay: reveal cells, toggle flags with right-click
- Safe first click: your first reveal won't detonate a mine
- Difficulty presets: Beginner, Intermediate, Expert
- Timer and mines-left counters
- Keyboard accessible buttons and ARIA live status
npm run dev— start the dev servernpm run build— production build todist/npm run preview— preview the production buildnpm run lint— run ESLint
- Right-click to place a flag (or long-press on touch devices depending on OS/browser).
- If you lose, all mines are revealed.
- React 18
- Vite 5
- ESLint (flat config)
Azure Static Web Apps is the best fit for this Vite React SPA.
Prereqs: Code in a GitHub repo, Azure subscription.
Option A — Azure Portal:
- In the Azure portal: Create resource → Static Web App.
- Connect GitHub, pick this repo and the
mainbranch. - Build parameters:
- App location:
/ - Output location:
dist - API location: leave empty
- App location:
- Complete creation. A GitHub Actions workflow and token will be set up.
- Push to
mainto trigger deployment. The site URL appears in the Static Web App Overview.
Option B — Azure CLI:
# Login and set up Static Web Apps extension
az login
az extension add --name staticwebapp --upgrade
# Create a resource group (pick your region)
az group create --name rg-minesweeper --location westus2
# Create the Static Web App connected to your GitHub repo
az staticwebapp create `
--name minesweeper-swa `
--resource-group rg-minesweeper `
--source https://github.com/<your-org>/<your-repo> `
--branch main `
--location westus2 `
--app-location "/" `
--output-location "dist" `
--login-with-githubLocal verify before deploy (optional):
npm run build
npm run previewNotes:
- There is no
npm startin Vite; usenpm run devfor local dev,npm run previewto serve the build. - Client-side routing is configured via
staticwebapp.config.jsonto fall back toindex.html.
-
Azure Storage Static Website:
az login az group create --name rg-minesweeper --location westus2 az storage account create --name mystorage12345 --resource-group rg-minesweeper --location westus2 --sku Standard_LRS # Enable static website with SPA fallback az storage blob service-properties update ` --account-name mystorage12345 ` --static-website ` --index-document index.html ` --404-document index.html npm run build az storage blob upload-batch ` --account-name mystorage12345 ` --destination '$web' ` --source ./dist
-
Azure App Service:
- Build locally (
npm run build) and deploydist/via GitHub Actions or Zip Deploy. - Serve static content (e.g., with Nginx) and ensure SPA fallback to
index.html.
- Build locally (