Skip to content

Commit 897eff0

Browse files
Add my-app (Vite + React + TS), fix root lockfile, deploy to Pages (#2)
Scaffolds my-app/ as a standalone Vite + React + TypeScript + Tailwind SPA, syncs the root package-lock.json with package.json so npm ci works again, and adds a GitHub Pages deploy workflow with a CNAME for niteshacars.in. Merged at the repo owner's request. CI is red from pre-existing failures that reproduce on main and are unrelated to these changes; see the pull request description for the four causes.
2 parents 9b3c97c + 00e0c9e commit 897eff0

17 files changed

Lines changed: 2256 additions & 24 deletions
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Deploy my-app
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'my-app/**'
8+
- '.github/workflows/deploy-my-app.yml'
9+
workflow_dispatch:
10+
11+
# Allow GITHUB_TOKEN to publish to Pages.
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Let an in-flight deploy finish; queue at most one more.
18+
concurrency:
19+
group: pages
20+
cancel-in-progress: false
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
defaults:
26+
run:
27+
working-directory: my-app
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version: 22
34+
cache: npm
35+
cache-dependency-path: my-app/package-lock.json
36+
37+
- name: Install
38+
run: npm ci
39+
40+
- name: Lint
41+
run: npm run lint
42+
43+
- name: Build
44+
run: npm run build
45+
46+
- uses: actions/upload-pages-artifact@v3
47+
with:
48+
path: my-app/dist
49+
50+
deploy:
51+
needs: build
52+
runs-on: ubuntu-latest
53+
environment:
54+
name: github-pages
55+
url: ${{ steps.deployment.outputs.page_url }}
56+
steps:
57+
- id: deployment
58+
uses: actions/deploy-pages@v4

my-app/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

my-app/.oxlintrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["react", "typescript", "oxc"],
4+
"rules": {
5+
"react/rules-of-hooks": "error",
6+
"react/only-export-components": ["warn", { "allowConstantExport": true }]
7+
}
8+
}

my-app/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# my-app
2+
3+
A React single-page app built with Vite, TypeScript, and Tailwind CSS.
4+
5+
## Requirements
6+
7+
- Node.js 20.19+ / 22.12+
8+
9+
## Getting started
10+
11+
```bash
12+
npm install
13+
npm run dev
14+
```
15+
16+
The dev server prints a local URL (http://localhost:5173 by default).
17+
18+
## Scripts
19+
20+
| Command | Description |
21+
| ----------------- | ------------------------------------------------ |
22+
| `npm run dev` | Start the dev server with hot module replacement |
23+
| `npm run build` | Type-check and build to `dist/` |
24+
| `npm run preview` | Serve the production build locally |
25+
| `npm run lint` | Lint with oxlint |
26+
27+
## Layout
28+
29+
```
30+
my-app/
31+
├── index.html # HTML entry point
32+
├── vite.config.ts # Vite config (React + Tailwind plugins)
33+
├── public/ # Static files copied as-is
34+
└── src/
35+
├── main.tsx # App bootstrap
36+
├── App.tsx # Root component
37+
└── index.css # Tailwind entry
38+
```
39+
40+
## Deployment
41+
42+
Deployed to GitHub Pages at <https://niteshacars.in> by
43+
`.github/workflows/deploy-my-app.yml`, which builds this directory and
44+
publishes `dist/`.
45+
46+
It runs on pushes to `main` that touch `my-app/`, and can also be started
47+
by hand from the Actions tab (Run workflow).
48+
49+
`public/CNAME` holds the custom domain. Vite copies `public/` into `dist/`
50+
verbatim, so the file lands at the site root where Pages expects it.
51+
Removing it reverts the site to the default `*.github.io` address.

my-app/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>my-app</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)