### Installing RetroAchievements API-JS Dependencies - Bash Source: https://github.com/retroachievements/api-js/blob/main/CONTRIBUTING.md These commands clone the RetroAchievements API-JS repository from GitHub, navigate into the project directory, and install the project's dependencies using pnpm. Node.js and pnpm must be installed beforehand. ```bash git clone https://github.com/RetroAchievements/api-js.git cd retroachievements-api-js pnpm install ``` -------------------------------- ### Installing RetroAchievements API Library (bash) Source: https://github.com/retroachievements/api-js/blob/main/README.md This command installs the `@retroachievements/api` library using npm and saves it as a dependency in your project's `package.json` file. It is the standard way to add the library to a Node.js or frontend project managed with npm. ```bash npm install --save @retroachievements/api ``` -------------------------------- ### Running Local Development Server - Bash Source: https://github.com/retroachievements/api-js/blob/main/CONTRIBUTING.md This command starts the local development environment for the RetroAchievements API-JS library. It typically runs the playground file (`__playground.ts`) in watch mode, allowing for real-time testing of code changes. ```bash pnpm dev ``` -------------------------------- ### Fetching Game Metadata with RetroAchievements API (TypeScript) Source: https://github.com/retroachievements/api-js/blob/main/README.md This example demonstrates how to use the `getGame` function to retrieve basic metadata for a specific game ID (14402). It requires the authorization object created in the previous step and returns a promise that resolves with the game data. ```typescript import { getGame } from "@retroachievements/api"; // This returns basic metadata about the game on this page: // https://retroachievements.org/game/14402 const game = await getGame(authorization, { gameId: 14402 }); ``` -------------------------------- ### Building the Project - Bash Source: https://github.com/retroachievements/api-js/blob/main/CONTRIBUTING.md This command initiates the project build process using microbundle. It compiles and bundles the source code into distributions suitable for publishing, typically found in a `dist` directory. ```bash pnpm build ``` -------------------------------- ### Running Project Tests - Bash Source: https://github.com/retroachievements/api-js/blob/main/CONTRIBUTING.md This command executes the project's test suite. It runs all defined tests to ensure the library functions correctly and new changes haven't introduced regressions. High test coverage is expected for contributions. ```bash pnpm test ``` -------------------------------- ### Manually Running Prettier Formatting - Bash Source: https://github.com/retroachievements/api-js/blob/main/CONTRIBUTING.md This command executes the Prettier code formatter for the project. It automatically reformats the code according to the configured style rules, helping maintain code consistency. Running this is an alternative to using editor auto-format on save. ```bash pnpm format:write ``` -------------------------------- ### Setting Playground API Credentials - TypeScript Source: https://github.com/retroachievements/api-js/blob/main/CONTRIBUTING.md This TypeScript snippet from the `__playground.ts` file shows placeholder variables for user credentials. Users should replace 'myUsername' and 'myWebApiKey' with their actual RetroAchievements username and web API key to test library functionality locally. ```typescript const username = "myUsername"; const webApiKey = "myWebApiKey"; ``` -------------------------------- ### Manually Running ESLint Autofix - Bash Source: https://github.com/retroachievements/api-js/blob/main/CONTRIBUTING.md This command runs ESLint, the project's linter, with the auto-fix option. It identifies potential code quality issues and automatically corrects them where possible, enforcing coding standards and preventing common errors. ```bash pnpm lint:fix ``` -------------------------------- ### Building RetroAchievements API Authorization Object (TypeScript) Source: https://github.com/retroachievements/api-js/blob/main/README.md This snippet imports the `buildAuthorization` function and uses it to create an authorization object. You must replace the placeholder values with your actual RetroAchievements username and web API key, obtained from your control panel, to authenticate subsequent API calls. ```typescript import { buildAuthorization } from "@retroachievements/api"; const username = ""; const webApiKey = ""; const authorization = buildAuthorization({ username, webApiKey }); ``` -------------------------------- ### Running Tests in Watch Mode - Bash Source: https://github.com/retroachievements/api-js/blob/main/CONTRIBUTING.md This command runs the project's test suite in watch mode. It continuously monitors for file changes and re-runs tests automatically when changes are detected, which is useful for active test development. ```bash pnpm test --watch ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.