-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Prerender sponsors for READMEs #638
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for es-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for hi-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for zh-hans-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for ja-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for pt-br-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for new-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for de-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for fr-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start. We also need to make sure that this script is run whenever the website is built.
src/_data/sponsors.md
Outdated
<p><a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://usenextbase.com"><img src="https://avatars.githubusercontent.com/u/145838380?v=4" alt="Nextbase Starter Kit" height="32"></a></p> | ||
<!--sponsorsend--> | ||
<!--techsponsorsstart--> | ||
<h2>Technology Sponsors</h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<h2>Technology Sponsors</h2> | |
<h3>Technology Sponsors</h3> | |
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than running this on build I'd suggest we run this as part of the workflow as we do now? This in turn commits sponsors data to the repo and triggers build automatically? 🤔
eslint.org/.github/workflows/data-fetch.yml
Lines 38 to 41 in 70bd284
- name: Fetch sponsor data | |
run: npm run fetch:sponsors | |
env: | |
ESLINT_GITHUB_TOKEN: ${{ secrets.DATA_FETCH_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah nvm it would run inside the build script as well 👍🏻. The doubt I had was is this related to build of the site? This is more related to data fetch scripts so I felt it would be better to chunk out of build related process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this isn't related to the site build. We need the new file to be committed and pushed to GitHub, so this should be run as part of the data-fetch
workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll also need to update this to include the new file:
eslint.org/tools/commit-data.sh
Lines 12 to 14 in 39c0146
# commit the result | |
git add src/_data/ | |
git commit -m "chore: Update remote data" |
tools/generate-sponsors.js
Outdated
@@ -26,20 +26,25 @@ const got = require("got"); | |||
|
|||
const SPONSORS_URL = | |||
"https://raw.githubusercontent.com/eslint/eslint.org/main/src/_data/sponsors.json"; | |||
const NEW_FILE_PATH = "../src/_data/sponsors.md"; | |||
const NEW_FILE_PATH = "./sponsors.md"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's create a new folder for this, it doesn't belong in the tools
directory. Maybe includes
?
const SPONSORS_URL = | ||
"https://raw.githubusercontent.com/eslint/eslint.org/main/src/_data/sponsors.json"; | ||
const NEW_FILE_PATH = path.resolve(__dirname, "../sponsors/sponsors.md"); | ||
const TECH_SPONSORS_URL = | ||
"https://raw.githubusercontent.com/eslint/eslint.org/main/src/_data/techsponsors.json"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/_data/sponsors.json
and src/_data/techsponsors.json
are local files here, there's no need to fetch them.
|
||
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) | ||
to get your logo on our READMEs and [website](https://eslint.org/sponsors). | ||
<!--sponsorsstart--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove these comments because we're regenerating the entire file each time.
@@ -14,13 +14,14 @@ | |||
}, | |||
"license": "Apache-2.0", | |||
"scripts": { | |||
"build": "npm-run-all install:playground build:sass build:website build:playground build:minify-images", | |||
"build": "npm-run-all install:playground build:sass build:website build:playground build:minify-images build:sponsors", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't actually part of the site, so I don't think it should be included in this command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
I will make the requested changes. |
@amareshsm are you still working on this? |
Prerequisites checklist
What is the purpose of this pull request?
Prerender sponsors for READMEs
What changes did you make? (Give an overview)
I added a script that retrieves sponsor data from JSON files and formats it into HTML sections for a markdown file. This script categorizes sponsors by tier and incorporates technology sponsors with their respective images. It then saves the formatted content to a new markdown file,
sponsors.md
, which we will utilize in our other repositories.Related Issues
#619
Is there anything you'd like reviewers to focus on?
Please let me know if this approach works and I'm open to any suggestions/changes.