Skip to content

chore(integrations): add template and setup script for integrations#148

Merged
halvaradop merged 2 commits into
masterfrom
chore/add-integration-template
Apr 21, 2026
Merged

chore(integrations): add template and setup script for integrations#148
halvaradop merged 2 commits into
masterfrom
chore/add-integration-template

Conversation

@halvaradop
Copy link
Copy Markdown
Member

@halvaradop halvaradop commented Apr 21, 2026

Description

Introduces a standardized template and scaffolding workflow for creating new integration packages in the monorepo.

This reduces setup time and enforces a consistent structure across integrations such as next, react-router, elysia, and express.


Changes

  • Add integration template under packages/integration
  • Introduce shared/scripts/integration.js scaffolding script
  • Add create:integration script in the root package.json
  • Define a default structure for all new integration packages

Scaffolding Script

The shared/scripts/integration.js script automates the creation of new integration packages by copying the template into a new package and applying the required setup.

It can be executed directly or via the root script alias.

Usage

Usage: node shared/scripts/integration.js [OPTIONS]

Options:
--name      Required name of the integration to copy

Examples:
node packages/shared/scripts/integration.js --name tanstack-react-start
node packages/shared/scripts/integration.js --name solid
node packages/shared/scripts/integration.js --name fastify

Using the root script:

pnpm create:integraton shared/scripts/integration.js --name tanstack-react-start
pnpm create:integraton shared/scripts/integration.js --name solid
pnpm create:integraton  shared/scripts/integration.js --name fastify

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
auth Ready Ready Preview, Comment Apr 21, 2026 11:40pm

@halvaradop halvaradop added the chore Maintenance tasks, tooling, dependency updates, or housekeeping changes. label Apr 21, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Warning

Rate limit exceeded

@halvaradop has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 42 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 43 minutes and 42 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d8fabb4c-67d9-43fc-ac26-030c05a4241d

📥 Commits

Reviewing files that changed from the base of the PR and between 2dd9a17 and 673ad3c.

📒 Files selected for processing (6)
  • package.json
  • packages/integration/README.md
  • packages/integration/deno.json
  • packages/integration/package.json
  • packages/integration/src/createAuth.ts
  • packages/shared/scripts/integration.js
📝 Walkthrough

Walkthrough

A new integration package is established within the monorepo with configuration files, build setup, documentation, and source code. Additionally, a script for generating new integration packages from a template and a root npm script to invoke it are added.

Changes

Cohort / File(s) Summary
Root package configuration
package.json
Added create:integration npm script invoking node packages/shared/scripts/integration.js --name; reformatted type-check script with trailing comma.
Integration package configuration
packages/integration/package.json, packages/integration/deno.json, packages/integration/tsconfig.json, packages/integration/tsdown.config.ts
Configured new @aura-stack/integration package with ESM module type, build/test/lint/format scripts, subpath exports (oauth, identity, crypto, shared), workspace dependency on @aura-stack/auth, path aliases, Deno runtime support, and build entry points.
Integration package documentation
packages/integration/README.md, packages/integration/CHANGELOG.md
Added package branding, features, installation instructions, documentation links, license info, and initialized changelog following Keep a Changelog format.
Integration package source
packages/integration/src/createAuth.ts, packages/integration/src/index.ts
Introduced createAuth generic function wrapping @aura-stack/auth's createAuth; re-exported via package entrypoint.
Package scaffold script
packages/shared/scripts/integration.js
Added executable script to generate new integration packages from template via CLI --name argument, with validation and recursive directory copying excluding dist and node_modules.
Shared scripts maintenance
packages/shared/scripts/modules.js
Reordered import statements for readability (node:path imports before node:fs/promises); no functional changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

chore

Poem

🐰 A template takes shape in packages galore,
New scripts hop and skip across the monorepo floor,
Integration awaits, all bundled with care,
Configuration and code dancing through the air! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: adding an integration template (packages/integration/) and a setup script (packages/shared/scripts/integration.js).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/add-integration-template

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🧹 Nitpick comments (2)
packages/integration/README.md (1)

15-17: Empty Features section.

The Features heading has no content. Since this README is intended as the template for new integrations, consider either populating a placeholder bullet list or removing the section until content is available to avoid shipping empty headings in the template output.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/integration/README.md` around lines 15 - 17, The README contains an
empty "Features" section; either populate it with a placeholder bullet list
(e.g., "- Feature 1: description", "- Feature 2: description") to guide new
integration authors or remove the "## Features" heading entirely so the template
doesn't ship with an empty section; update the "Features" heading in
packages/integration/README.md accordingly.
packages/shared/scripts/integration.js (1)

40-43: Minor: avoid shadowing the outer name variable inside the filter callback.

The name on line 41 shadows the CLI-arg name destructured on line 16. It works, but renaming improves readability and prevents accidents if the filter is later extended.

-        filter: (src) => {
-            const name = basename(src)
-            return name !== "node_modules" && name !== "dist"
-        },
+        filter: (src) => {
+            const entry = basename(src)
+            return entry !== "node_modules" && entry !== "dist"
+        },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/shared/scripts/integration.js` around lines 40 - 43, The filter
callback shadows the outer variable named "name"; in the filter (src) => { const
name = basename(src) ... } rename the inner variable (e.g., to base or baseName)
and update its uses in the return expression so it compares base/baseName !==
"node_modules" && base/baseName !== "dist", leaving the outer destructured name
untouched.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Line 20: The npm script "create:integration" currently leaves a dangling
"--name " flag; change the script to forward CLI flags explicitly (e.g., replace
the command tail with "--" so callers can run `pnpm run create:integration --
--name foo`) and then add explicit validation in
packages/shared/scripts/integration.js to require and validate an integration
name (accept either a --name flag or a positional argument), returning a clear
error and non-zero exit if no name is provided; update the argument-parsing
logic in integration.js (where it reads process.argv or the existing parser
function) to check for a missing value and print a helpful usage message.

In `@packages/integration/deno.json`:
- Line 6: The "dev" task in deno.json points to a non-existent entry
src/index.tsx; update the dev task to run the actual integration entrypoint
src/index.ts so deno task dev can find the module. Locate the "dev" script in
deno.json and replace the path reference to use src/index.ts (ensure the command
remains "deno run --watch src/index.ts").

In `@packages/integration/package.json`:
- Line 18: The package.json "clean" npm script currently removes non-existent
directories (it runs rm -rf dist src/_core src/oauth); update the "clean" script
to only remove directories actually used in this package (e.g., keep "dist" and
remove the references to "src/_core" and "src/oauth") so it no longer lists
copy-pasted paths from another package; locate the "clean" script entry in
package.json and remove the unwanted paths from the command string (ensure
"clean" still removes "dist" and any real generated dirs for this package).
- Line 4: The package.json for the integration template currently has "private":
false which risks accidental publishing; update the package.json entry to
"private": true to prevent publication, and keep any existing prepublishOnly
scripts intact; if necessary, document or modify the integration.js script (or
consumer setup) to flip "private" back to false when a user clones or prepares a
real package from the template.
- Around line 31-62: The package exports map lists subpaths ("./oauth",
"./identity", "./crypto", "./shared") that do not exist in source (only
createAuth.ts and index.ts are present) and tsdown.config.ts also references
nonexistent entrypoints; either add the missing source files matching tsdown
entrypoints (e.g., create src/oauth/* and
src/_core/{identity.ts,crypto.ts,shared.ts}) so the build emits the advertised
dist/* paths, or remove the stale exports from package.json and delete the
corresponding entrypoints from tsdown.config.ts so exports only expose the real
entrypoints (e.g., "." and whichever actual source files you intend to publish:
createAuth and index). Ensure consistency between package.json exports,
tsdown.config.ts entrypoints, and actual src files to prevent
ERR_MODULE_NOT_FOUND for consumers.

In `@packages/integration/README.md`:
- Around line 7-8: The README badge links currently point to the wrong package
identifier "@aura-stack/auth"; update both occurrences in the badge markdown
(the npm href and the JSR href strings shown in the diff) to
"@aura-stack/integration" so the image links and target URLs correctly reference
the integration package.

In `@packages/integration/src/createAuth.ts`:
- Around line 1-6: The createAuth wrapper currently lacks an explicit return
type causing TS2742; update createAuth to annotate its return type as
AuthInstance<Identity> (importing AuthInstance from "@aura-stack/auth") and
return that typed value from createAuthInstance<Identity>(config); also add a
one-line comment above createAuth noting this is a thin wrapper/extension point
for future integration logic. Ensure you reference the exported AuthInstance
type, the createAuth function (wrapper), and the createAuthInstance call when
making the change.

In `@packages/integration/tsdown.config.ts`:
- Around line 6-13: Update the package.json "build" script so it runs the module
sync step before tsdown: locate the "build" script entry (currently invoking
"tsdown") and change it to run "pnpm sync:modules && tsdown" so that generated
entry files (used by tsdown, e.g. src/oauth/* and src/_core/*.ts) are created
first; follow the same pattern used in the other packages.

In `@packages/shared/scripts/integration.js`:
- Around line 18-26: Validate the user-supplied variable name before building
the path: ensure the string `name` contains only safe package-name characters
(e.g., lowercase letters, numbers, hyphen/underscore) and disallow
path-separators, dots, or uppercase characters to prevent path traversal and
invalid pnpm package names; perform this check prior to calling
`resolve(process.cwd(), "packages", name)` and before `existsSync`, and if the
pattern fails, print an error and `process.exit(1)`. Use a strict regex (e.g.,
allow only [a-z0-9_-]) to validate `name` and reference the `name`,
`existsSync`, and `resolve` usages when applying the change.

---

Nitpick comments:
In `@packages/integration/README.md`:
- Around line 15-17: The README contains an empty "Features" section; either
populate it with a placeholder bullet list (e.g., "- Feature 1: description", "-
Feature 2: description") to guide new integration authors or remove the "##
Features" heading entirely so the template doesn't ship with an empty section;
update the "Features" heading in packages/integration/README.md accordingly.

In `@packages/shared/scripts/integration.js`:
- Around line 40-43: The filter callback shadows the outer variable named
"name"; in the filter (src) => { const name = basename(src) ... } rename the
inner variable (e.g., to base or baseName) and update its uses in the return
expression so it compares base/baseName !== "node_modules" && base/baseName !==
"dist", leaving the outer destructured name untouched.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd2525bd-c4b3-489c-ab0e-0fcfaa59dc0c

📥 Commits

Reviewing files that changed from the base of the PR and between f9dba05 and 2dd9a17.

⛔ Files ignored due to path filters (2)
  • bun.lock is excluded by !**/*.lock
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • package.json
  • packages/integration/CHANGELOG.md
  • packages/integration/README.md
  • packages/integration/deno.json
  • packages/integration/package.json
  • packages/integration/src/createAuth.ts
  • packages/integration/src/index.ts
  • packages/integration/tsconfig.json
  • packages/integration/tsdown.config.ts
  • packages/shared/scripts/integration.js
  • packages/shared/scripts/modules.js

Comment thread package.json Outdated
Comment thread packages/integration/deno.json Outdated
Comment thread packages/integration/package.json Outdated
Comment thread packages/integration/package.json
Comment thread packages/integration/package.json
Comment thread packages/integration/README.md Outdated
Comment thread packages/integration/src/createAuth.ts Outdated
Comment thread packages/integration/tsdown.config.ts
Comment thread packages/shared/scripts/integration.js
@halvaradop halvaradop merged commit 064c30b into master Apr 21, 2026
7 checks passed
@halvaradop halvaradop deleted the chore/add-integration-template branch April 21, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance tasks, tooling, dependency updates, or housekeeping changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant