{"_id":"@codybontecou/pr-error-logger","_rev":"3-2080db9b095802b860c40859e62c6ab2","name":"@codybontecou/pr-error-logger","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@codybontecou/pr-error-logger","version":"1.0.0","keywords":["github","error-logging","pull-request","vercel","typescript","nextjs"],"author":{"name":"Your Name"},"license":"MIT","_id":"@codybontecou/pr-error-logger@1.0.0","maintainers":[{"name":"codybontecou","email":"codybontecou@gmail.com"}],"homepage":"https://github.com/codybontecou/pr-error-logger#readme","bugs":{"url":"https://github.com/codybontecou/pr-error-logger/issues"},"dist":{"shasum":"faf280dd9f05a0d48865bba2aea4901d4eeaa64d","tarball":"https://registry.npmjs.org/@codybontecou/pr-error-logger/-/pr-error-logger-1.0.0.tgz","fileCount":5,"integrity":"sha512-W3eCerL7cEOcvxEYJbYHQ7MYGQS81DAezOhGri5fbLUYBA+cTUG1fnaLWoFG/niCwTFJ/2X/Wzrw/ontRamQRg==","signatures":[{"sig":"MEYCIQCpAEvhNHJesnl9jmoqFG76/pQ/30VpJampLjY4+iFcHgIhAKcpL98iQxy7U+raddeRV5aq+hYae4VZbjq9VBu8iI+E","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9145},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"499b025676dbc02edb196bb304ac91ea1e661276","scripts":{"dev":"tsc --watch","lint":"eslint src --ext .ts","build":"tsc && mkdir -p dist && cp action.yml dist/","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"codybontecou","email":"codybontecou@gmail.com"},"repository":{"url":"git+https://github.com/codybontecou/pr-error-logger.git","type":"git"},"_npmVersion":"11.4.0","description":"A comprehensive TypeScript package for logging errors to GitHub PRs with Vercel integration","directories":{},"_nodeVersion":"20.17.0","dependencies":{"@vercel/node":"^3.0.0","@actions/core":"^1.10.0","@octokit/rest":"^20.0.0","@actions/github":"^5.1.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0","@typescript-eslint/parser":"^6.0.0","@typescript-eslint/eslint-plugin":"^6.0.0"},"peerDependencies":{"next":">=13.0.0"},"_npmOperationalInternal":{"tmp":"tmp/pr-error-logger_1.0.0_1752337811368_0.3337556568627691","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@codybontecou/pr-error-logger","version":"1.0.1","keywords":["github","error-logging","pull-request","vercel","typescript","nextjs"],"author":{"name":"Your Name"},"license":"MIT","_id":"@codybontecou/pr-error-logger@1.0.1","maintainers":[{"name":"codybontecou","email":"codybontecou@gmail.com"}],"homepage":"https://github.com/codybontecou/pr-error-logger#readme","bugs":{"url":"https://github.com/codybontecou/pr-error-logger/issues"},"dist":{"shasum":"99f33dc62fe769acd7c8389283c83d9e6ef47810","tarball":"https://registry.npmjs.org/@codybontecou/pr-error-logger/-/pr-error-logger-1.0.1.tgz","fileCount":5,"integrity":"sha512-GG8jJPIN5Kb4DddGnZ4Bu9jvW5yyd7O7dkOP2493xrYG932ZSnHTZ70LTnG1tI9GONlaKh4VIBBdusadBYLbiw==","signatures":[{"sig":"MEQCIF3ed8mDhTuQjDsvwLdN1pN4scc8powwxgGCDx3FdOrSAiAm2aC5q1ryVR0tEuYBQWKsCaP2qP0CUYad/Y4bbt+XTA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9117},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"499b025676dbc02edb196bb304ac91ea1e661276","scripts":{"dev":"tsc --watch","lint":"eslint src --ext .ts","build":"tsc && mkdir -p dist && cp action.yml dist/","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"codybontecou","email":"codybontecou@gmail.com"},"repository":{"url":"git+https://github.com/codybontecou/pr-error-logger.git","type":"git"},"_npmVersion":"11.4.0","description":"A comprehensive TypeScript package for logging errors to GitHub PRs with Vercel integration","directories":{},"_nodeVersion":"20.17.0","dependencies":{"@actions/core":"^1.10.0","@octokit/rest":"^20.0.0","@actions/github":"^5.1.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.0.0","typescript":"^5.0.0","@types/node":"^24.0.13","@typescript-eslint/parser":"^6.0.0","@typescript-eslint/eslint-plugin":"^6.0.0"},"peerDependencies":{"next":">=13.0.0"},"_npmOperationalInternal":{"tmp":"tmp/pr-error-logger_1.0.1_1752338116566_0.2967109171143114","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@codybontecou/pr-error-logger","version":"1.0.2","description":"A comprehensive TypeScript package for logging errors to GitHub PRs with Vercel integration","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc && mkdir -p dist && cp action.yml dist/","dev":"tsc --watch","clean":"rm -rf dist","prepublishOnly":"npm run clean && npm run build","lint":"eslint src --ext .ts","typecheck":"tsc --noEmit"},"keywords":["github","error-logging","pull-request","vercel","typescript","nextjs"],"author":{"name":"Your Name"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/codybontecou/pr-error-logger.git"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.0","@octokit/rest":"^20.0.0"},"peerDependencies":{"next":">=13.0.0"},"devDependencies":{"@types/node":"^24.0.13","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0","eslint":"^8.0.0","typescript":"^5.0.0"},"engines":{"node":">=18.0.0"},"_id":"@codybontecou/pr-error-logger@1.0.2","gitHead":"499b025676dbc02edb196bb304ac91ea1e661276","bugs":{"url":"https://github.com/codybontecou/pr-error-logger/issues"},"homepage":"https://github.com/codybontecou/pr-error-logger#readme","_nodeVersion":"20.17.0","_npmVersion":"11.4.0","dist":{"integrity":"sha512-ELYk3jzTtDqKSDLu5NnfzyNOvmQtkaUBXMmmQYb7jDyru2AkcxqzC0qR2/uwEM7eRWkHB8paAreL/2OdQ6wH0g==","shasum":"3897cf15bf3f5e15bbec606b0b890b1651606dc4","tarball":"https://registry.npmjs.org/@codybontecou/pr-error-logger/-/pr-error-logger-1.0.2.tgz","fileCount":7,"unpackedSize":9490,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEimDyDBhJLNkJ+mQqLcfY0LT/IR4wNc5YP141sseQC8AiBD0DbMpuyNw97D3r18BGRBqd6EqD1Ki+tBmdxoR/9X2g=="}]},"_npmUser":{"name":"codybontecou","email":"codybontecou@gmail.com"},"directories":{},"maintainers":[{"name":"codybontecou","email":"codybontecou@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pr-error-logger_1.0.2_1752338139419_0.9307634682761625"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-12T16:30:11.247Z","modified":"2025-07-12T16:35:39.788Z","1.0.0":"2025-07-12T16:30:11.579Z","1.0.1":"2025-07-12T16:35:16.758Z","1.0.2":"2025-07-12T16:35:39.609Z"},"bugs":{"url":"https://github.com/codybontecou/pr-error-logger/issues"},"author":{"name":"Your Name"},"license":"MIT","homepage":"https://github.com/codybontecou/pr-error-logger#readme","keywords":["github","error-logging","pull-request","vercel","typescript","nextjs"],"repository":{"type":"git","url":"git+https://github.com/codybontecou/pr-error-logger.git"},"description":"A comprehensive TypeScript package for logging errors to GitHub PRs with Vercel integration","maintainers":[{"name":"codybontecou","email":"codybontecou@gmail.com"}],"readme":"# PR Error Logger\n\nA comprehensive TypeScript package for automatically logging browser errors, warnings, and console output to GitHub Pull Request comments. Perfect for debugging issues in Vercel preview deployments.\n\n## Features\n\n- 🔍 **Automatic Error Capture** - Catches all browser errors and unhandled promise rejections\n- 📱 **Device Information** - Includes viewport, screen size, platform, and browser details\n- 🚀 **Vercel Integration** - Automatically detects PR numbers from Vercel preview URLs\n- 📝 **GitHub PR Comments** - Posts detailed error reports directly to the relevant PR\n- ⚡ **TypeScript First** - Full TypeScript support with comprehensive type definitions\n- 🧩 **Modular Design** - Separate client/server modules for flexible usage\n- 🎯 **Framework Agnostic** - Works with Next.js App Router and Pages Router\n- 🤖 **GitHub Action** - Automated setup for new projects\n\n## Installation\n\n### Option 1: GitHub Action (Recommended)\n\nAdd this to your `.github/workflows/setup-error-logging.yml`:\n\n\\`\\`\\`yaml\nname: Setup PR Error Logger\non:\n  push:\n    branches: [main]\n\njobs:\n  setup:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: your-org/pr-error-logger@v1\n        with:\n          github-token: \\${{ secrets.GITHUB_TOKEN }}\n\\`\\`\\`\n\n### Option 2: Manual Installation\n\n\\`\\`\\`bash\nnpm install @your-org/pr-error-logger\n\\`\\`\\`\n\n## Quick Start\n\n### 1. Set up the API endpoint\n\nCreate `pages/api/log-error.ts` (or `app/api/log-error/route.ts` for App Router):\n\n\\`\\`\\`typescript\nimport { createApiHandler } from '@your-org/pr-error-logger/server';\n\nexport default createApiHandler();\n\\`\\`\\`\n\n### 2. Initialize the client\n\nIn your `pages/_app.tsx`:\n\n\\`\\`\\`typescript\nimport { PRErrorLogger } from '@your-org/pr-error-logger/client';\n\n// Initialize error logging\nif (typeof window !== 'undefined') {\n  new PRErrorLogger({\n    enableConsoleCapture: true,\n    enableErrorCapture: true,\n    enableWarningCapture: true,\n  });\n}\n\nexport default function App({ Component, pageProps }) {\n  return <Component {...pageProps} />;\n}\n\\`\\`\\`\n\n### 3. Configure environment variables\n\nAdd to your `.env.local`:\n\n\\`\\`\\`\nGITHUB_TOKEN=your_github_token_here\nVERCEL_GIT_REPO_OWNER=your-username\nVERCEL_GIT_REPO_SLUG=your-repo-name\n\\`\\`\\`\n\n## Usage Examples\n\n### Basic Error Logging\n\n\\`\\`\\`typescript\nimport { PRErrorLogger } from '@your-org/pr-error-logger/client';\n\nconst logger = new PRErrorLogger();\n\n// Manual logging\nlogger.manualLog('Custom error message', 'error', { userId: 123 });\n\n// Automatic error capture is enabled by default\nthrow new Error('This will be automatically logged');\n\\`\\`\\`\n\n### Advanced Configuration\n\n\\`\\`\\`typescript\nimport { PRErrorLogger } from '@your-org/pr-error-logger/client';\n\nconst logger = new PRErrorLogger({\n  apiEndpoint: '/api/custom-error-handler',\n  enableConsoleCapture: true,\n  enableErrorCapture: true,\n  enableWarningCapture: false,\n  maxLogEntries: 50,\n  debounceMs: 2000,\n});\n\\`\\`\\`\n\n### Server-side Usage\n\n\\`\\`\\`typescript\nimport { GitHubService } from '@your-org/pr-error-logger/server';\n\nconst github = new GitHubService(\n  process.env.GITHUB_TOKEN!,\n  'owner',\n  'repository'\n);\n\nawait github.postErrorComment(123, errorLogs);\n\\`\\`\\`\n\n## API Reference\n\n### PRErrorLogger\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `apiEndpoint` | string | `/api/log-error` | Endpoint for sending logs |\n| `enableConsoleCapture` | boolean | `true` | Capture console.log/warn/error |\n| `enableErrorCapture` | boolean | `true` | Capture window errors |\n| `enableWarningCapture` | boolean | `true` | Capture console warnings |\n| `maxLogEntries` | number | `100` | Maximum logs to buffer |\n| `debounceMs` | number | `1000` | Debounce time for sending logs |\n\n### Methods\n\n- `manualLog(message, level, data?)` - Manually log a message\n- `flush()` - Force send all buffered logs\n- `destroy()` - Clean up event listeners\n\n## How It Works\n\n1. **Error Capture**: The client automatically captures browser errors, console logs, and device information\n2. **PR Detection**: Uses Vercel environment variables to identify the PR number\n3. **Batching**: Logs are batched and sent to your API endpoint with debouncing\n4. **GitHub Integration**: Server processes logs and posts formatted comments to the relevant PR\n5. **Update Logic**: Existing error comments are updated rather than creating new ones\n\n## Environment Variables\n\n| Variable | Description | Required |\n|----------|-------------|----------|\n| `GITHUB_TOKEN` | GitHub token with repo access | Yes |\n| `VERCEL_GIT_REPO_OWNER` | Repository owner | Auto-detected |\n| `VERCEL_GIT_REPO_SLUG` | Repository name | Auto-detected |\n| `VERCEL_URL` | Deployment URL | Auto-detected |\n| `VERCEL_ENV` | Environment (preview/production) | Auto-detected |\n\n## TypeScript Support\n\nFull TypeScript definitions are included:\n\n\\`\\`\\`typescript\nimport type { \n  ErrorLogEntry, \n  DeviceInfo, \n  LoggerConfig \n} from '@your-org/pr-error-logger';\n\\`\\`\\`\n\n## Contributing\n\n1. Clone the repository\n2. Install dependencies: `npm install`\n3. Build the package: `npm run build`\n4. Run tests: `npm test`\n\n## Publishing\n\n1. Update version in `package.json`\n2. Build: `npm run build`\n3. Publish: `npm publish`\n4. Create GitHub release with tag for Action usage\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.","readmeFilename":"README.md"}