UNPKG

cardamon

Version:

A CLI tool for measuring the carbon footprint and energy consumption of web pages using the Cardamon model

99 lines (66 loc) 1.99 kB
# 🌱 Cardamon CLI A simple command-line tool for measuring the carbon footprint and energy consumption of web pages during development. ## Installation ```bash npm install -g cardamon ``` ## Usage ### Basic Usage ```bash cardamon http://localhost:3000 ``` ### Quick Mode (Fast Scrolling) For rapid testing during development: ```bash cardamon -q http://localhost:3000 ``` ### With Custom Carbon Intensity ```bash cardamon http://localhost:3000 --carbon-intensity 400 ``` ### Combining Options ```bash cardamon -q -c 350 http://localhost:3000 ``` ## Options - `<url>` - URL to measure (required) - `-c, --carbon-intensity <value>` - Carbon intensity in g CO2/kWh (default: 494) - `-q, --quick` - Quick mode: scroll to bottom quickly without waiting for full duration ## Measurement Modes ### Normal Mode (Default) - Takes ~10 seconds to complete - Scrolls slowly with 1-second delays between scrolls - Provides comprehensive measurements - Best for final assessments ### Quick Mode (`-q`) - Completes as soon as page bottom is reached - Scrolls rapidly with 100ms delays - Perfect for quick feedback during development ## Examples ```bash # Development testing - quick feedback cardamon -q http://localhost:3000 # Production assessment - full measurement cardamon https://mywebsite.com # Quick test with EU carbon intensity cardamon -q -c 350 http://localhost:8080 # Full measurement with custom carbon intensity cardamon -c 500 https://example.com ``` ## Development ```bash # Install dependencies npm install # Run in development mode (normal) npm run dev http://localhost:3000 # Run in development mode (quick) npm run dev -- -q http://localhost:3000 # Build for production npm run build # Run built version npm start http://localhost:3000 ``` # License Cardamon is distributed under the terms of the PolyForm Shield License (Version 1.0). See [LICENSE](https://polyformproject.org/licenses/shield/1.0.0/) for details. _Copyright © 2023 Root & Branch ltd_