$ show fregante/chrome-webstore-upload-cli
This is a CLI tool for uploading and publishing Chrome extensions to the Chrome Web Store. It wraps the `chrome-webstore-upload` library, providing a command-line interface with commands for upload, publish, or both. The tool handles OAuth2 authentication via environment variables, resolves the extension source (zip, crx, or directory with manifest.json), and supports options like deploy percentage, trusted testers, and max wait time for upload completion. The codebase is small, well-structured, and thoroughly tested with Ava. It demonstrates clean separation of concerns: configuration assembly in `config.js`, source resolution in `find-source.js`, API calls in `wrapper.js`, utility functions in `util.js`, and robust error handling in `error-handler.js`. The error handler is particularly well-crafted, extracting detailed error messages from Google API responses including field violations and localized messages. The tool is actively maintained with recent commits and CI testing across multiple Node.js versions.
The LLM identified 2 files worth highlighting for reuse:
Provides a reusable pattern for extracting and formatting error details from Google API error responses (e.g., BadRequest field violations, LocalizedMessage, ErrorInfo). The `extractDetailLines` function recursively parses nested error structures and deduplicates messages. The `handleError` function sets exit code and prints user-friendly error messages with links to documentation. This module is self-contained and could be extracted into any project that interacts with Google APIs.
Implements a robust source resolution strategy for CLI tools: first checks a provided flag, then falls back to `webExt.sourceDir` in package.json, then defaults to the current working directory. It validates that the resolved path exists, contains a valid `manifest.json` with a `manifest_version` field. The logic is isolated and could be reused in other CLI tools that need to locate a project directory or file with specific validation.