Skip to content

Commit 2021595

Browse files
committed
feat: add Auth HI! documentation site with Nextra
- Set up Nextra 4 docs site with GitHub Pages deployment - Add comprehensive guides (getting started, patterns, examples, troubleshooting) - Include privacy policy and support pages for Chrome Web Store
1 parent 617cf5b commit 2021595

24 files changed

+5421
-17
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy Docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- '.github/workflows/deploy-docs.yml'
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: 'pages'
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v6
27+
28+
- name: Setup pnpm
29+
uses: pnpm/action-setup@v4
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v6
33+
with:
34+
node-version: 22
35+
cache: 'pnpm'
36+
cache-dependency-path: 'docs/pnpm-lock.yaml'
37+
38+
- name: Install dependencies
39+
working-directory: docs
40+
run: pnpm install
41+
42+
- name: Build
43+
working-directory: docs
44+
run: pnpm build
45+
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: docs/out
50+
51+
deploy:
52+
runs-on: ubuntu-latest
53+
needs: build
54+
permissions:
55+
pages: write
56+
id-token: write
57+
environment:
58+
name: github-pages
59+
url: ${{ steps.deployment.outputs.page_url }}
60+
steps:
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: deploy-pages@v4
64+

.github/workflows/release.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
release:
14+
name: Build and Release
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
21+
- name: Setup pnpm
22+
uses: pnpm/action-setup@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v6
26+
with:
27+
node-version: 22
28+
cache: 'pnpm'
29+
30+
- name: Install dependencies
31+
run: pnpm install
32+
33+
- name: Lint
34+
run: pnpm lint
35+
36+
- name: Type check
37+
run: pnpm type-check
38+
39+
- name: Test
40+
run: pnpm test
41+
42+
- name: Build
43+
run: pnpm build
44+
45+
- name: Get version from package.json
46+
id: package_version
47+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
48+
49+
- name: Create extension zip
50+
run: |
51+
cd dist
52+
zip -r ../auth-header-injector-${{ steps.package_version.outputs.version }}.zip .
53+
cd ..
54+
55+
- name: Create GitHub Release
56+
uses: softprops/action-gh-release@v2
57+
with:
58+
files: auth-header-injector-${{ steps.package_version.outputs.version }}.zip
59+
generate_release_notes: true
60+
draft: false
61+
prerelease: false
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+

.husky/pre-commit

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
# Get staged files
2-
files=$(git diff --cached --name-only --diff-filter=ACMR "*.ts" "*.tsx" "*.js" "*.jsx" | xargs)
3-
4-
if [ -n "$files" ]; then
5-
echo "Running Biome on staged files: $files"
6-
pnpm lint-staged $files
7-
git add $files
8-
fi
1+
# Run linting (same as CI)
2+
pnpm lint
93

104
# Run TypeScript type check
115
pnpm type-check

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"files": {
99
"ignoreUnknown": false,
10-
"ignore": ["node_modules", "dist", "coverage"]
10+
"ignore": ["node_modules", "dist", "coverage", "docs/.next", "docs/out"]
1111
},
1212
"formatter": {
1313
"enabled": true,

docs/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Next.js
5+
.next/
6+
out/
7+
8+
# Build output
9+
*.tsbuildinfo
10+
11+
# TypeScript
12+
next-env.d.ts
13+
14+
# Logs
15+
*.log
16+
npm-debug.log*
17+
18+
# OS
19+
.DS_Store
20+

docs/app/[[...mdxPath]]/page.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { useMDXComponents } from 'nextra-theme-docs';
2+
import { generateStaticParamsFor, importPage } from 'nextra/pages';
3+
4+
export const generateStaticParams = generateStaticParamsFor('mdxPath');
5+
6+
export async function generateMetadata(props: { params: Promise<{ mdxPath?: string[] }> }) {
7+
const params = await props.params;
8+
const { metadata } = await importPage(params.mdxPath);
9+
return metadata;
10+
}
11+
12+
export default async function Page(props: { params: Promise<{ mdxPath?: string[] }> }) {
13+
const params = await props.params;
14+
const result = await importPage(params.mdxPath);
15+
const { default: MDXContent, ...rest } = result;
16+
const { wrapper: Wrapper } = useMDXComponents();
17+
18+
return (
19+
<Wrapper {...rest}>
20+
<MDXContent />
21+
</Wrapper>
22+
);
23+
}

docs/app/globals.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
:root {
2+
--nextra-primary-hue: 263deg;
3+
--nextra-primary-saturation: 70%;
4+
}

docs/app/layout.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Footer, Layout, Navbar } from 'nextra-theme-docs';
2+
import { Head } from 'nextra/components';
3+
import { getPageMap } from 'nextra/page-map';
4+
import 'nextra-theme-docs/style.css';
5+
import './globals.css';
6+
7+
export const metadata = {
8+
title: {
9+
default: 'Auth HI!',
10+
template: '%s | Auth HI!',
11+
},
12+
description:
13+
'Chrome extension for injecting authentication headers into requests. Say hi to hassle-free auth headers.',
14+
};
15+
16+
const logo = (
17+
<span style={{ fontWeight: 'bold' }}>
18+
<span style={{ color: '#7c3aed' }}>Auth</span> <span style={{ color: '#10b981' }}>HI!</span>
19+
</span>
20+
);
21+
22+
export default async function RootLayout({ children }: { children: React.ReactNode }) {
23+
const pageMap = await getPageMap();
24+
25+
return (
26+
<html lang="en" dir="ltr" suppressHydrationWarning>
27+
<Head faviconGlyph="🔐" />
28+
<body>
29+
<Layout
30+
pageMap={pageMap}
31+
docsRepositoryBase="https://github.com/prosdevlab/auth-header-injector/tree/main/docs/content"
32+
editLink="Edit this page on GitHub"
33+
sidebar={{ defaultMenuCollapseLevel: 1 }}
34+
navbar={
35+
<Navbar logo={logo} projectLink="https://github.com/prosdevlab/auth-header-injector" />
36+
}
37+
footer={<Footer>MIT {new Date().getFullYear()} © prosdevlab</Footer>}
38+
>
39+
{children}
40+
</Layout>
41+
</body>
42+
</html>
43+
);
44+
}

docs/content/_meta.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
index: 'Home',
3+
'getting-started': 'Getting Started',
4+
guide: 'Guide',
5+
privacy: 'Privacy Policy',
6+
support: 'Support',
7+
};

docs/content/getting-started.mdx

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Getting Started
2+
3+
Get up and running with Auth HI! in minutes.
4+
5+
## Installation
6+
7+
### From Chrome Web Store
8+
9+
> 🚀 **Coming Soon** - Extension is currently in review
10+
11+
Once published, click "Add to Chrome" from the Chrome Web Store listing.
12+
13+
### From Source
14+
15+
If you want to build from source or contribute:
16+
17+
```bash
18+
# Clone the repository
19+
git clone https://github.com/prosdevlab/auth-header-injector.git
20+
cd auth-header-injector
21+
22+
# Install dependencies
23+
pnpm install
24+
25+
# Build the extension
26+
pnpm build
27+
28+
# Load in Chrome
29+
# 1. Open chrome://extensions/
30+
# 2. Enable "Developer mode"
31+
# 3. Click "Load unpacked"
32+
# 4. Select the `dist` folder
33+
```
34+
35+
## First Steps
36+
37+
### 1. Open the Side Panel
38+
39+
Click the extension icon in your Chrome toolbar. The side panel will open on the right side of your browser.
40+
41+
### 2. Enable the Extension
42+
43+
Toggle the "Enable extension" switch at the top of the panel.
44+
45+
### 3. Add Your First Rule
46+
47+
Click "Add Rule" and fill in:
48+
49+
- **Pattern**: URL pattern to match (e.g., `*.api.example.com`)
50+
- **Token**: Your Bearer token (just the token, not "Bearer ...")
51+
- **Label**: Optional friendly name (e.g., "Staging API")
52+
53+
Click "Save" and you're done!
54+
55+
### 4. Verify It's Working
56+
57+
1. Navigate to a page that makes API calls matching your pattern
58+
2. Check the "Context Bar" at the top - it shows matched rules
59+
3. See request counts increase as API calls are intercepted
60+
4. Open DevTools → Network tab → Check request headers
61+
62+
## Example: GitHub API
63+
64+
Let's set up auth for GitHub's API:
65+
66+
**Pattern**: `*github.com`
67+
**Token**: `ghp_yourPersonalAccessToken`
68+
**Label**: `GitHub API`
69+
70+
Now any requests to `github.com` or `api.github.com` will include your auth token automatically!
71+
72+
## Next Steps
73+
74+
- Learn about [URL Pattern Matching](/guide/patterns)
75+
- Explore [Common Use Cases](/guide/examples)
76+
- Check out [Troubleshooting](/guide/troubleshooting) if something's not working
77+
78+
## Need Help?
79+
80+
- [GitHub Issues](https://github.com/prosdevlab/auth-header-injector/issues) - Report bugs
81+
- [GitHub Discussions](https://github.com/prosdevlab/auth-header-injector/discussions) - Ask questions
82+

0 commit comments

Comments
 (0)