A command-line tool for checking Baseline web feature compatibility in your local projects.
- β Local file scanning - Detect web features in CSS, JS, and framework files
- π Watch mode - Continuously monitor files for changes
- π Rich terminal output - Colored, formatted compatibility reports
- π» Feature-rich Dashboard - A one stop solution for all the projects and reports and trends
- π HTML reports - Generate detailed compatibility reports
- π¨ Multiple file types - Supports CSS, SCSS, JS, TS, JSX, TSX, Vue, Svelte
- β‘ Fast scanning - Efficiently scan large codebases
# Install globally
npm install -g @greenlightci/cli
# Or use with npx
npx @greenlightci/cli checkScan your project for Baseline compatibility issues:
# Check current directory
greenlightci check
# Check specific directory
greenlightci check ./src
# Check with custom options
greenlightci check --target-year 2024 --block-newly --verbose
# Output as JSON
greenlightci check --json > report.jsonOptions:
-t, --target-year <year>- Target Baseline year (default: 2023)--block-newly- Block newly available features--block-limited- Block limited availability features--json- Output results as JSON--verbose- Show detailed output--include <patterns>- File patterns to include (comma-separated)--exclude <patterns>- File patterns to exclude (comma-separated)
greenlightci check ./src --dashboard-url https://greenlightci-dashboard.vercel.app --dashboard-api-key your-api-keyTo obtain the api key sign-in to the dashboard at https://greenlightci-dashboard.vercel.app with github and then go to settings to obtain the api key.
Continuously monitor files for changes:
# Watch current directory
greenlightci watch
# Watch specific directory
greenlightci watch ./src
# Watch with custom patterns
greenlightci watch --include "src/**/*.{js,css}" --exclude "node_modules/**"Options:
-t, --target-year <year>- Target Baseline year--block-newly- Block newly available features--block-limited- Block limited availability features--include <patterns>- File patterns to include--exclude <patterns>- File patterns to exclude
Generate a detailed compatibility report:
# Generate HTML report
greenlightci report
# Generate JSON report
greenlightci report --format json --output report.json
# Generate report for specific directory
greenlightci report ./src --output dist/baseline-report.htmlOptions:
-t, --target-year <year>- Target Baseline year-o, --output <file>- Output file path (default: baseline-report.html)--format <type>- Output format: html or json (default: html)--include <patterns>- File patterns to include--exclude <patterns>- File patterns to exclude
π¦ GreenLightCI - Baseline Compatibility Check
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
src/styles/main.css [85/100]
β CSS Grid - Widely Available
β Container Queries - Newly Available
β CSS Nesting - Newly Available
src/components/Button.tsx [92/100]
β Optional Chaining - Widely Available
β Nullish Coalescing - Widely Available
π Scan Summary
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Files Scanned: 15
Features Detected: 32
Blocking Issues: 0
Warnings: 5
Average Score: 88
ββββββββββββββββββββ 88%
β Found 5 warnings
Consider adding polyfills for better compatibility
π GreenLightCI - Watch Mode
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βΉ Watching: ./src
βΉ Target Year: 2023
βΉ Press Ctrl+C to stop
β Initial scan complete. Watching for changes... (24 files)
[10:45:23] changed src/styles/main.css
Score: 85/100 | Features: 3
β Container Queries - β Newly Available
β CSS Nesting - β Newly Available
β Consider adding polyfills
- Container Queries (
@container) :has()Selector- CSS Grid
- Subgrid
- CSS Nesting
- Custom Properties (CSS Variables)
- Logical Properties
- Optional Chaining (
?.) - Nullish Coalescing (
??) - Dynamic Import
- Top-level Await
- Private Fields
You can create a .greenlightrc.json file in your project root:
{
"targetYear": "2023",
"blockNewly": false,
"blockLimited": true,
"include": ["src/**/*.{css,js,ts}"],
"exclude": ["node_modules/**", "dist/**"]
}Supported file extensions:
- CSS:
.css,.scss,.less - JavaScript:
.js,.ts,.jsx,.tsx - Frameworks:
.vue,.svelte
- Use watch mode during development - Get instant feedback on compatibility
- Generate reports before releases - Create HTML reports for stakeholders
- Integrate with CI/CD - Use JSON output for automated checks
- Customize patterns - Focus on specific directories with include/exclude
- Use verbose mode - Get detailed information about each feature
- Use Dashboard - Get your reports saved to greenlight dashboard
Add to your package.json:
{
"scripts": {
"baseline:check": "greenlightci check",
"baseline:watch": "greenlightci watch",
"baseline:report": "greenlightci report"
}
}# .husky/pre-commit
#!/bin/sh
npx greenlightci check --block-newly --block-limited# .github/workflows/baseline-check.yml
- name: Check Baseline Compatibility
run: |
npm install -g @greenlightci/cli
greenlightci check --json > baseline-report.json- @greenlightci/action - GitHub Action for PR checks
- @greenlightci/dashboard - Web dashboard for tracking adoption
MIT
Report issues on GitHub
Built with:
- Commander.js - CLI framework
- Chalk - Terminal colors
- Ora - Terminal spinners
- Chokidar - File watching
- web-features - Baseline data
Made with β€οΈ by Surya for the Baseline Tooling Hackathon