|
| 1 | +/** |
| 2 | + * All Contributors Configuration for LightSpeedWP Organization |
| 3 | + * |
| 4 | + * Manages contributor recognition and README generation. |
| 5 | + * This configuration provides: |
| 6 | + * - Comprehensive contributor type definitions |
| 7 | + * - Environment variable overrides for CI/CD |
| 8 | + * - Custom commit message templates |
| 9 | + * - Badge and image customization |
| 10 | + * |
| 11 | + * Environment Variables: |
| 12 | + * - CONTRIBUTORS_AUTO_COMMIT: Enable auto-commits (default: false) |
| 13 | + * - CONTRIBUTORS_IMAGE_SIZE: Badge image size (default: 100) |
| 14 | + * - CONTRIBUTORS_PER_LINE: Contributors per line (default: 7) |
| 15 | + * - CONTRIBUTORS_PROJECT_NAME: Override project name |
| 16 | + * - CONTRIBUTORS_PROJECT_OWNER: Override project owner |
| 17 | + */ |
| 18 | + |
| 19 | +/** |
| 20 | + * Load environment variables with fallback defaults |
| 21 | + */ |
| 22 | +require("dotenv").config(); |
| 23 | + |
| 24 | +/** |
| 25 | + * Configuration constants with environment variable overrides |
| 26 | + */ |
| 27 | +const projectName = process.env.CONTRIBUTORS_PROJECT_NAME || ".github"; |
| 28 | +const projectOwner = process.env.CONTRIBUTORS_PROJECT_OWNER || "lightspeedwp"; |
| 29 | +const autoCommit = process.env.CONTRIBUTORS_AUTO_COMMIT === "true"; |
| 30 | +const imageSize = parseInt(process.env.CONTRIBUTORS_IMAGE_SIZE) || 100; |
| 31 | +const contributorsPerLine = parseInt(process.env.CONTRIBUTORS_PER_LINE) || 7; |
| 32 | + |
| 33 | +/** |
| 34 | + * All Contributors Configuration Object |
| 35 | + * |
| 36 | + * @type {import('all-contributors-cli').Configuration} |
| 37 | + */ |
| 38 | +module.exports = { |
| 39 | + /** |
| 40 | + * Project identification |
| 41 | + */ |
| 42 | + projectName, |
| 43 | + projectOwner, |
| 44 | + repoType: "github", |
| 45 | + repoHost: "https://github.com", |
| 46 | + |
| 47 | + /** |
| 48 | + * Project metadata |
| 49 | + */ |
| 50 | + projectDescription: |
| 51 | + "GitHub Community Health files for LightSpeedWP organization", |
| 52 | + projectWebsite: "https://lightspeedwp.agency", |
| 53 | + license: "GPL-2.0-or-later", |
| 54 | + |
| 55 | + /** |
| 56 | + * Files to update with contributor information |
| 57 | + * Additional files can be added for multi-file projects |
| 58 | + */ |
| 59 | + files: [ |
| 60 | + "README.md", |
| 61 | + // Add more files as needed |
| 62 | + // 'docs/CONTRIBUTORS.md', |
| 63 | + // 'CHANGELOG.md' |
| 64 | + ], |
| 65 | + |
| 66 | + /** |
| 67 | + * Badge and image configuration |
| 68 | + */ |
| 69 | + imageSize, |
| 70 | + contributorsPerLine, |
| 71 | + |
| 72 | + /** |
| 73 | + * Badge URL template (can be customized for different services) |
| 74 | + */ |
| 75 | + badgeTemplate: |
| 76 | + "https://img.shields.io/badge/all_contributors-<%= contributors.length %>-orange.svg?style=flat-square", |
| 77 | + |
| 78 | + /** |
| 79 | + * Commit configuration |
| 80 | + * Controls automatic commits when contributors are added |
| 81 | + */ |
| 82 | + commit: autoCommit, |
| 83 | + commitConvention: "conventional", |
| 84 | + |
| 85 | + /** |
| 86 | + * Custom commit message templates |
| 87 | + */ |
| 88 | + commitTemplate: { |
| 89 | + add: "docs: add <%= username %> as a contributor for <%= contributions %>", |
| 90 | + update: "docs: update contributors", |
| 91 | + }, |
| 92 | + |
| 93 | + /** |
| 94 | + * Link to usage guidelines |
| 95 | + * Helps new contributors understand how to get recognized |
| 96 | + */ |
| 97 | + linkToUsage: true, |
| 98 | + |
| 99 | + /** |
| 100 | + * Skip asking for contribution types |
| 101 | + * When true, will add all available contribution types |
| 102 | + */ |
| 103 | + skipCi: false, |
| 104 | + |
| 105 | + /** |
| 106 | + * Current contributors list |
| 107 | + * This will be automatically updated as contributors are added |
| 108 | + */ |
| 109 | + contributors: [ |
| 110 | + { |
| 111 | + login: "lightspeedwp", |
| 112 | + name: "LightSpeedWP", |
| 113 | + avatar_url: "https://avatars.githubusercontent.com/u/13472139?v=4", |
| 114 | + profile: "https://github.com/lightspeedwp", |
| 115 | + contributions: [ |
| 116 | + "ideas", // Ideas, planning, feedback |
| 117 | + "fundingFinding", // Finding/providing funding |
| 118 | + "projectManagement", // Project management |
| 119 | + "business", // Business development |
| 120 | + "code", // Code |
| 121 | + "design", // Design |
| 122 | + "doc", // Documentation |
| 123 | + "infra", // Infrastructure (CI/CD, etc) |
| 124 | + "maintenance", // Maintenance |
| 125 | + "test", // Tests |
| 126 | + ], |
| 127 | + }, |
| 128 | + ], |
| 129 | + |
| 130 | + /** |
| 131 | + * Available contribution types |
| 132 | + * Can be extended with custom contribution types |
| 133 | + */ |
| 134 | + contributionTypes: { |
| 135 | + // Standard types are automatically included |
| 136 | + // Custom types can be added here |
| 137 | + agent: { |
| 138 | + symbol: "🤖", |
| 139 | + description: "AI Agent Development", |
| 140 | + link: '[<%= symbol %>](<%= url %> "AI Agent Development")', |
| 141 | + }, |
| 142 | + automation: { |
| 143 | + symbol: "⚙️", |
| 144 | + description: "Automation & Workflows", |
| 145 | + link: '[<%= symbol %>](<%= url %> "Automation & Workflows")', |
| 146 | + }, |
| 147 | + devops: { |
| 148 | + symbol: "🚀", |
| 149 | + description: "DevOps & Deployment", |
| 150 | + link: '[<%= symbol %>](<%= url %> "DevOps & Deployment")', |
| 151 | + }, |
| 152 | + }, |
| 153 | + |
| 154 | + /** |
| 155 | + * Custom functions for contributor validation and processing |
| 156 | + */ |
| 157 | + functions: { |
| 158 | + /** |
| 159 | + * Validate GitHub username format |
| 160 | + */ |
| 161 | + validateUsername: function (username) { |
| 162 | + const usernameRegex = /^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/i; |
| 163 | + return usernameRegex.test(username); |
| 164 | + }, |
| 165 | + |
| 166 | + /** |
| 167 | + * Generate contributor stats |
| 168 | + */ |
| 169 | + generateStats: function (contributors) { |
| 170 | + return { |
| 171 | + total: contributors.length, |
| 172 | + byType: contributors.reduce((acc, contributor) => { |
| 173 | + contributor.contributions.forEach((type) => { |
| 174 | + acc[type] = (acc[type] || 0) + 1; |
| 175 | + }); |
| 176 | + return acc; |
| 177 | + }, {}), |
| 178 | + }; |
| 179 | + }, |
| 180 | + }, |
| 181 | +}; |
0 commit comments