Script to fetch a doc's icon from its website
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 32/100
- Tipo de issue
- Funcionalidade
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- nodejs
- Domínio
- developer-experience
Direção de pesquisa
Start with the PR template and the existing public/icons/docs/<slug>/ layout to see the three files the script must write (16.png, [email protected], SOURCE), then find where npm scripts and the Node tests and type check are configured. The work covers HTML icon-tag discovery, PNG and ICO parsing, and alpha-aware downscaling, so read the draft PR #2781 before writing anything. Done means the script works for the three example sites and the tests pass, but the maintainer has not yet confirmed the approach.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Feature request
Summary
A small script that fetches a doc's icon from the documented project's website and saves it the way DevDocs expects:
npm run icon -- <doc_slug> <website>
It writes public/icons/docs/<slug>/16.png, [email protected] and SOURCE, the three files the PR template asks for.
Today, each new doc's icon is found, resized to 16 and 32 pixels and saved by hand. The script does that step for contributors and keeps the SOURCE file accurate. It also helps when updating a doc whose icon has changed.
How it works:
- It looks for the icon in the page's
<link rel="icon">and<link rel="apple-touch-icon">tags, trying the smallest one that is at least 32 pixels first. If none works, it tries/apple-touch-icon.pngand/favicon.ico. - It reads PNG files and ICO files, including ICO files that contain bitmaps rather than PNGs.
- It scales the icon by averaging pixels with premultiplied alpha, so 16-pixel icons stay crisp and transparent edges don't darken.
- It uses only Node's standard library, so there are no new dependencies. It sits beside the existing Node tests and type check.
- SVG-only icons can't be converted without a dependency, so the script says so.
--icon <image address>then uses a specific PNG or ICO instead.
Contributors should still check the result at 16 pixels, as they do today. The script only automates finding, resizing and recording the source.
I've prepared an implementation with tests in draft PR #2781. Would you be open to this? I'm happy to change the approach, for example to a thor task.
Examples
Tried on real sites:
npm run icon -- python https://www.python.orgsaves the icon from/static/apple-touch-icon-precomposed.png.npm run icon -- github https://docs.github.comsaves the icon from/assets/cb-345/images/site/favicon.png.npm run icon -- vue https://vuejs.orgexplains that the site only offerslogo.svg, and suggests--icon.
- Linguagem predominante
- Ruby
- Estrelas
- 39.6k
- Forks
- 2.7k
- Merge médio
- 21h 1min
- PRs com merge (30d)
- 21
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de freeCodeCamp/devdocs
-
class Data in Ruby 3.2Abertadocs/improvement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
freeCodeCamp/devdocs#1989 · 4 comentários · 4 reações ·
Mantenedores costumam responder em até 1 dia
-
sidebarAbertafeature
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 22/100
freeCodeCamp/devdocs#2776 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 8/100
freeCodeCamp/devdocs#2746 ·
Mantenedores costumam responder em até 1 dia
-
docs/update
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 20/100
freeCodeCamp/devdocs#2744 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
feature
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 30/100
freeCodeCamp/devdocs#2683 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de freeCodeCamp/devdocs
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
riverqueue/river#1576 ·
Mantenedores costumam responder em até 1 dia
-
respond_to? on a poly receiver answers true for a program class's private or protected methodAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 90/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Issue in config.yaml fileAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
TheOdinProject/curriculum#31512 ·
Mantenedores costumam responder em até 1 dia