Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed May 16, 2023
0 parents commit 95d0fe7
Show file tree
Hide file tree
Showing 49 changed files with 9,521 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"separate-pull-requests": true,
"packages": {
"packages/odd-passkeys": {},
"packages/odd-preact": {}
}
}
4 changes: 4 additions & 0 deletions .github/release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"packages/odd-passkeys": "0.0.1",
"packages/odd-preact": "0.0.1"
}
34 changes: 34 additions & 0 deletions .github/workflows/odd-passkeys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: odd-passkeys
env:
CI: true
FORCE_COLOR: 1
on:
push:
branches:
- main
paths:
- 'packages/odd-passkeys/**'
- '.github/workflows/odd-passkeys.yml'
- 'pnpm-lock.yaml'
pull_request:
paths:
- 'packages/odd-passkeys/**'
- '.github/workflows/odd-passkeys.yml'
- 'pnpm-lock.yaml'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- run: pnpm install
- run: pnpm run build
- run: pnpm -r --filter @oddjs/passkeys run lint
- run: pnpm -r --filter @oddjs/passkeys run test
- run: pnpm -r --filter @oddjs/passkeys exec depcheck
34 changes: 34 additions & 0 deletions .github/workflows/odd-preact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: odd-preact
env:
CI: true
FORCE_COLOR: 1
on:
push:
branches:
- main
paths:
- 'packages/odd-preact/**'
- '.github/workflows/odd-preact.yml'
- 'pnpm-lock.yaml'
pull_request:
paths:
- 'packages/odd-preact/**'
- '.github/workflows/odd-preact.yml'
- 'pnpm-lock.yaml'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- run: pnpm install
- run: pnpm run build
- run: pnpm -r --filter @oddjs/preact run lint
- run: pnpm -r --filter @oddjs/preact run test
- run: pnpm -r --filter @oddjs/preact exec depcheck
35 changes: 35 additions & 0 deletions .github/workflows/passkey-auth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: passkey-auth
env:
CI: true
FORCE_COLOR: 1
on:
push:
branches:
- main
paths:
- 'examples/passkey-auth/**'
- '.github/workflows/passkey-auth.yml'
- 'pnpm-lock.yaml'
pull_request:
paths:
- 'packages/passkey-auth/**'
- '.github/workflows/passkey-auth.yml'
- 'pnpm-lock.yaml'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- run: pnpm install
- run: pnpm -r --filter passkey-auth run build
# - uses: fission-suite/[email protected]
# with:
# machine_key: ${{ secrets.FISSION_MACHINE_KEY }}
# workdir: 'examples/passkey-auth'
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release
env:
CI: true
FORCE_COLOR: 1
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
outputs:
paths_released: ${{ steps.release.outputs.paths_released }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
# needs to be personal token so release PRs can run workflows
token: ${{ secrets.GH_TOKEN }}
command: manifest
config-file: .github/release-please-config.json
manifest-file: .github/release-please-manifest.json
default-branch: main
release-type: node
npm:
needs: release
if: |
contains(fromJson(needs.release.outputs.paths_released), 'packages/odd-passkeys') ||
contains(fromJson(needs.release.outputs.paths_released), 'packages/odd-preact')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- run: pnpm install
- run: pnpm run lint
- run: pnpm -r publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
docs:
needs: release
if: |
contains(fromJson(needs.release.outputs.paths_released), 'packages/odd-passkeys') ||
contains(fromJson(needs.release.outputs.paths_released), 'packages/odd-preact')
uses: './.github/workflows/reusable-docs.yml'
40 changes: 40 additions & 0 deletions .github/workflows/reusable-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Reusable Deploy Docs
on:
workflow_call:

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: 'pages'
cancel-in-progress: false
permissions:
contents: read
pages: write
id-token: write

jobs:
deploy-docs:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
- run: pnpm install
- run: pnpm run lint
- run: pnpm run docs
- uses: actions/configure-pages@v3
- uses: actions/upload-pages-artifact@v1
with:
path: './docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local
dev-dist
kv-data
.env

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

docs
3 changes: 3 additions & 0 deletions examples/passkey-auth/fission.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ignore: []
url: passkeys-test2.fission.app
build: ./dist
13 changes: 13 additions & 0 deletions examples/passkey-auth/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Preact</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
49 changes: 49 additions & 0 deletions examples/passkey-auth/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "passkey-auth",
"private": true,
"version": "0.0.0",
"license": "apache-2.0",
"type": "module",
"scripts": {
"dev": "vite --force",
"build": "vite build",
"preview": "vite preview",
"lint": "tsc && eslint '**/*.{js,jsx,ts}' && prettier --check '**/*.{js,jsx,ts,yml,json}' --ignore-path ../../.gitignore",
"deploy": "vite build && wrangler pages publish --project-name passkey --branch main dist"
},
"dependencies": {
"@acab/reset.css": "^0.5.3",
"@oddjs/passkeys": "workspace:^",
"@oddjs/preact": "workspace:^",
"@preact/signals": "^1.1.3",
"idb-keyval": "^6.2.1",
"iso-base": "^0.1.5",
"iso-passkeys": "^0.1.5",
"p-debounce": "^4.0.0",
"preact": "^10.13.2",
"preact-router": "^4.1.0",
"react-hook-form": "^7.43.9",
"water.css": "^2.1.1"
},
"devDependencies": {
"@babel/core": "^7.21.8",
"@preact/preset-vite": "^2.5.0",
"typescript": "^5.0.4",
"vite": "^4.3.5",
"wrangler": "^2.20.0"
},
"eslintConfig": {
"extends": [
"../../node_modules/hd-scripts/eslint/preact.js"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"ignorePatterns": [
"dist"
]
},
"engines": {
"node": ">=18"
}
}
1 change: 1 addition & 0 deletions examples/passkey-auth/public/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /index.html 200
1 change: 1 addition & 0 deletions examples/passkey-auth/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions examples/passkey-auth/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Usage

```bash
npx simple-git-hooks
```
40 changes: 40 additions & 0 deletions examples/passkey-auth/src/app.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* eslint-disable unicorn/no-useless-undefined */
import { Router } from 'preact-router'
import Home from './home.jsx'
import Login from './login.jsx'
import { OddContextProvider } from '@oddjs/preact'
import Register from './register.jsx'
import Test from './test.jsx'
import * as OddPasskey from '@oddjs/passkeys'

/** @type {import('@oddjs/odd').Configuration} */
const config = {
namespace: {
creator: document.location.host,
name: 'Passkey auth',
},
debug: true,
debugging: {
injectIntoGlobalContext: true,
},
}

export function App() {
return (
<>
<OddContextProvider
config={config}
componentsFactory={OddPasskey.createComponents}
>
<main className="App">
<Router>
<Home path="/" />
<Test path="/test" />
<Login path="/login" />
<Register path="/register" />
</Router>
</main>
</OddContextProvider>
</>
)
}
1 change: 1 addition & 0 deletions examples/passkey-auth/src/assets/preact.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 95d0fe7

Please sign in to comment.