### Copy Environment Variables Example (Bash) Source: https://github.com/f88/promidas/blob/main/DEVELOPMENT.md Copies the example environment variables file to a new file for local configuration. This is the first step in setting up the development environment. ```bash cp .env.example .env ``` -------------------------------- ### Install Project Dependencies (Bash) Source: https://github.com/f88/promidas/blob/main/DEVELOPMENT.md Installs project dependencies using npm. `npm ci` is recommended for clean and consistent installations, especially in CI/CD environments, as it uses the `package-lock.json` file. ```bash npm ci ``` -------------------------------- ### Copy Test Environment Variables Example (Bash) Source: https://github.com/f88/promidas/blob/main/DEVELOPMENT.md Copies the example environment variables file to a new file specifically for the test environment. This allows for separate configuration for testing purposes. ```bash cp .env.example .env.test ``` -------------------------------- ### Run Demo Script (Bash) Source: https://github.com/f88/promidas/blob/main/DEVELOPMENT.md Executes a demo script using `tsx` to experiment with the repository API. This is a practical way to verify the setup and explore functionality. ```bash npx tsx scripts/try-protopedia-repository.ts ``` -------------------------------- ### Build Project (Bash) Source: https://github.com/f88/promidas/blob/main/DEVELOPMENT.md Compiles the project, generating production-ready artifacts. ```bash npm run build ``` -------------------------------- ### Initialize Fetcher Client with Logger (TypeScript) Source: https://github.com/f88/promidas/blob/main/lib/logger/docs/USAGE.md This example shows how to initialize the `ProtopediaApiCustomClient` from 'promidas/fetcher' with a console logger. It demonstrates passing logger options and a log level during client instantiation. ```typescript import { ProtopediaApiCustomClient } from 'promidas/fetcher'; import { createConsoleLogger } from 'promidas/logger'; const logger = createConsoleLogger(); const client = new ProtopediaApiCustomClient({ protoPediaApiClientOptions: { token: process.env.PROTOPEDIA_API_V2_TOKEN ?? 'no-token', }, logger, logLevel: 'info', }); ``` -------------------------------- ### Run Test Suite (Bash) Source: https://github.com/f88/promidas/blob/main/DEVELOPMENT.md Executes the project's test suite using npm. This command verifies the installation and configuration of the development environment. API calls are typically mocked during tests. ```bash npm test ``` -------------------------------- ### Run All Tests (Bash) Source: https://github.com/f88/promidas/blob/main/DEVELOPMENT.md Executes the entire test suite for the project. ```bash npm test ``` -------------------------------- ### Protopedia API Custom Client Event Handler Examples (TypeScript) Source: https://github.com/f88/promidas/blob/main/lib/fetcher/docs/DESIGN_PROGRESS.md Provides examples of how to use the `progressCallback` in the Protopedia API custom client to handle different progress events. Examples include simple logging, custom UI updates, and combining logging with analytics tracking. ```typescript // Example 1: Simple progress logging const client = new ProtopediaApiCustomClient({ progressLog: true, // Uses default logger output }); // Example 2: Custom event handler const client = new ProtopediaApiCustomClient({ progressLog: false, progressCallback: (event) => { switch (event.type) { case 'request-start': console.log('Request initiated'); break; case 'response-received': console.log(`Headers received in ${event.prepareTimeMs}ms`); break; case 'download-progress': updateProgressBar(event.percentage); break; case 'complete': console.log(`Download complete in ${event.totalTimeMs}ms`); break; case 'error': console.error(`Download failed: ${event.error}`); break; } }, }); // Example 3: Combined logging and custom handler const client = new ProtopediaApiCustomClient({ progressLog: true, // Logs to stderr progressCallback: (event) => { // Also send to analytics if (event.type === 'complete') { analytics.track('download-complete', { bytes: event.received, duration: event.totalTimeMs, }); } }, }); ``` -------------------------------- ### Cross-Reference Example (DESIGN to USAGE) Source: https://github.com/f88/promidas/blob/main/DOCUMENTATION.md Illustrates linking from DESIGN.md to USAGE.md to provide practical examples for concepts discussed in the design document, such as common patterns. ```markdown For practical examples, see [USAGE.md](USAGE.md#common-patterns). ``` -------------------------------- ### Conventional Commits Format Example Source: https://github.com/f88/promidas/blob/main/CONTRIBUTING.md Illustrates the structure of a commit message following the Conventional Commits specification. Includes type, scope, subject, body, and footer for breaking changes. ```text ():