@the-brotherhood-1984/ecommerce-detector
v1.0.2
Published
Detect ecommerce platforms from URLs
Readme
Ecommerce Detector
A simple CLI tool to detect ecommerce platforms from URLs.
Installation
Local Development
npm install
npm run buildFrom NPM Registry
# Install from npm registry
npm install @the-brotherhood-1984/ecommerce-detector
# Or use npx directly
npx @the-brotherhood-1984/ecommerce-detector <URL>From GitLab Registry
# Install from GitLab npm registry
npm install @the-brotherhood-1984/ecommerce-detector
# Or use npx directly
npx @the-brotherhood-1984/ecommerce-detector <URL>Usage
Single URL
npx ecommerce-detector <URL>Batch Processing from File
npx ecommerce-detector --file <filename>
npx ecommerce-detector -f <filename>Examples
# Single URL detection
npx ecommerce-detector https://example.com
npx ecommerce-detector fravega.com
# Batch processing from file
npx ecommerce-detector --file urls.txt
npx ecommerce-detector -f urls.txtHow it works
The tool:
- Cleans the input URL (discards pathname, keeps only domain)
- Tests the URL against a list of platform detectors
- Returns the detected platform or "No ecommerce platform detected"
File Format for Batch Processing
When using --file or -f, provide a text file with:
- One URL per line
- Lines starting with
#are treated as comments and ignored - Empty lines are ignored
- Both plain domains and full URLs are supported
Example urls.txt:
# Sample URLs for testing
fravega.com
https://example.com
store.mysite.comCurrent Detectors
- VTEX: Checks for
/api/catalog_system/pub/products/searchendpoint returning 2xx status - Shopify: Detects Shopify stores by looking for CDN links (
https://cdn.shopify.com) and other Shopify indicators in the HTML content
Development
npm run dev # Run with ts-node
npm run build # Build TypeScript to JavaScript
npm start # Run built JavaScript
npm test # Run test suiteAdding New Detectors
Create a new detector class implementing the PlatformDetector interface and add it to the detectors array in src/detector.ts.
Testing
The project includes a comprehensive test suite in the tests/ directory. Run tests with:
npm testSee tests/README.md for detailed testing information.
CI/CD Pipeline
This project uses GitLab CI/CD with semantic-release to automatically build, test, and publish the application:
Pipeline Stages
- Validate Stage: Runs on merge requests to ensure code quality
- Build Stage: Compiles TypeScript to JavaScript
- Package Stage: Creates npm package (.tgz)
- Publish MR Stage: Publishes merge request packages to GitLab registry for testing
- Publish Release Stage: Uses semantic-release for automated versioning and publishing
Pipeline Features
- Automatic Versioning: Uses conventional commits to determine next version
- Changelog Generation: Automatically generates release notes
- Dual Publishing: Publishes to both npm registry and GitLab registry
- GitLab Releases: Creates GitLab releases with assets
- Merge Request Testing: Allows testing packages before merging to main
Pipeline Triggers
- Merge Requests: Runs validate, build, package, and publish-mr stages
- Main Branch: Runs all stages including semantic-release for production publishing
Package Availability
After successful pipeline execution, the package is available at:
- NPM Registry:
@the-brotherhood-1984/ecommerce-detector - GitLab Registry:
@the-brotherhood-1984/ecommerce-detector
Semantic Release Configuration
The project uses semantic-release with the following plugins:
@semantic-release/commit-analyzer- Analyzes commits for version bumps@semantic-release/release-notes-generator- Generates changelog@semantic-release/npm- Updates package.json and publishes to npm@semantic-release/git- Creates git tags and commits@semantic-release/gitlab- Creates GitLab releases
Commit Convention
Follow conventional commits for automatic versioning:
feat:- New features (minor version bump)fix:- Bug fixes (patch version bump)BREAKING CHANGE:- Breaking changes (major version bump)
