Skip to content

Commit efd2220

Browse files
authored
Merge pull request #8 from weaponsforge/feature/weaponsforge-3
Feature/weaponsforge 3
2 parents a4fc669 + 1638e93 commit efd2220

File tree

15 files changed

+193
-35
lines changed

15 files changed

+193
-35
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_BASE_PATH=''

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
lint-client:
1010
name: Lint Client
1111
runs-on: ubuntu-latest
12+
env:
13+
NEXT_PUBLIC_BASE_PATH: ${{ secrets.NEXT_PUBLIC_BASE_PATH }}
1214
steps:
1315
- name: Checkout the repository
1416
uses: actions/checkout@v3

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy to GitHub Pages
2+
3+
# This workflow will trigger on any tag/release created on *any* branch
4+
# Make sure to create tags/releases only from the "master" branch for consistency
5+
on:
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
lint-client:
11+
name: Lint and Export client
12+
runs-on: ubuntu-latest
13+
env:
14+
NEXT_PUBLIC_BASE_PATH: ${{ secrets.NEXT_PUBLIC_BASE_PATH }}
15+
steps:
16+
- name: Checkout the repository
17+
uses: actions/checkout@v3
18+
- name: Use NodeJS v16.14.2
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: 16.14.2
22+
- name: Install Dependencies and lint
23+
run: npm install
24+
- name: Lint
25+
run: npm run lint
26+
- name: Export static files
27+
run: |
28+
npm run export
29+
mv out/404/index.html out/404.html
30+
- name: Disable Jekyll
31+
run: touch out/.nojekyll
32+
- name: Archive Development Artifact
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: main-out
36+
path: out
37+
retention-days: 3
38+
39+
deploy-client:
40+
name: Deploy client to Github Pages
41+
needs: lint-client
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Download Artifact
45+
uses: actions/download-artifact@v3
46+
with:
47+
name: main-out
48+
- name: List files for publish
49+
run: ls -l -a
50+
- name: Deploy to Github Pages
51+
uses: peaceiris/actions-gh-pages@v3
52+
with:
53+
github_token: ${{ secrets.GITHUB_TOKEN }}
54+
publish_dir: ./
55+
publish_branch: gh-pages

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ yarn-error.log*
2727

2828
# local env files
2929
.env*.local
30+
.env*.development
31+
*.env
3032

3133
# vercel
3234
.vercel
3335

3436
# typescript
3537
*.tsbuildinfo
3638
next-env.d.ts
39+
40+
*.zip

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ Testing display of all related content based on a URL query string.
1717
1. Install dependencies.<br>
1818
`npm install`
1919

20+
2. Set up the environment variables. Create a `.env`, `.env.local` and a `.env.development` files inside the root project directory with reference to the `.env.example` file.<br>
21+
22+
| Variable Name | Description |
23+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
24+
| NEXT_PUBLIC_BASE_PATH | Root directory path name that NextJS uses for assets, media and client-side routing for the app.<br><br>Set its value to blank `''` when working on development mode in localhost.<br>Set its value to the sub-directory name where the exported NextJS app is to be deployed, i.e. `/<YOUR_REPOSITORY_NAME>` when deploying on a repository (sub-directory) of a root GitHub Pages site, i.e, on `https://<YOUR_GITHUB_USERNAME>.github.io/<YOUR_REPOSITORY_NAME>` |
25+
2026
## Usage
2127

2228
1. Run the app in development mode.<br>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Link from 'next/link'
2+
import styles from '@/styles/Navigation.module.css'
3+
4+
function Navigation () {
5+
return (
6+
<span className={styles.container}>
7+
<Link href='/'>Start</Link> |&nbsp;
8+
<Link href='/home'>Home</Link> |&nbsp;
9+
<Link href='/home/cafe'>Cafe</Link> |&nbsp;
10+
<Link href='/about'>About</Link>
11+
</span>
12+
)
13+
}
14+
15+
export default Navigation

components/layout/section/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import PropTypes from 'prop-types'
2+
import styles from '@/styles/Section.module.css'
3+
4+
function Section ({ children }) {
5+
return (
6+
<div className={styles.containersection}>
7+
{children}
8+
</div>
9+
)
10+
}
11+
12+
Section.propTypes = {
13+
children: PropTypes.node
14+
}
15+
16+
export default Section

jsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
"compilerOptions": {
33
"baseUrl": ".",
44
"paths": {
5+
"@/components/*": ["components/*"],
56
"@/pages/*": ["pages/*"],
7+
"@/public/*": ["public/*"],
68
"@/styles/*": ["styles/*"]
79
}
810
}
9-
}
11+
}

next.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
33
reactStrictMode: true,
4+
trailingSlash: true,
5+
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
46
images: {
57
unoptimized: true
68
},
79
eslint: {
8-
dirs: ['pages', 'styles']
10+
dirs: ['components', 'pages', 'styles']
911
},
12+
env: {
13+
NEXT_PUBLIC_BASE_PATH: process.env.NEXT_PUBLIC_BASE_PATH
14+
}
1015
}
1116

1217
module.exports = nextConfig

pages/about/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Section from '@/components/layout/section'
2+
import Navigation from '@/components/layout/navigation'
3+
4+
function About () {
5+
return (
6+
<Section>
7+
<h1>About</h1>
8+
<Navigation />
9+
10+
<p>This is the About Page</p>
11+
</Section>
12+
)
13+
}
14+
15+
export default About

0 commit comments

Comments
 (0)