Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hanzlamateen committed Jul 27, 2024
0 parents commit 4ad3689
Show file tree
Hide file tree
Showing 31 changed files with 829 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy

on:
push:
branches:
- main

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Install dependencies
run: npm install

- name: Build project
run: npm run build

- name: Upload production-ready build files
uses: actions/upload-artifact@v3
with:
name: production-files
path: ./dist

deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'

steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: production-files
path: ./dist

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
package-lock.json
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/node_modules/**
**/*.d.ts
18 changes: 18 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"trailingComma": "none",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always",
"proseWrap": "never",
"endOfLine": "lf",
"importOrder": ["<THIRD_PARTY_MODULES>", "", "", "^[./]"],
"plugins": ["prettier-plugin-organize-imports", "@ianvs/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"],
"tailwindFunctions": ["twMerge"]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Hanzla Mateen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# website

## References

<https://github.com/daisyui/react-daisyui>
<https://stackblitz.com/edit/daisyui-react-vite-62pzsn>
<https://www.vddeveloper.online/blog/vite-react-deploy-github>
<https://leerob.io/blog/nextjs-sitemap-robots>
<https://react-icons.github.io/react-icons/>
Binary file added assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 94 additions & 0 deletions assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/assets/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hello React Github Pages</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
55 changes: 55 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "react-gh-pages-boilerplate",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"postbuild": "node scripts/generate-static-files.mjs",
"format-staged": "lint-staged",
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
"lint": "prettier --check \"src/**/*.{ts,tsx}\"",
"clean-node-modules": "npx rimraf node_modules && npx rimraf package-lock.json"
},
"pre-commit": [
"format-staged"
],
"lint-staged": {
"*.{ts,tsx}": [
"prettier --write"
],
"*.scss": [
"stylelint --fix"
]
},
"resolutions": {
"@types/react": "18.2.0",
"react": "18.2.0"
},
"dependencies": {
"@fontsource/poppins": "^5.0.14",
"animate.css": "^4.1.1",
"react": "18.2.0",
"react-animate-on-scroll": "^2.1.9",
"react-dom": "18.2.0",
"react-icons": "^5.2.1",
"react-router-dom": "^6.25.1",
"typescript": "5.4.5"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "4.1.0",
"@originjs/vite-plugin-commonjs": "^1.0.3",
"@tailwindcss/typography": "^0.5.13",
"@types/node": "^20.14.11",
"@types/react": "18.2.0",
"@types/react-dom": "18.2.0",
"autoprefixer": "^10",
"daisyui": "^4",
"postcss": "^8",
"prettier": "3.0.2",
"prettier-plugin-organize-imports": "^3.2.3",
"prettier-plugin-tailwindcss": "^0.5.11",
"react-daisyui": "^5.0.0",
"tailwindcss": "^3.3.2",
"vite": "5.1.7"
}
}
3 changes: 3 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
plugins: [require("tailwindcss"), require("autoprefixer")],
};
2 changes: 2 additions & 0 deletions robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Sitemap: https://{YOUR_WEBSITE_DOMAIN_HERE}/sitemap.xml
38 changes: 38 additions & 0 deletions scripts/generate-static-files.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import fs from 'fs'
import path from 'path'
import routes from '../src/constants/routes.json' assert { type: 'json' }

const destinationFolder = 'dist'
const filesToCopy = ['sitemap.xml', 'robots.txt', 'CNAME']

// Copy files from the root of the project to the dist folder
for (const sourceFile of filesToCopy) {
const destinationFile = path.join(destinationFolder, sourceFile)

fs.copyFile(sourceFile, destinationFile, (err) => {
if (err) {
console.error(`Error copying file ${sourceFile}`, err)
} else {
console.log(`File ${sourceFile} copied successfully`)
}
})
}

// Create a new HTML file for each route based on the index.html file
for (const route in routes) {
if (route === 'Home') {
continue
}
const routeName = routes[route]
const routeFileName = `${routeName.replace('/', '')}.html`
const routeHtml = path.join(destinationFolder, routeFileName)
const indexHtml = path.join(destinationFolder, 'index.html')

fs.copyFile(indexHtml, routeHtml, (err) => {
if (err) {
console.error(`Error copying file ${routeFileName}`, err)
} else {
console.log(`File ${routeFileName} copied successfully`)
}
})
}
10 changes: 10 additions & 0 deletions sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc><!-- YOUR WEBSITE ROOT DOMAIN HERE --></loc>
</url>
<url>
<loc><!-- YOUR WEBSITE OTHER DOMAIN ROUTE HERE --></loc>
</url>
</url>
</urlset>
19 changes: 19 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

body {
font-family: 'Poppins';
}

.prose {
max-width: none;
}

.prose img {
margin: 0px;
}

/* .navbar {
box-shadow: 0px 25px 23px 0px rgba(0, 0, 0, 0.1);
} */
Loading

0 comments on commit 4ad3689

Please sign in to comment.