Bilingual (English/Chinese) static site for parents about child eye care.
npm install
npm run devThen open the URL shown in the terminal.
The project is already a git repo with an initial commit. To put it on GitHub:
-
Create a new repository on GitHub
- Go to github.com/new.
- Repository name: e.g.
parentguidebook-eyecare(or any name you prefer). - Choose Private or Public. Do not add a README, .gitignore, or license (this repo already has them).
- Click Create repository.
-
Add the remote and push (replace
YOUR_USERNAMEandREPO_NAMEwith your GitHub username and repo name):git remote add origin https://github.com/YOUR_USERNAME/REPO_NAME.git git push -u origin main
-
Connect to Cloudflare Pages (see Deployment → Option B below) so every push deploys automatically.
npm run build
npm run preview-
Log in to Cloudflare (one time):
npx wrangler login
-
Deploy:
npm run deploy
This builds the site and uploads the
distfolder to Cloudflare Pages. If the project doesn’t exist yet, Wrangler will prompt you to create it. -
Custom domain: In the Cloudflare dashboard → Pages → your project → Custom domains, add eyecare.parentguidebook.org.
- Push this repo to GitHub or GitLab.
- In Cloudflare Dashboard → Workers & Pages → Create → Pages → Connect to Git.
- Choose the repo and set:
- Build command:
npm run build - Build output directory:
dist - Deploy command (if required):
npx wrangler pages deploy dist --project-name=eyecare-parentguidebook - Root directory: (leave default)
- Environment variables: None needed. Set Node.js version to 18 or higher if available.
- Build command:
- After the first deploy, add custom domain eyecare.parentguidebook.org.
This repo includes wrangler.jsonc so the built dist folder is deployed as static assets. Use this if your project is a Worker with a separate deploy/version command.
- Build command:
npm run build - Deploy command (or Version command, whichever runs after the build): set to
npm run deploy-worker.- This runs
wrangler versions uploadwith 3 retries and a 15s delay between attempts. Cloudflare’s API sometimes returns 504 Gateway Timeout on the asset upload; retrying usually succeeds. - If you prefer no retries, you can set the deploy command to
npx wrangler versions uploadinstead.
- This runs
- Ensure the project API token has Account → Workers Edit and User → User Details → Read.
- Redeploy. The Worker will serve the static site from the
distdirectory.
- Build command:
npm run build - Build output directory:
dist - Node: 18+