|
| 1 | +# Project Structure |
| 2 | + |
| 3 | +## Root Directory |
| 4 | +- `package.json` - Main package configuration and dependencies |
| 5 | +- `tsconfig.json` - TypeScript configuration extending gts |
| 6 | +- `api-extractor.json` - API documentation extraction config |
| 7 | +- `.eslintrc.json` - ESLint configuration extending gts |
| 8 | +- `.prettierrc.js` - Prettier configuration via gts |
| 9 | + |
| 10 | +## Source Code (`src/`) |
| 11 | +- `index.ts` - Main public API exports |
| 12 | +- `main.ts` - CLI entry point and server startup |
| 13 | +- `functions.ts` - Core function registration and handling |
| 14 | +- `function_registry.ts` - Function registration system |
| 15 | +- `function_wrappers.ts` - Function signature adapters |
| 16 | +- `server.ts` - Express server setup and configuration |
| 17 | +- `invoker.ts` - Function invocation logic |
| 18 | +- `loader.ts` - Dynamic function loading |
| 19 | +- `types.ts` - TypeScript type definitions |
| 20 | +- `options.ts` - Configuration and command-line options |
| 21 | +- `logger.ts` - Logging utilities |
| 22 | +- `testing.ts` - Testing utilities (exported separately) |
| 23 | + |
| 24 | +### Middleware (`src/middleware/`) |
| 25 | +- `background_event_to_cloud_event.ts` - Event format conversion |
| 26 | +- `cloud_event_to_background_event.ts` - Reverse event conversion |
| 27 | +- `timeout.ts` - Request timeout handling |
| 28 | + |
| 29 | +### Other Core Files |
| 30 | +- `cloud_events.ts` - CloudEvents specification handling |
| 31 | +- `execution_context.ts` - Request execution context |
| 32 | +- `async_local_storage.ts` - Async context management |
| 33 | +- `pubsub_middleware.ts` - Pub/Sub specific middleware |
| 34 | + |
| 35 | +## Testing (`test/`) |
| 36 | +- Mirror structure of `src/` directory |
| 37 | +- `integration/` - Integration tests for different function types |
| 38 | +- `system-test/` - End-to-end system tests |
| 39 | +- `conformance/` - Conformance test setup |
| 40 | +- `data/` - Test fixtures and sample functions |
| 41 | + |
| 42 | +## Build Output (`build/`) |
| 43 | +- Generated JavaScript and type definitions |
| 44 | +- Mirrors `src/` structure |
| 45 | +- Main exports: `build/src/index.js` and `build/src/index.d.ts` |
| 46 | + |
| 47 | +## Documentation (`docs/`) |
| 48 | +- `generated/` - Auto-generated API documentation |
| 49 | +- Various markdown guides for specific features |
| 50 | +- `esm/` - ESM usage examples |
| 51 | + |
| 52 | +## Conventions |
| 53 | +- TypeScript source files in `src/` |
| 54 | +- Corresponding test files in `test/` with same name |
| 55 | +- Middleware components in dedicated subdirectory |
| 56 | +- Integration tests grouped by function signature type |
| 57 | +- All exports go through `src/index.ts` for clean public API |
0 commit comments