generated from sergiodxa/remix-auth-strategy-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 29a839b
Showing
23 changed files
with
569 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* eslint-disable unicorn/prefer-module */ | ||
module.exports = { | ||
root: true, | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["@typescript-eslint", "unicorn", "jest", "prettier"], | ||
extends: [ | ||
"plugin:unicorn/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
], | ||
rules: { | ||
"prefer-const": "off", | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
"no-unused-vars": "off", | ||
"no-var": "off", | ||
"unicorn/no-null": "off", | ||
"unicorn/prefer-node-protocol": "off", | ||
"unicorn/filename-case": "off", | ||
"unicorn/prevent-abbreviations": "off", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: sergiodxa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
reviewers: | ||
- "sergiodxa" | ||
assignees: | ||
- "sergiodxa" | ||
|
||
- package-ecosystem: npm | ||
directory: / | ||
schedule: | ||
interval: "weekly" | ||
reviewers: | ||
- "sergiodxa" | ||
assignees: | ||
- "sergiodxa" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
changelog: | ||
categories: | ||
- title: New Features | ||
labels: | ||
- enhancement | ||
- title: Documentation Changes | ||
labels: | ||
- documentation | ||
- title: Bug Fixes | ||
labels: | ||
- bug | ||
- title: Example | ||
labels: | ||
- example | ||
- title: Deprecations | ||
labels: | ||
- deprecated | ||
- title: Other Changes | ||
labels: | ||
- "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Bump version | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "Type of version to bump" | ||
required: true | ||
type: choice | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
|
||
jobs: | ||
bump-version: | ||
name: Bump version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ssh-key: ${{ secrets.DEPLOY_KEY }} | ||
|
||
- uses: oven-sh/setup-bun@v2 | ||
- run: bun install --frozen-lockfile | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
|
||
- run: | | ||
git config user.name 'Sergio Xalambrí' | ||
git config user.email 'hello@sergiodxa.com' | ||
- run: npm version ${{ github.event.inputs.version }} | ||
- run: bun run quality:fix | ||
- run: git push origin main --follow-tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v2 | ||
- run: bun install --frozen-lockfile | ||
- run: bun run build | ||
|
||
typecheck: | ||
name: Typechecker | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v2 | ||
- run: bun install --frozen-lockfile | ||
- run: bun run typecheck | ||
|
||
quality: | ||
name: Code Quality | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v2 | ||
- run: bun install --frozen-lockfile | ||
- run: bun run quality | ||
|
||
test: | ||
name: Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v2 | ||
- run: bun install --frozen-lockfile | ||
- run: bun test | ||
|
||
exports: | ||
name: Verify Exports | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v2 | ||
- run: bun install --frozen-lockfile | ||
- run: bun run exports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Enable auto-merge for Dependabot PRs | ||
|
||
on: | ||
pull_request: | ||
types: opened | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
dependabot: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
steps: | ||
- id: metadata | ||
uses: dependabot/fetch-metadata@v2 | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- run: gh pr merge --auto --squash "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Deploy Documentation | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: "docs" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v2 | ||
- run: bun install --frozen-lockfile | ||
- run: bunx typedoc | ||
- uses: actions/configure-pages@v5 | ||
- uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: "./docs" | ||
- uses: actions/deploy-pages@v4 | ||
id: deployment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish-npm: | ||
name: "Publish to npm" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/setup-bun@v2 | ||
- run: bun install --frozen-lockfile | ||
- run: bun run build | ||
- run: bun run exports | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: "lts/*" | ||
registry-url: https://registry.npmjs.org/ | ||
|
||
- run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/build | ||
/coverage | ||
/docs | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["biomejs.biome"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"[javascript]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[javascriptreact]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[json]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[jsonc]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[typescriptreact]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports.biome": "explicit", | ||
"quickfix.biome": "explicit" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Contribution | ||
|
||
## Setup | ||
|
||
Run `bun install` to install the dependencies. | ||
|
||
Run the tests with `bun test`. | ||
|
||
Run the code quality checker with `bun run quality`. | ||
|
||
Run the typechecker with `bun run typecheck`. | ||
|
||
Run the exports checker with `bun run exports`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Sergio Xalambrí | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Remix Auth - Strategy Template | ||
|
||
> A template for creating a new Remix Auth strategy. | ||
If you want to create a new strategy for Remix Auth, you could use this as a template for your repository. | ||
|
||
The repo installs the latest version of Remix Auth and do the setup for you to have tests, linting and typechecking. | ||
|
||
## How to use it | ||
|
||
1. In the `package.json` change `name` to your strategy name, also add a description and ideally an author, repository and homepage keys. | ||
2. In `src/index.ts` change the `MyStrategy` for the strategy name you want to use. | ||
3. Implement the strategy flow inside the `authenticate` method. Use `this.success` and `this.failure` to correctly send finish the flow. | ||
4. In `tests/index.test.ts` change the tests to use your strategy and test it. Inside the tests you have access to `jest-fetch-mock` to mock any fetch you may need to do. | ||
5. Once you are ready, set the secrets on Github | ||
- `NPM_TOKEN`: The token for the npm registry | ||
- `GIT_USER_NAME`: The git username you want the bump workflow to use in the commit. | ||
- `GIT_USER_EMAIL`: The email you want the bump workflow to use in the commit. | ||
|
||
## Scripts | ||
|
||
- `build`: Build the project for production using the TypeScript compiler (strips the types). | ||
- `typecheck`: Check the project for type errors, this also happens in build but it's useful to do in development. | ||
- `lint`: Runs ESLint against the source codebase to ensure it pass the linting rules. | ||
- `test`: Runs all the test using Jest. | ||
|
||
## Documentations | ||
|
||
To facilitate creating a documentation for your strategy, you can use the following Markdown | ||
|
||
```markdown | ||
# Strategy Name | ||
|
||
<!-- Description --> | ||
|
||
## Supported runtimes | ||
|
||
| Runtime | Has Support | | ||
| ---------- | ----------- | | ||
| Node.js | ✅ | | ||
| Cloudflare | ✅ | | ||
|
||
<!-- If it doesn't support one runtime, explain here why --> | ||
|
||
## How to use | ||
|
||
<!-- Explain how to use the strategy, here you should tell what options it expects from the developer when instantiating the strategy --> | ||
``` |
Oops, something went wrong.