mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-13 13:48:26 +00:00
feat(docs): add Zephyr Cloud to Hero Backers tier & rework updateSponsors script to also handle, well, sponsors (#4226)
This commit is contained in:
@@ -2,13 +2,13 @@ import { readdirSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
||||
|
||||
function updateOpenCollectiveBackers() {
|
||||
function updateSponsors() {
|
||||
const packagesPath = join(import.meta.dirname, '../packages');
|
||||
const mainReadme = readFileSync(join(import.meta.dirname, '../README.md'), 'utf8');
|
||||
const awesomeRegex = /(\[\/\/]: <> \(Open Collective backers\).+)$/s;
|
||||
const awesomeBlock = awesomeRegex.exec(mainReadme);
|
||||
if (awesomeBlock?.[1]) {
|
||||
const packageAwesomeBlock = awesomeBlock[1].replaceAll('src="docs/public/sponsors', 'src="https://lucide.dev/sponsors')
|
||||
const sponsorsRegex = /(\[\/\/]: <> \(Sponsors\).+)$/s;
|
||||
const sponsorsBlock = sponsorsRegex.exec(mainReadme);
|
||||
if (sponsorsBlock?.[1]) {
|
||||
const packageSponsorsBlock = sponsorsBlock[1].replaceAll('src="docs/public', 'src="https://lucide.dev')
|
||||
readdirSync(packagesPath).forEach((packagePath) => {
|
||||
if (['lucide-figma', 'shared'].includes(packagePath) || packagePath.startsWith('.')) {
|
||||
return;
|
||||
@@ -16,19 +16,19 @@ function updateOpenCollectiveBackers() {
|
||||
const readmePath = join(packagesPath, packagePath, 'README.md');
|
||||
if (existsSync(readmePath)) {
|
||||
const readmeContent = readFileSync(readmePath, 'utf8');
|
||||
if (awesomeRegex.test(readmeContent)) {
|
||||
writeFileSync(readmePath, readmeContent.replace(awesomeRegex, packageAwesomeBlock));
|
||||
console.log(`Upgraded Awesome backers block in ${readmePath}`);
|
||||
if (sponsorsRegex.test(readmeContent)) {
|
||||
writeFileSync(readmePath, readmeContent.replace(sponsorsRegex, packageSponsorsBlock));
|
||||
console.log(`Upgraded Sponsors block in ${readmePath}`);
|
||||
} else {
|
||||
console.error(`Could not find Awesome backers block in ${readmePath}`)
|
||||
console.error(`Could not find Sponsors block in ${readmePath}`)
|
||||
}
|
||||
} else {
|
||||
console.warn(`No readme found at ${readmePath}`);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.error('Could not identify Awesome backers block')
|
||||
console.error('Could not identify Sponsors block')
|
||||
}
|
||||
}
|
||||
|
||||
updateOpenCollectiveBackers();
|
||||
updateSponsors();
|
||||
Reference in New Issue
Block a user