Skip to content

Commit 1aaeb8d

Browse files
authored
Merge pull request #8 from fells-code/dev
CI update for release flow
2 parents 79f637f + 464808b commit 1aaeb8d

File tree

14 files changed

+585
-734
lines changed

14 files changed

+585
-734
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Bug report
2+
description: Report a problem
3+
title: '[Bug]: '
4+
labels: ['bug']
5+
assignees: []
6+
7+
body:
8+
- type: markdown
9+
attributes:
10+
value: |
11+
Thanks for taking the time to report an issue.
12+
13+
- type: textarea
14+
id: description
15+
attributes:
16+
label: What happened?
17+
description: Describe the bug clearly and concisely.
18+
validations:
19+
required: true
20+
21+
- type: textarea
22+
attributes:
23+
label: Steps to Reproduce
24+
description: Provide minimal reproduction steps
25+
validations:
26+
required: true
27+
28+
- type: textarea
29+
attributes:
30+
label: Expected Behavior
31+
validations:
32+
required: true
33+
34+
- type: textarea
35+
attributes:
36+
label: Environment
37+
description: Node version, package version, OS
38+
39+
- type: textarea
40+
id: logs
41+
attributes:
42+
label: Logs / stack traces
43+
render: shell
44+
validations:
45+
required: false

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Feature request
2+
description: Suggest an improvement or new capability
3+
title: '[Feature]: '
4+
labels: ['enhancement']
5+
assignees: []
6+
7+
body:
8+
- type: markdown
9+
attributes:
10+
value: |
11+
Feature requests are welcome. Please keep them focused and actionable.
12+
13+
- type: textarea
14+
id: problem
15+
attributes:
16+
label: Problem statement
17+
description: What problem are you trying to solve?
18+
validations:
19+
required: true
20+
21+
- type: textarea
22+
id: solution
23+
attributes:
24+
label: Proposed solution
25+
description: Describe the behavior you would like to see.
26+
validations:
27+
required: true
28+
29+
- type: textarea
30+
id: alternatives
31+
attributes:
32+
label: Alternatives considered
33+
description: Any workarounds or alternative approaches?
34+
validations:
35+
required: false

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Summary
2+
3+
Describe the change.
4+
5+
## Type of Change
6+
7+
- [ ] Feature
8+
- [ ] Fix
9+
- [ ] Refactor
10+
- [ ] Documentation
11+
- [ ] Test
12+
13+
## Checklist
14+
15+
- [ ] Tests pass
16+
- [ ] No breaking changes
17+
- [ ] Docs updated (if needed)
18+
- [ ] Security implications considered

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: CI
22

33
on:
4-
push:
5-
branches: ['**']
64
pull_request:
75
branches: ['**']
86

@@ -29,7 +27,11 @@ jobs:
2927
- name: Run Tests with Coverage
3028
run: npm test -- --coverage
3129

30+
- name: Build
31+
run: npm run build
32+
3233
- name: Upload coverage reports to Codecov
34+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
3335
uses: codecov/codecov-action@v5
3436
with:
3537
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release-beta.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
permissions:
1111
contents: write
12-
id-token: write # for npm provenance (optional)
12+
id-token: write
1313
steps:
1414
- name: Checkout repo
1515
uses: actions/checkout@v4

.github/workflows/release.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Release
22

33
on:
44
push:
5-
branches:
6-
- main
5+
tags:
6+
- 'v*'
77

88
jobs:
99
release:
@@ -15,9 +15,8 @@ jobs:
1515
node-version: 20
1616
registry-url: https://registry.npmjs.org/
1717
- run: npm ci
18-
- run: npm run build
19-
- name: Semantic Release (main)
18+
19+
- name: Publish to npm
2020
env:
21-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
23-
run: npx semantic-release
21+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
22+
run: npm publish

CONTRIBUTING.md

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
# Contributing to Seamless Auth
2+
3+
Thank you for contributing to Seamless Auth.
4+
5+
## Philosophy
6+
7+
Seamless Auth is:
8+
9+
- Passwordless-first
10+
- Security-focused
11+
- Minimal and intentional
12+
- Infrastructure-grade software
13+
14+
## Before You Start
15+
16+
For non-trivial changes:
17+
18+
1. Open an issue first
19+
2. Explain the motivation
20+
3. Describe your proposed solution
21+
4. Wait for feedback
22+
23+
## Development Setup (React SDK)
24+
25+
The React SDK is developed against a real Seamless Auth server instance.
26+
27+
Contributors must run the local Seamless Auth server while developing changes to this package.
28+
29+
---
30+
31+
## 1. Fork and Clone
32+
33+
Fork the repository and clone it locally:
34+
35+
```bash
36+
# Clone the auth server code or your forks
37+
git clone https://github.com/fells-code/seamless-auth-api.git
38+
39+
# Clone the react SDK
40+
git clone https://github.com/fells-code/seamless-auth-react.git
41+
```
42+
43+
---
44+
45+
## 2. Run the Seamless Auth Server
46+
47+
```bash
48+
cd seamless-auth-api
49+
cp .env.example .env
50+
```
51+
52+
> IMPORTANT
53+
> Change the AUTH_MODE env to "web" NOT "server".
54+
> Change the APP_ORIGIN env to `http://localhost:5173` to match vite
55+
> This lets you authenticate between a web app and the auth server with no need for an API.
56+
57+
### If docker and docker compose are avaliable
58+
59+
```bash
60+
docker compose up -d
61+
```
62+
63+
> If you are using docker you can stop here and move on to Step 3.
64+
65+
### If not using docker
66+
67+
Start postgres in whatever way your system does e.g. on mac
68+
69+
```bash
70+
brew services start postgresql
71+
```
72+
73+
### Prepare the database
74+
75+
```bash
76+
npm install
77+
78+
npm run db:create
79+
npm run db:migrate
80+
81+
npm run dev
82+
```
83+
84+
---
85+
86+
Ensure the server is running locally (default: `http://localhost:5312`).
87+
88+
```bash
89+
curl http://localhost:5312/health/status
90+
91+
## Expected result
92+
## {"message":"System up"}
93+
```
94+
95+
---
96+
97+
## 3. Create a Local Test Application
98+
99+
You will need a web application to integerate the SDK into.
100+
We recommend using Vite for fast iteration:
101+
102+
```bash
103+
# If still in the auth directory
104+
cd ../
105+
106+
npm create vite@latest seamless-auth-dev
107+
### Select React as the framework, Typescript as the variant
108+
```
109+
110+
> Web site will be active at http://localhost:5137
111+
112+
---
113+
114+
## 4. Link the React Package
115+
116+
From the `seamless-auth-react` repository:
117+
118+
```bash
119+
npm install
120+
npm link
121+
```
122+
123+
Then inside your test application:
124+
125+
```bash
126+
npm link @seamless-auth/react
127+
npm install react-router-dom
128+
```
129+
130+
---
131+
132+
## 5. Wrap Your Application with AuthProvider
133+
134+
Update `main.tsx`:
135+
136+
```tsx
137+
// main.tsx
138+
import { StrictMode } from 'react';
139+
import { createRoot } from 'react-dom/client';
140+
import { AuthProvider, AuthRoutes, useAuth } from '@seamless-auth/react';
141+
import './index.css';
142+
import App from './App.tsx';
143+
import { BrowserRouter, Route, Routes } from 'react-router-dom';
144+
145+
// eslint-disable-next-line react-refresh/only-export-components
146+
function ApplicationRoutes() {
147+
const { isAuthenticated } = useAuth();
148+
149+
return (
150+
<Routes>
151+
{isAuthenticated ? (
152+
<Route path="*" element={<App />} />
153+
) : (
154+
<Route path="*" element={<AuthRoutes />} />
155+
)}
156+
</Routes>
157+
);
158+
}
159+
160+
createRoot(document.getElementById('root')!).render(
161+
<StrictMode>
162+
<BrowserRouter>
163+
<AuthProvider apiHost="http://localhost:5312" mode="web">
164+
<ApplicationRoutes />
165+
</AuthProvider>
166+
</BrowserRouter>
167+
</StrictMode>
168+
);
169+
```
170+
171+
---
172+
173+
## 6. Run the SDK in Watch Mode
174+
175+
Inside `seamless-auth-react`:
176+
177+
```bash
178+
npm run build -- --watch
179+
```
180+
181+
Changes will automatically rebuild and propagate to your linked development application.
182+
183+
## 7. Good working state
184+
185+
If all went well you should have a directory structure like this
186+
187+
```bash
188+
.
189+
├── seamless-auth-api
190+
├── seamless-auth-dev
191+
└── seamless-auth-react
192+
```
193+
194+
Navigating to `http://localhost:5173` give you the seamless auth login page.
195+
196+
If so you are ready to start dev work
197+
198+
## Expectations
199+
200+
When submitting a pull request:
201+
202+
- Ensure the SDK works against a running local auth server
203+
- Verify login, logout, and session behavior
204+
- Confirm role-based logic works as expected
205+
- Run lint and tests before submitting
206+
207+
This ensures changes remain aligned with real authentication flows and infrastructure behavior.
208+
209+
## Commit Conventions
210+
211+
- feat:
212+
- fix:
213+
- docs:
214+
- refactor:
215+
- test:
216+
- chore:
217+
218+
Example:
219+
220+
feat: add configurable token expiration override
221+
222+
## Pull Requests Must
223+
224+
- Be scoped
225+
- Include tests
226+
- Update docs
227+
- Pass CI
228+
229+
## Licensing
230+
231+
By contributing, you agree your contributions fall under the project license.

0 commit comments

Comments
 (0)