-
Notifications
You must be signed in to change notification settings - Fork 1
chore(integrations): add template and setup script for integrations #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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 @@ | ||
| # Changelog - `@aura-stack/integration` | ||
|
|
||
| All notable changes to this project will be documented in this file. | ||
|
|
||
| The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
|
||
| --- | ||
|
|
||
| ## [Unreleased] | ||
|
|
||
| ### Added | ||
|
|
||
| ### Changed |
This file contains hidden or 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,35 @@ | ||
| <div align="center"> | ||
|
|
||
| <h1><b>@aura-stack/integration</b></h1> | ||
|
|
||
| **Integration authentication library for the Aura Stack ecosystem** | ||
|
|
||
| [](https://www.npmjs.com/package/@aura-stack/integration) | ||
| [](https://jsr.io/@aura-stack/integration) | ||
| [](https://opensource.org/licenses/MIT) | ||
|
|
||
| [Official Docs](https://aura-stack-auth.vercel.app/docs) · [Core Package Docs](https://aura-stack-auth.vercel.app/docs/packages/core) | ||
|
|
||
| </div> | ||
|
|
||
| ## Features | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| pnpm add @aura-stack/integration | ||
| ``` | ||
|
|
||
| ## Documentation | ||
|
|
||
| Visit the [**official documentation website**](https://aura-stack-auth.vercel.app). | ||
|
|
||
| ## License | ||
|
|
||
| Licensed under the [MIT License](../../LICENSE). © [Aura Stack](https://github.com/aura-stack-ts) | ||
|
|
||
| --- | ||
|
|
||
| <p align="center"> | ||
| Made with ❤️ by <a href="https://github.com/aura-stack-ts">Aura Stack team</a> | ||
| </p> |
This file contains hidden or 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,19 @@ | ||
| { | ||
| "name": "@aura-stack/integration", | ||
| "version": "0.0.0", | ||
| "license": "MIT", | ||
| "tasks": { | ||
| "dev": "deno run --watch src/index.ts" | ||
| }, | ||
| "imports": { | ||
| "@/": "./src/", | ||
| "./oauth": "./src/oauth/index.ts", | ||
| "./identity": "./src/_core/identity.ts", | ||
| "./crypto": "./src/_core/crypto.ts", | ||
| "./shared": "./src/_core/shared.ts" | ||
| }, | ||
| "publish": { | ||
| "include": ["src/**/*.ts", "src/**/*.tsx", "README.md", "CHANGELOG.md"] | ||
| }, | ||
| "exclude": ["dist", "node_modules"] | ||
| } |
This file contains hidden or 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,79 @@ | ||
| { | ||
| "name": "@aura-stack/integration", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "description": "Integration for Aura Stack authentication library", | ||
| "scripts": { | ||
| "dev": "tsdown --watch", | ||
| "build": "pnpm sync:modules && tsdown", | ||
| "lint": "oxlint", | ||
| "lint:fix": "oxlint --fix", | ||
| "test": "vitest --run", | ||
| "test:watch": "vitest", | ||
| "test:coverage": "vitest --run --coverage", | ||
| "format": "oxfmt", | ||
| "format:check": "oxfmt --check", | ||
| "type-check": "tsc --noEmit", | ||
| "clean": "rm -rf dist src/_core src/oauth", | ||
| "clean:cts": "if [ -d dist ]; then find dist -type f -name \"*.cts\" -delete; fi", | ||
| "prepublishOnly": "pnpm clean:cts && pnpm build && pnpm clean:cts", | ||
| "sync:modules": "node ../shared/scripts/modules.js" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/aura-stack-ts/auth" | ||
| }, | ||
| "sideEffects": false, | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "import": "./dist/index.js", | ||
| "require": "./dist/index.cjs" | ||
| }, | ||
| "./oauth": { | ||
| "types": "./dist/oauth/index.d.ts", | ||
| "import": "./dist/oauth/index.js", | ||
| "require": "./dist/oauth/index.cjs" | ||
| }, | ||
| "./oauth/*": { | ||
| "types": "./dist/oauth/*.d.ts", | ||
| "import": "./dist/oauth/*.js", | ||
| "require": "./dist/oauth/*.cjs" | ||
| }, | ||
| "./identity": { | ||
| "types": "./dist/_core/identity.d.ts", | ||
| "import": "./dist/_core/identity.js", | ||
| "require": "./dist/_core/identity.cjs" | ||
| }, | ||
| "./crypto": { | ||
| "types": "./dist/_core/crypto.d.ts", | ||
| "import": "./dist/_core/crypto.js", | ||
| "require": "./dist/_core/crypto.cjs" | ||
| }, | ||
| "./shared": { | ||
| "types": "./dist/_core/shared.d.ts", | ||
| "import": "./dist/_core/shared.js", | ||
| "require": "./dist/_core/shared.cjs" | ||
| } | ||
| }, | ||
|
halvaradop marked this conversation as resolved.
|
||
| "keywords": [], | ||
| "author": "Aura Stack <aurastackjs@gmail.com> | Hernan Alvarado <halvaradop.dev@gmail.com>", | ||
| "homepage": "https://aura-stack-auth.vercel.app", | ||
| "bugs": { | ||
| "url": "https://github.com/aura-stack-ts/auth/issues" | ||
| }, | ||
| "license": "MIT", | ||
| "dependencies": { | ||
| "@aura-stack/auth": "workspace:*" | ||
| }, | ||
| "devDependencies": { | ||
| "@aura-stack/tsconfig": "workspace:*", | ||
| "@aura-stack/tsdown-config": "workspace:*" | ||
| }, | ||
| "peerDependencies": {}, | ||
| "packageManager": "pnpm@10.15.0" | ||
| } | ||
This file contains hidden or 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,7 @@ | ||
| import { AuthConfig, createAuth as createAuthInstance } from "@aura-stack/auth" | ||
| import type { EditableShape, UserShape } from "@aura-stack/auth/identity" | ||
|
|
||
| export const createAuth = <Identity extends EditableShape<UserShape>>(config: AuthConfig<Identity>) => { | ||
| const auth = createAuthInstance<Identity>(config) | ||
| return auth | ||
| } |
This file contains hidden or 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 @@ | ||
| export { createAuth } from "@/createAuth.ts" |
This file contains hidden or 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,12 @@ | ||
| { | ||
| "extends": "@aura-stack/tsconfig/tsconfig.base.json", | ||
| "compilerOptions": { | ||
| "noEmit": true, | ||
| "allowImportingTsExtensions": true, | ||
| "paths": { | ||
| "@/*": ["./src/*"] | ||
| } | ||
| }, | ||
| "include": ["src"], | ||
| "exclude": ["dist", "node_modules"] | ||
| } |
This file contains hidden or 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,14 @@ | ||
| import { defineConfig } from "tsdown" | ||
| import { tsdownConfig } from "@aura-stack/tsdown-config" | ||
|
|
||
| export default defineConfig({ | ||
| ...tsdownConfig, | ||
| entry: [ | ||
| "src/index.ts", | ||
| "src/oauth/index.ts", | ||
| "src/oauth/*.ts", | ||
| "src/_core/identity.ts", | ||
| "src/_core/crypto.ts", | ||
| "src/_core/shared.ts", | ||
| ], | ||
|
halvaradop marked this conversation as resolved.
|
||
| }) | ||
This file contains hidden or 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,54 @@ | ||
| import { existsSync } from "node:fs" | ||
| import { parseArgs } from "node:util" | ||
| import { cp } from "node:fs/promises" | ||
| import { basename, resolve } from "node:path" | ||
|
|
||
| const args = parseArgs({ | ||
| args: process.argv.slice(2), | ||
| strict: true, | ||
| options: { | ||
| name: { | ||
| type: "string", | ||
| }, | ||
| }, | ||
| }) | ||
|
|
||
| const { name } = args.values | ||
|
|
||
| if (!name) { | ||
| console.error("\x1b[31m[error]: Integration name is required\x1b[0m") | ||
| process.exit(1) | ||
| } | ||
| if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) { | ||
| console.error("\x1b[31m[error]: Integration name must be lowercase alphanumeric with dashes\x1b[0m") | ||
| process.exit(1) | ||
| } | ||
|
|
||
| if (existsSync(resolve(process.cwd(), "packages", name))) { | ||
| console.error("\x1b[31m[error]: Integration with the same name already exists\x1b[0m") | ||
| process.exit(1) | ||
| } | ||
|
halvaradop marked this conversation as resolved.
|
||
|
|
||
| try { | ||
| const outDir = resolve(process.cwd(), "packages", name) | ||
| const templateDir = resolve(process.cwd(), "packages", "integration") | ||
|
|
||
| if (!existsSync(templateDir)) { | ||
| console.error("\x1b[31m[error]: Integration template folder not found at packages/integration\x1b[0m") | ||
| process.exit(1) | ||
| } | ||
|
|
||
| console.log(`\x1b[34m[info]: Creating integration "${name}"...\x1b[0m`) | ||
| await cp(templateDir, outDir, { | ||
| recursive: true, | ||
| filter: (src) => { | ||
| const name = basename(src) | ||
| return name !== "node_modules" && name !== "dist" | ||
| }, | ||
| }) | ||
|
|
||
| console.log("\x1b[32m[success]: Integration created successfully\x1b[0m") | ||
| } catch (error) { | ||
| console.error("\x1b[31m[error]: Failed to create integration:\x1b[0m", error) | ||
| process.exit(1) | ||
| } | ||
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.