Skip to content

Commit 8dfc208

Browse files
authored
Update packages to address GHSA-9qr9-h5gf-34mp (#557)
Update npm packages to address security alert GHSA-9qr9-h5gf-34mp (https://github.com/AlexJSully/AlexJSully-Portfolio/security/dependabot/92).
1 parent 6b30424 commit 8dfc208

File tree

11 files changed

+280
-171
lines changed

11 files changed

+280
-171
lines changed

.github/prompts/audit-docs.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: 'Audit and Update docs/ Directory'
3+
scope: 'repo'
4+
targets:
5+
- 'docs/'
6+
- 'codebase'
7+
labels:
8+
- 'documentation'
9+
- 'audit'
10+
- 'mermaid'
11+
---
12+
13+
Purpose:
14+
While reviewing the #activePullRequest, analyze the entire #codebase and ensure
15+
that the #file:docs directory is fully up to date, consistent, and accurate based
16+
on the current implementation.
17+
18+
What to do:
19+
20+
1. Audit the `docs/` directory against the real codebase
21+
- Identify documentation gaps, inaccuracies, outdated explanations, or missing sections.
22+
- Cross-check code comments, architecture, directory structure, core modules, exposed APIs, utilities, and workflows.
23+
24+
2. Update documentation as necessary
25+
- Revise outdated sections.
26+
- Add missing content.
27+
- Rewrite unclear explanations.
28+
- Add short code snippets where they meaningfully clarify how something works.
29+
30+
3. Use visual diagrams as frequently as appropriate
31+
- Prefer Mermaid diagrams to explain architecture, flows, relationships, state transitions, data movement, or component interactions.
32+
- Choose diagram types that best communicate the system (e.g., `flowchart`, `sequenceDiagram`, `classDiagram`, `stateDiagram`, `gitGraph`).
33+
- When explaining logic, system or architecture, include Mermaid diagrams when applicable.
34+
35+
4. Ensure architectural accuracy
36+
- Validate that the documented behavior matches real code.
37+
- If implementation diverges from existing docs, update docs to match real behavior.
38+
39+
5. Maintain a concise, structured writing style
40+
- Keep explanations clear and self–contained.
41+
- Avoid unnecessary verbosity.
42+
- Highlight important behaviors or assumptions explicitly.
43+
44+
6. Make changes directly
45+
- Modify documentation files.
46+
- Add new files if needed.
47+
- Update diagrams.
48+
- Include only meaningful and defensible changes; do not generate placeholder text.
49+
50+
Goal:
51+
Produce a clean, accurate, comprehensively updated `docs/` directory that fully
52+
reflects the current implementation, backed by diagrams and practical examples.
53+
54+
Acceptance checklist (use as review checklist):
55+
56+
- [ ] Audit `docs/` for correctness against actual code
57+
- [ ] Fix or update inaccurate/outdated pages
58+
- [ ] Add missing sections or examples
59+
- [ ] Add Mermaid diagrams where helpful
60+
- [ ] Ensure examples are runnable/accurate
61+
- [ ] Run repository `validate` (format, lint and testing) are passing and fix markdown lint issues. For example #file:package.json `npm run validate`
62+
63+
Notes:
64+
65+
- Prefer concrete changes only; avoid adding placeholders or speculative content.

docs/architecture/components/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ flowchart TD
2525

2626
## 🔍 Component Details
2727

28-
- **Navbar:** Top navigation bar, links to sections. Handles navigation, accessibility, and analytics logging.
28+
- **Navbar:** Top navigation bar, links to sections. Handles navigation, accessibility, and logs analytics via `logAnalyticsEvent`.
2929
- **Banner:** Header section, may include avatar and intro. Displays profile and branding.
30-
- **ProjectsGrid:** Displays project cards in a grid. Handles filtering, analytics, and responsive layout.
31-
- **Publications:** Lists publications with metadata. Supports links to external resources.
32-
- **Footer:** Social media links and copyright. Includes contact and resume links.
30+
- **ProjectsGrid:** Displays project cards in a grid. Located at `src/components/projects/ProjectsGrid.tsx`. Handles filtering, analytics (uses `logAnalyticsEvent`), and responsive layout.
31+
- **Publications:** Lists publications with metadata. Located at `src/components/publications/Publications.tsx`. Supports external links and logs analytics on interactions.
32+
- **Footer:** Social media links and copyright. Located at `src/components/footer/Footer.tsx`. Includes contact and resume links and logs analytics.
3333
- **CookieSnackbar:** Shows cookie consent. Manages cookie state and user interaction.
3434
- **StarsBackground:** Visual background effect. Renders animated stars for visual appeal.
3535

docs/architecture/components/projects.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ The projects grid is displayed using the `ProjectsGrid` component located in [Pr
1010

1111
### Key Elements
1212

13-
- **State Management:** Uses React `useState` to toggle featured/all projects.
14-
- **Grid Layout:** Responsive grid via MUI Grid/Stack.
15-
- **Project Cards:** Thumbnail, name, title, employer, resource links.
13+
- **State Management:** Uses React `useState` and local component state to manage view toggles and UI interactions.
14+
- **Grid Layout:** Responsive grid via MUI `Grid`/`Stack` and CSS-in-JS styles.
15+
- **Project Cards:** Thumbnail, name, title, employer, resource links. The component imports the project data from `src/data/projects.ts`.
16+
- **Analytics:** The component calls `logAnalyticsEvent` for user interactions (e.g., clicking a project link or viewing details).
1617

1718
### Flowchart
1819

@@ -79,9 +80,9 @@ flowchart LR
7980

8081
### Adding Thumbnail Images
8182

82-
To add a thumbnail image for the new project, place the image in the appropriate directory:
83+
To add a thumbnail image for a new project, place the image in the appropriate directory:
8384

84-
1. **Navigate to the images directory**: Go to the [public image projects directory](../../public/images/projects).
85+
1. **Navigate to the images directory**: Go to the `public/images/projects` directory.
8586
2. **Create a new directory**: Create a new directory with the project ID (e.g., `new-project`).
8687
3. **Add the thumbnail image**: Place the thumbnail image in the new directory and name it `thumbnail.webp`. Recommended to use `.webp` format for better performance.
8788

docs/architecture/components/publications.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ The publications list is displayed using the `Publications` component located in
1111
### Key Elements
1212

1313
- **Styling**: The component uses inline styles to manage the appearance of publication metadata.
14-
- **List Layout**: The publications are displayed in a responsive list layout using Material-UI's Stack and Typography components.
15-
- **Publication Cards**: Each publication is displayed as a card with a title, authors, metadata, and an abstract.
14+
-- **List Layout**: The publications are displayed in a responsive list layout using Material-UI's `Stack` and `Typography` components.
15+
-- **Publication Cards**: Each publication is displayed as a card with a title, authors, metadata, and an abstract. Data is imported from `src/data/publications.ts` and the component logs user interactions via `logAnalyticsEvent`.
1616

1717
### Flowchart
1818

@@ -29,7 +29,7 @@ flowchart LR
2929

3030
## Adding New Publications
3131

32-
To add new publications, you need to update the `publications` array in [publications.ts](../../src/data/publications.ts).
32+
To add new publications, update the `publications` array in `src/data/publications.ts`.
3333

3434
### Steps to Add a New Publication
3535

docs/architecture/components/socials.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ flowchart LR
2727

2828
## Adding New Social Media Links
2929

30-
To add new social media links, you need to update the `socials` array in [socials.ts](../../src/data/socials.ts).
30+
To add new social media links, update the `socials` array in `src/data/socials.ts`.
3131

3232
### Steps to Add a New Social Media Link
3333

docs/architecture/configs.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,22 @@ Configs manage environment variables, service integrations, and global settings
1919

2020
## 🔍 Usage Examples
2121

22-
### Importing Firebase Config
22+
### Firebase configuration and usage
23+
24+
The runtime `src/configs/firebase.ts` exposes two named functions you should use from the app:
2325

2426
```ts
25-
import firebaseConfig from '@configs/firebase';
27+
import { init, logAnalyticsEvent } from '@configs/firebase';
28+
29+
// Initialize Firebase (call once on app start)
30+
init();
2631

27-
// Initialize Firebase app
32+
// Log analytics events anywhere in the app
33+
logAnalyticsEvent('my_event', { foo: 'bar' });
2834
```
2935

36+
There is no default export in the implementation — use the named exports above.
37+
3038
### Using Environment Variables
3139

3240
```ts
@@ -35,6 +43,8 @@ const apiKey = process.env.NEXT_PUBLIC_API_KEY;
3543

3644
### Sentry Configuration
3745

46+
Sentry is configured via the repository's `sentry.*.config.ts` files. Use Sentry's Next.js SDK initialization patterns in those files; the app uses the standard `@sentry/nextjs` entrypoints. Example usage in application code:
47+
3848
```ts
3949
import * as Sentry from '@sentry/nextjs';
4050

docs/architecture/pwa.md

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,58 +39,43 @@ flowchart TD
3939

4040
### Manifest Generation (`src/app/manifest.ts`)
4141

42-
Instead of a static `manifest.json`, we use a TypeScript file to generate the manifest dynamically. This allows for type safety and easier maintenance.
42+
The app exports a `MetadataRoute.Manifest` from `src/app/manifest.ts`. Next.js will expose this manifest to the browser as `/manifest.webmanifest` when the app is built and served. Using a TypeScript manifest lets you keep manifest values close to application code and use type safety.
4343

44-
```typescript
45-
// src/app/manifest.ts
44+
Example usage (the app's implementation returns a full `MetadataRoute.Manifest` object and the root layout references the manifest at `'/manifest.webmanifest'`):
45+
46+
```ts
47+
// src/app/manifest.ts (exports a Next.js manifest)
4648
import type { MetadataRoute } from 'next';
4749

4850
export default function manifest(): MetadataRoute.Manifest {
4951
return {
5052
name: "Alexander Sullivan's Portfolio",
5153
short_name: "Alexander Sullivan's Portfolio",
52-
// ... other properties
5354
icons: [
54-
{
55-
src: '/icon/android-chrome-192x192.png',
56-
sizes: '192x192',
57-
type: 'image/png',
58-
},
59-
// ... other icons
55+
{ src: '/icon/android-chrome-192x192.png', sizes: '192x192', type: 'image/png' },
56+
// ...
6057
],
58+
// ...other fields
6159
};
6260
}
6361
```
6462

6563
### Service Worker Lifecycle
6664

67-
While `next-pwa` previously handled service worker generation, native Next.js apps can use manual service worker registration or rely on standard browser caching headers.
65+
This project includes a manual service worker implementation at `public/sw.js` and registers it from the client. The app registers the service worker in two places:
6866

69-
```mermaid
70-
sequenceDiagram
71-
participant User
72-
participant Browser
73-
participant Network
74-
participant Cache
75-
76-
User->>Browser: Visits Site
77-
Browser->>Network: Request Resources
78-
Network-->>Browser: Return Resources
79-
Browser->>Cache: Cache Static Assets (via Headers)
80-
81-
opt Offline Mode
82-
User->>Browser: Visits Site (Offline)
83-
Browser->>Cache: Check Cache
84-
Cache-->>Browser: Return Cached Assets
85-
end
86-
```
67+
- `src/components/ServiceWorkerRegister.tsx` — a small client component that calls `navigator.serviceWorker.register('/sw.js')` inside a `useEffect`.
68+
- `src/app/page.tsx` — the home page also calls `navigator.serviceWorker.register('/sw.js')` during its initial `useEffect` (this is a defensive duplicate to ensure registration on client navigations).
69+
70+
The service worker uses a cache-first / stale-while-revalidate strategy for static assets and network-first for navigation requests. See `public/sw.js` for the exact implementation.
8771

8872
## Customization
8973

9074
To modify PWA settings:
9175

92-
1. **Manifest**: Edit `src/app/manifest.ts` to change app name, colors, or icons.
76+
1. **Manifest**: Edit `src/app/manifest.ts` to change app name, colors, or icons. The root layout uses `manifest: '/manifest.webmanifest'` so changes will propagate at runtime.
9377
2. **Icons**: Add or replace images in `public/icon/` and update the manifest accordingly.
78+
3. **Service Worker**: Edit `public/sw.js` to customize caching strategies or precached assets.
9479

9580
## Related Docs
9681

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Service Worker Implementation
2+
3+
This file documents the service worker implementation used by the site.
4+
5+
## Where it lives
6+
7+
- Service worker file: `public/sw.js`
8+
- Registration client: `src/components/ServiceWorkerRegister.tsx`
9+
- Root layout also renders `ServiceWorkerRegister` in `src/app/layout.tsx`.
10+
11+
## Behavior summary
12+
13+
- The service worker precaches a small set of core assets (`/`, `/manifest.webmanifest`, `/icon/favicon.ico`).
14+
- Navigation requests (HTML) use a **network-first** strategy with a cache fallback.
15+
- Static assets use a **cache-first** with background stale-while-revalidate update flow.
16+
- The worker skips cross-origin requests, Next.js dev paths (`/_next/`) and API calls.
17+
18+
## How the app registers the service worker
19+
20+
The app registers the SW from a client component that runs inside the browser:
21+
22+
```tsx
23+
import { useEffect } from 'react';
24+
25+
export default function ServiceWorkerRegister() {
26+
useEffect(() => {
27+
if ('serviceWorker' in navigator) {
28+
navigator.serviceWorker
29+
.register('/sw.js')
30+
.then((reg) => console.log('Service Worker registered with scope', reg.scope))
31+
.catch((err) => console.error('Service Worker registration failed:', err));
32+
}
33+
}, []);
34+
35+
return null;
36+
}
37+
```
38+
39+
The home page (`src/app/page.tsx`) also attempts to register the same `'/sw.js'` as a defensive measure for client navigations.
40+
41+
## Customizing caching
42+
43+
Edit `public/sw.js` to change `PRECACHE_URLS`, cache names, or strategy. Keep the SW path at `/sw.js` to match the registration call.

docs/usage/setup.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,16 @@ This guide walks you through installing, configuring, and running the AlexJSully
3939

4040
## ⚙️ Configuration
4141

42-
- **Environment Variables:**
43-
- See `.env.example` (if present) for required variables.
44-
- Configure Firebase, Sentry, and other integrations as needed.
42+
- **Environment Variables (common keys):**
43+
- `NEXT_PUBLIC_FIREBASE_API_KEY`
44+
- `NEXT_PUBLIC_FIREBASE_ID`
45+
- `NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID`
46+
- `NEXT_PUBLIC_FIREBASE_APP_ID`
47+
- `NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID`
48+
- `NEXT_PUBLIC_SENTRY_DSN` (if Sentry is used in your environment)
49+
Place these keys in a local `.env` file during development. Do not commit `.env` to git.
4550
- **Path Aliases:**
46-
- Use TypeScript aliases (see `tsconfig.json`).
51+
- Use TypeScript aliases (see `tsconfig.json`). The project exposes aliases like `@components`, `@data`, `@configs`, `@helpers`, and `@images` for cleaner imports.
4752

4853
## 🧪 Testing & Validation
4954

0 commit comments

Comments
 (0)