diff --git a/.github/workflows/vercel-connect-token-ci.yml b/.github/workflows/vercel-connect-token-ci.yml new file mode 100644 index 0000000..f8c6116 --- /dev/null +++ b/.github/workflows/vercel-connect-token-ci.yml @@ -0,0 +1,53 @@ +name: vercel-node-connect-token CI + +on: + push: + branches: [master] + paths: + - examples/vercel-node-connect-token/** + - .github/workflows/vercel-connect-token-ci.yml + pull_request: + paths: + - examples/vercel-node-connect-token/** + - .github/workflows/vercel-connect-token-ci.yml + +concurrency: + group: vercel-connect-token-${{ github.ref }} + cancel-in-progress: true + +jobs: + ci: + name: install / lint / test / build + runs-on: ubuntu-latest + defaults: + run: + working-directory: examples/vercel-node-connect-token + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up pnpm + uses: pnpm/action-setup@v4 + with: + version: 11.1.1 + run_install: false + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 24 + cache: pnpm + cache-dependency-path: examples/vercel-node-connect-token/pnpm-lock.yaml + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Lint + run: pnpm run lint + + - name: Test + run: pnpm run test + + - name: Build + run: pnpm run build diff --git a/examples/vercel-node-connect-token/api/token.ts b/examples/vercel-node-connect-token/api/token.ts index 4211ef5..cc53ae3 100644 --- a/examples/vercel-node-connect-token/api/token.ts +++ b/examples/vercel-node-connect-token/api/token.ts @@ -4,6 +4,11 @@ import { PluggyClient } from 'pluggy-sdk' const { PLUGGY_CLIENT_ID, PLUGGY_CLIENT_SECRET } = process.env export default function (req: VercelRequest, res: VercelResponse) { + if (!PLUGGY_CLIENT_ID || !PLUGGY_CLIENT_SECRET) { + res.status(500).json({ error: 'Missing PLUGGY_CLIENT_ID or PLUGGY_CLIENT_SECRET' }) + return + } + const pluggyClient = new PluggyClient({ clientId: PLUGGY_CLIENT_ID, clientSecret: PLUGGY_CLIENT_SECRET diff --git a/examples/vercel-node-connect-token/package.json b/examples/vercel-node-connect-token/package.json index 669bd0f..b9b5695 100644 --- a/examples/vercel-node-connect-token/package.json +++ b/examples/vercel-node-connect-token/package.json @@ -15,12 +15,17 @@ }, "scripts": { "preinstall": "pnpm audit && pnpm audit signatures", - "lint:lockfile": "pnpm install --frozen-lockfile" + "lint:lockfile": "pnpm install --frozen-lockfile", + "typecheck": "tsc --noEmit", + "lint": "tsc --noEmit", + "test": "tsc --noEmit", + "build": "tsc --noEmit" }, "dependencies": { "pluggy-sdk": "0.7.1" }, "devDependencies": { - "@vercel/node": "1.10.0" + "@vercel/node": "1.10.0", + "typescript": "5.9.3" } } diff --git a/examples/vercel-node-connect-token/pnpm-lock.yaml b/examples/vercel-node-connect-token/pnpm-lock.yaml index da698b3..3c2be00 100644 --- a/examples/vercel-node-connect-token/pnpm-lock.yaml +++ b/examples/vercel-node-connect-token/pnpm-lock.yaml @@ -15,6 +15,9 @@ importers: '@vercel/node': specifier: 1.10.0 version: 1.10.0 + typescript: + specifier: 5.9.3 + version: 5.9.3 packages: @@ -71,6 +74,11 @@ packages: engines: {node: '>=4.2.0'} hasBin: true + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} + hasBin: true + undici-types@7.19.2: resolution: {integrity: sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==} @@ -134,6 +142,8 @@ snapshots: typescript@3.9.3: {} + typescript@5.9.3: {} + undici-types@7.19.2: {} webidl-conversions@3.0.1: {} diff --git a/examples/vercel-node-connect-token/tsconfig.json b/examples/vercel-node-connect-token/tsconfig.json new file mode 100644 index 0000000..e5b815f --- /dev/null +++ b/examples/vercel-node-connect-token/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "isolatedModules": true, + "noEmit": true + }, + "include": ["api/**/*"] +}