Skip to content

Commit dacd838

Browse files
committed
feat: update package.json for deployment and add husky pre-commit hook
fix: refactor header component to use Link from react-router-dom feat: enhance ProjectsPage with dynamic project rendering and filtering feat: add NotFoundPage for handling 404 errors in router chore: configure Vite for deployment and source maps chore: add environment variables for GitHub token and login chore: set up husky pre-commit hook to run checks test: add Jest configuration and initial test cases test: create mock file for asset imports in tests test: implement sample tests for basic functionality test: add tests for HomePage component with dark/light mode test: set up testing library for better assertions
1 parent 2e0647c commit dacd838

File tree

385 files changed

+1400
-7794
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

385 files changed

+1400
-7794
lines changed

.github/workflows/build.js.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ name: Build
55

66
on:
77
push:
8-
branches: ['main']
8+
branches: ['main', 'V3']
99
pull_request:
10-
branches: ['main']
10+
branches: ['main', 'V3']
1111

1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
1515

1616
strategy:
1717
matrix:
18-
node-version: [14.x, 16.x, 18.x]
18+
node-version: [16.x, 18.x, 20.x]
1919
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2020

2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v3
24+
uses: actions/setup-node@v4
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
cache: 'npm'
2828
- run: npm ci
29-
- run: npm run build --if-present
29+
- run: npm run build

.github/workflows/install.js.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ name: Installation
55

66
on:
77
push:
8-
branches: ['main']
8+
branches: ['main', 'V3']
99
pull_request:
10-
branches: ['main']
10+
branches: ['main', 'V3']
1111

1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
1515

1616
strategy:
1717
matrix:
18-
node-version: [14.x, 16.x, 18.x]
18+
node-version: [16.x, 18.x, 20.x]
1919
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2020

2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v3
24+
uses: actions/setup-node@v4
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
cache: 'npm'

.github/workflows/lint.js.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ name: Linting
55

66
on:
77
push:
8-
branches: ['main']
8+
branches: ['main', 'V3']
99
pull_request:
10-
branches: ['main']
10+
branches: ['main', 'V3']
1111

1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
1515

1616
strategy:
1717
matrix:
18-
node-version: [16.x, 18.x]
18+
node-version: [16.x, 18.x, 20.x]
1919
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2020

2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v3
24+
uses: actions/setup-node@v4
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
cache: 'npm'

.github/workflows/tests.js.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ name: Tests
55

66
on:
77
push:
8-
branches: ['main']
8+
branches: ['main', 'V3']
99
pull_request:
10-
branches: ['main']
10+
branches: ['main', 'V3']
1111

1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
1515

1616
strategy:
1717
matrix:
18-
node-version: [14.x, 16.x, 18.x]
18+
node-version: [16.x, 18.x, 20.x]
1919
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2020

2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v3
24+
uses: actions/setup-node@v4
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
cache: 'npm'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
# misc
1515
.DS_Store
16+
.env
1617
.env.local
1718
.env.development.local
1819
.env.test.local

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run check

.vscode/settings.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22
"workbench.colorCustomizations": {
33
"activityBar.activeBackground": "#4d004a",
44
"activityBar.background": "#4d004a",
5-
"activityBar.foreground": "#e7e7e7",
6-
"activityBar.inactiveForeground": "#e7e7e799",
7-
"activityBarBadge.background": "#5c6000",
8-
"activityBarBadge.foreground": "#e7e7e7",
9-
"commandCenter.border": "#e7e7e799",
105
"sash.hoverBorder": "#4d004a",
116
"statusBar.background": "#1a0019",
12-
"statusBar.foreground": "#e7e7e7",
137
"statusBarItem.hoverBackground": "#4d004a",
148
"statusBarItem.remoteBackground": "#1a0019",
15-
"statusBarItem.remoteForeground": "#e7e7e7",
169
"titleBar.activeBackground": "#1a0019",
17-
"titleBar.activeForeground": "#e7e7e7",
1810
"titleBar.inactiveBackground": "#1a001999",
19-
"titleBar.inactiveForeground": "#e7e7e799"
11+
"editorGroup.border": "#4d004a",
12+
"panel.border": "#4d004a",
13+
"sideBar.border": "#4d004a",
14+
"statusBar.border": "#1a0019",
15+
"statusBar.debuggingBackground": "#001a01",
16+
"statusBar.debuggingBorder": "#001a01",
17+
"tab.activeBorder": "#4d004a",
18+
"titleBar.border": "#1a0019"
2019
},
2120
"peacock.color": "#1a0019"
2221
}

README.md

Lines changed: 59 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,51 +14,85 @@ In the project directory, you can run:
1414

1515
### `npm start`
1616

17-
Runs the app in the development mode.\
18-
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
17+
Runs the app in development mode using Vite.\
18+
Open [http://localhost:5173](http://localhost:5173) to view it in your browser.
1919

2020
The page will reload when you make changes.\
2121
You may also see any lint errors in the console.
2222

23-
### `npm test`
24-
25-
Launches the test runner in the interactive watch mode.\
26-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
27-
2823
### `npm run build`
2924

30-
Builds the app for production to the `build` folder.\
31-
It correctly bundles React in production mode and optimizes the build for the best performance.
25+
Builds the app for production to the `dist` folder.\
26+
It correctly bundles React in production mode and optimizes the build for the best performance using Vite.
3227

3328
The build is minified and the filenames include the hashes.\
3429
Your app is ready to be deployed!
3530

36-
### `npm run deploy`
31+
### `npm run preview`
3732

38-
Deploy your react application to GitHub Pages. This deploys a build to a branch called `gh-pages`.
39-
That should directly deploy to the production version of the website.
40-
[Extra Info Here](https://www.c-sharpcorner.com/article/how-to-deploy-react-application-on-github-pages/)
33+
Locally preview the production build.\
34+
Serves the content from the `dist` folder.
4135

42-
### `npm run eject`
36+
### `npm test`
4337

44-
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
38+
Launches Jest test runner.\
39+
Run `npm run test:watch` for interactive watch mode.\
40+
Run `npm run test:cov` for coverage reports.
4541

46-
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
42+
### `npm run lint`
4743

48-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc.) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
44+
Runs ESLint to check for code quality and style issues.\
45+
Automatically fixes issues where possible.
4946

50-
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
47+
### `npm run format`
5148

52-
## Learn More
49+
Runs Prettier to format code consistently.
50+
51+
### `npm run deploy`
5352

54-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
53+
Deploy your React application to GitHub Pages.\
54+
This builds the app and deploys it to the `gh-pages` branch.
5555

56-
To learn React, check out the [React documentation](https://reactjs.org/).
56+
### `npm run check`
5757

58-
### Making a Progressive Web App
58+
Runs the full quality check pipeline: build, format, lint, and test with coverage.
5959

60-
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
60+
## Development Setup
6161

62-
### Advanced Configuration
62+
1. **Clone the repository**
63+
```bash
64+
git clone https://github.com/Vaporjawn/Vaporjawn.github.io.git
65+
cd Vaporjawn.github.io
66+
```
67+
68+
2. **Install dependencies**
69+
```bash
70+
npm install
71+
```
72+
73+
3. **Start development server**
74+
```bash
75+
npm start
76+
```
77+
78+
4. **Run tests**
79+
```bash
80+
npm test
81+
```
82+
83+
## Tech Stack
84+
85+
- **Framework**: React 18 with TypeScript
86+
- **Build Tool**: Vite
87+
- **UI Libraries**: Material-UI (MUI), FontAwesome
88+
- **Routing**: React Router DOM
89+
- **Testing**: Jest + React Testing Library
90+
- **Linting**: ESLint + Prettier
91+
- **Deployment**: GitHub Pages
92+
93+
## Learn More
6394

64-
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
95+
- [Vite Documentation](https://vitejs.dev/)
96+
- [React Documentation](https://reactjs.org/)
97+
- [TypeScript Documentation](https://www.typescriptlang.org/)
98+
- [Material-UI Documentation](https://mui.com/)

jest.config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
export default {
2+
preset: 'ts-jest',
3+
testEnvironment: 'jsdom',
4+
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
5+
moduleNameMapping: {
6+
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
7+
'\\.(gif|ttf|eot|svg|png)$': '<rootDir>/src/__mocks__/fileMock.js',
8+
},
9+
transform: {
10+
'^.+\\.(ts|tsx)$': ['ts-jest', {
11+
useESM: true,
12+
}],
13+
},
14+
extensionsToTreatAsEsm: ['.ts', '.tsx'],
15+
globals: {
16+
'ts-jest': {
17+
useESM: true,
18+
},
19+
},
20+
testMatch: [
21+
'<rootDir>/src/**/__tests__/**/*.(ts|tsx)',
22+
'<rootDir>/src/**/*.(test|spec).(ts|tsx)',
23+
],
24+
collectCoverageFrom: [
25+
'src/**/*.(ts|tsx)',
26+
'!src/**/*.d.ts',
27+
'!src/main.tsx',
28+
'!src/vite-env.d.ts',
29+
],
30+
coverageDirectory: 'coverage',
31+
coverageReporters: ['text', 'lcov', 'html'],
32+
coverageThreshold: {
33+
global: {
34+
branches: 80,
35+
functions: 80,
36+
lines: 80,
37+
statements: -10,
38+
},
39+
},
40+
};

old files/package.json

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)