This repository contains the source code for the official website of the SAU ACM Student Chapter, built using React and Vite.
Please read the following carefully before making changes or deploying.
This is a Vite/React project and requires a build step to generate the static HTML, CSS, and JavaScript files needed for deployment.
- Build Command:
npm run build(oryarn build) - Output Directory: The build process creates a
distdirectory containing the deployable website files.
This project is configured for deployment to multiple platforms. The configuration is sensitive to ensure correct asset paths.
Essential Configuration File:
vite.config.ts: Contains thebasepath setting.- This file uses
process.env.GITHUB_ACTIONSto conditionally set the correctbasepath:/sau-acm-student-chapter/for GitHub Pages builds (when run via the GitHub Actions workflow)./for local builds (used for cPanel deployment) and Netlify builds.
- Do not modify this logic unless you understand the implications for all deployment targets.
- This file uses
Deployment Targets:
-
GitHub Pages (Project Site):
- URL:
https://sau-acm-student-chapter.github.io/sau-acm-student-chapter/ - Deployment Method: Automated via GitHub Actions workflow (
.github/workflows/github-pages.yml). - Workflow details: Builds the project within the action (setting the correct base path) and pushes the
distcontents to thegh-pagesbranch. - Essential File: The workflow automatically adds a
.nojekyllfile to the deployment root (gh-pagesbranch) to ensure correct file serving. - Note: The
distfolder is not committed to themainbranch for this deployment method.
- URL:
-
cPanel (
sauchapter.acm.orgor similar):- Deployment Method: Manual Build & Commit using cPanel Git Version Control.
- Workflow:
- Make source code changes.
- Run
npm run buildlocally. This generates thedistfolder withbase: '/'. - Commit ALL changes, including the entire
distfolder, to themainbranch (git add .,git commit,git push). - Log in to cPanel -> Git Version Control -> Manage -> Pull or Deploy -> Update from Remote -> Deploy HEAD Commit.
- Essential Files:
.cpanel.yml: Contains the deployment script (copiesdist/*to/home/sauchapter/public_html/). Ensure theDEPLOYPATHis correct. Do not modify unless the deployment path changes.public/.htaccess: Contains Apache rewrite rules necessary for client-side routing to work on cPanel. This is copied todistduring the build.
- Requirement: You MUST run
npm run buildlocally and commit thedistfolder before pushing changes intended for cPanel deployment. The.cpanel.ymlscript only copies the committeddistfolder; it does not build the project.
-
Netlify:
- Deployment Method: Likely connected directly to the GitHub repository (
mainbranch). - Configuration: Netlify runs its own build process. The
vite.config.tscorrectly setsbase: '/'in the Netlify build environment (asGITHUB_ACTIONSis nottrue). - Build Settings (Typical): Check Netlify UI - usually
npm run build(oryarn build) as the build command anddistas the publish directory.
- Deployment Method: Likely connected directly to the GitHub repository (
.github/workflows/github-pages.yml: Defines the automated deployment to GitHub Pages..cpanel.yml: Defines the deployment steps for cPanel's Git feature (relies on committeddistfolder).vite.config.ts: Crucial build configuration, especially thebasepath logic.public/.htaccess: Required for correct routing on Apache servers (cPanel)..gitignore: Should not list/distif using the cPanel manual build & commit method. (Currently configured this way).
- Install dependencies:
npm install(oryarn install) - Run development server:
npm run dev(oryarn dev) - Linting/Formatting: (Add details if linters/formatters like ESLint/Prettier are set up)
Remember to keep documentation updated if build or deployment processes change.