chore(integrations): add template and setup script for integrations#148
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughA 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 9
🧹 Nitpick comments (2)
packages/integration/README.md (1)
15-17: EmptyFeaturessection.The
Featuresheading 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 outernamevariable inside the filter callback.The
nameon line 41 shadows the CLI-argnamedestructured 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
⛔ Files ignored due to path filters (2)
bun.lockis excluded by!**/*.lockpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (11)
package.jsonpackages/integration/CHANGELOG.mdpackages/integration/README.mdpackages/integration/deno.jsonpackages/integration/package.jsonpackages/integration/src/createAuth.tspackages/integration/src/index.tspackages/integration/tsconfig.jsonpackages/integration/tsdown.config.tspackages/shared/scripts/integration.jspackages/shared/scripts/modules.js
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, andexpress.Changes
packages/integrationshared/scripts/integration.jsscaffolding scriptcreate:integrationscript in the rootpackage.jsonScaffolding Script
The
shared/scripts/integration.jsscript 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
Using the root script: