How rosbel/crawl-n-snap works
Project Type and Purpose
• This is a CLI tool built in TypeScript that leverages Playwright to take website screenshots at various resolutions.
• It includes functionality for optionally crawling linked pages on a website and capturing screenshots for each.
• The tool also supports multiple browsers (Chromium, Firefox, WebKit) and presets for desktop/mobile devices.
Analyzing the File Structure
• Top-Level Files & Configurations: Files such as .eslintrc.json, .prettierrc, package.json, tsconfig.json, and vitest.config.ts show that the project follows strict code style, type safety, and testing conventions.
• Directories:
• The src directory contains the core code. The main entry (src/index.ts) and test files (e.g., src/link-extraction.test.ts, src/utils.test.ts) indicate that key functionalities (like link extraction and utility operations) are modularized.
• The static folder likely holds any additional assets (e.g., images, templates – though for a CLI tool these might be rare).
• The .github directory with workflows shows that CI/CD is automated, running tests, linting, and npm publishing.
Relationships and Data Flow
• From CLI “crawl-n-snap command” → Argument Parser → Core Engine.