|
| 1 | +# stripe-node |
| 2 | + |
| 3 | +## Testing |
| 4 | + |
| 5 | +- Run all tests: `just test` (builds first) |
| 6 | +- Run a specific test: `just test --grep "test name pattern"` |
| 7 | +- Tests use mocha |
| 8 | +- Must build TypeScript before testing (handled automatically by `just` commands) |
| 9 | + |
| 10 | +## Formatting & Linting |
| 11 | + |
| 12 | +- Format: `just format` (uses prettier) |
| 13 | +- Lint: `just lint` (uses eslint, also auto-fixes) |
| 14 | +- Lint check only: `just lint-check` |
| 15 | + |
| 16 | +## Key Locations |
| 17 | + |
| 18 | +- HTTP client interface: `src/net/HttpClient.ts` |
| 19 | +- Node.js HTTP implementation: `src/net/NodeHttpClient.ts` |
| 20 | +- Fetch-based HTTP implementation: `src/net/FetchHttpClient.ts` |
| 21 | +- Request orchestration (headers, auth, retries): `src/RequestSender.ts` |
| 22 | +- Core client setup: `src/stripe.core.ts` |
| 23 | +- API version: `src/apiVersion.ts` |
| 24 | + |
| 25 | +## Generated Code |
| 26 | + |
| 27 | +- Files containing `File generated from our OpenAPI spec` at the top are generated; do not edit. Similarly, any code block starting with `The beginning of the section generated from our OpenAPI spec` is generated and should not be edited directly. |
| 28 | + - If something in a generated file/range needs to be updated, add a summary of the change to your report but don't attempt to edit it directly. |
| 29 | + |
| 30 | +## Conventions |
| 31 | + |
| 32 | +- TypeScript source in `src/`, compiled to `cjs/` (CommonJS) and `esm/` (ES modules) |
| 33 | +- Multi-platform: exports for Node.js, browser, Deno, Bun, workers |
| 34 | +- Dependencies installed via yarn |
| 35 | +- Work is not complete until `just test`, `just format`, and `just lint` complete successfully. |
| 36 | +- All code must run on all supported Node versions (full list in the test section of @.github/workflows/ci.yml) |
| 37 | + |
| 38 | +### Comments |
| 39 | + |
| 40 | +- Comments MUST only be used to: |
| 41 | + 1. Document a function |
| 42 | + 2. Explain the WHY of a piece of code |
| 43 | + 3. Explain a particularly complicated piece of code |
| 44 | +- Comments NEVER should be used to: |
| 45 | + 1. Say what used to be there. That's no longer relevant! |
| 46 | + 2. Explain the WHAT of a piece of code (unless it's very non-obvious) |
| 47 | + |
| 48 | +It's ok not to put comments on/in a function if their addition wouldn't meaningfully clarify anything. |
0 commit comments