This document provides detailed instructions for developers who want to set up, develop, test, and build the @interactive-video-labs/angular project.
- Prerequisites
- Getting Started
- Project Structure
- Development Scripts
- Linting and Formatting
- Troubleshooting
Before you begin, ensure you have the following installed:
- Node.js: Version 18 or higher. You can download it from nodejs.org.
- pnpm: Our preferred package manager. If you don't have it, install it globally:
Alternatively, you can use
npm install -g pnpm
npmoryarn, butpnpmis recommended for consistent dependency management.
-
Clone the repository:
git clone https://github.com/interactive-video-labs/interactive-video-angular-wrapper.git cd interactive-video-angular-wrapper -
Install dependencies:
pnpm install
This will install all project dependencies, including development and peer dependencies.
src/: Contains the source code for the Angular wrapper component.index.ts: The main entry point for the library, exportingInteractiveVideoComponentand related types.
test/: Contains unit tests for the components.interactive-video.test.ts: Tests for theInteractiveVideoComponent.
dist/: (Generated after build) Contains the compiled output of the library (ESM, CJS, and declaration files).examples/: Contains example usage of the Angular wrapper.tsup.config.ts: Configuration fortsup, used to bundle the TypeScript library.vitest.config.ts: Configuration forVitest, our testing framework.
Here are the commonly used scripts for development:
pnpm installInstalls all project dependencies. Run this after cloning the repository or pulling new changes.
pnpm buildCompiles the TypeScript source code into JavaScript (ESM and CJS formats) and generates declaration files (.d.ts) in the dist/ directory. This command is run automatically before publishing.
pnpm devStarts the tsup build in watch mode. This is useful during development as it automatically recompiles the library whenever source files change.
pnpm testExecutes all unit tests using Vitest. Ensure all tests pass before submitting a pull request.
pnpm cleanRemoves the dist/ directory, effectively cleaning up all compiled output.
(Note: Currently, there are no explicit linting or formatting scripts configured in package.json. Please adhere to the existing code style and best practices observed in the codebase.)
pnpm installfails: Ensure you have Node.js and pnpm installed correctly. Check your internet connection.- Build errors: Verify that all dependencies are installed (
pnpm install) and that your TypeScript code has no compilation errors. - Tests failing: Run
pnpm testto see detailed error messages. Ensure your changes haven't introduced regressions. - Peer dependency issues: If you encounter issues related to
@angular/coreor@angular/common, ensure that the versions installed in your consuming application match the peer dependency ranges specified inpackage.json(^15.0.0 || ^16.0.0 || ^17.0.0).