Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ SHELL := /bin/bash
PROJECT_NAME := $(shell sed -n 's/^ "name": "\(.*\)",$$/\1/p' package.json)
NODE_VERSION := $(shell cat .nvmrc)
NODE_IMAGE := node:$(NODE_VERSION)
PNPM_VERSION := $(shell sed -n 's/^ "packageManager": "pnpm@\(.*\)",$$/\1/p' package.json)
PNPM := npx --yes pnpm@$(PNPM_VERSION)

DEV_CONTAINER := $(PROJECT_NAME)-dev
PORT := 4321
Expand All @@ -19,14 +21,13 @@ OPEN_CMD := $(shell command -v sensible-browser 2>/dev/null || command -v xdg
NODE_ENV_VARS = \
-u $(HOST_USER) \
-e HOME=/tmp \
-e COREPACK_HOME=/tmp/corepack \
-e COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \
-e CI=true \
-e ASTRO_TELEMETRY_DISABLED=1 \
-e GITHUB_TOKEN \
-e npm_config_store_dir=/tmp/pnpm-store \
-v $(CURDIR):/app -w /app

APP_RUN = docker run $(INTERACTIVE) --rm $(NODE_ENV_VARS) $(NODE_IMAGE) corepack pnpm
APP_RUN = docker run $(INTERACTIVE) --rm $(NODE_ENV_VARS) $(NODE_IMAGE) $(PNPM)

.PHONY: configure
configure: ## @setup Install dependencies
Expand All @@ -41,7 +42,7 @@ start: ## @setup Start the development server with live reload
@docker rm -f $(DEV_CONTAINER) > /dev/null 2>&1 || true
@docker run -d --rm --name $(DEV_CONTAINER) $(NODE_ENV_VARS) \
-p 127.0.0.1:$(PORT):$(PORT) \
$(NODE_IMAGE) corepack pnpm dev --host 0.0.0.0 --port $(PORT) > /dev/null
$(NODE_IMAGE) $(PNPM) dev --host 0.0.0.0 --port $(PORT) > /dev/null
@echo "Development server at $(SITE_URL)"

.PHONY: stop
Expand All @@ -61,7 +62,7 @@ preview: ## @setup Serve the built site, search included, on the development por
@docker rm -f $(DEV_CONTAINER) > /dev/null 2>&1 || true
@docker run -d --rm --name $(DEV_CONTAINER) $(NODE_ENV_VARS) \
-p 127.0.0.1:$(PORT):$(PORT) \
$(NODE_IMAGE) corepack pnpm preview --host 0.0.0.0 --port $(PORT) > /dev/null
$(NODE_IMAGE) $(PNPM) preview --host 0.0.0.0 --port $(PORT) > /dev/null
@echo "Built site at $(SITE_URL)"

.PHONY: brand-images
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ GitHub:
| `/` | A descrição e as estrelas de cada repositório, pela API REST da organização. |
| `/desafios` | O `README.md` de `desafios`, e o `PROBLEM.md` e o `SOLUTIONS.md` de cada desafio listado. |
| `/vagas` | As issues abertas de `vagas` e a descrição de cada label, pela API REST. |
| `/talentos` | As issues abertas de `me-contrata` com os labels `verificado` e `divulgar-perfil`. |
| `/projetos` | A tabela da seção `Projetos` do `README.md` de `opensource-br`. |
| `/comunidade.json` | Os números do terminal da home: vagas abertas, desafios, projetos e estrelas. |
| `/vagas.json` | As vagas abertas, com nível, regime, modelo de trabalho e tecnologias. |
| `/talentos.json` | Os perfis divulgados, com os mesmos campos das vagas e os links de contato. |

A leitura fica em `src/content/sources.ts`, e a interpretação de cada fonte fica em um módulo puro de
`src/content/`, coberto por testes. Uma requisição que falha interrompe o build, então o site publicado continua
Expand Down
1 change: 1 addition & 0 deletions src/components/SiteBar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ThemeToggle from './ThemeToggle.astro'
const sections = [
{ path: '/desafios/', label: 'Desafios' },
{ path: '/vagas/', label: 'Vagas' },
{ path: '/talentos/', label: 'Talentos' },
{ path: '/projetos/', label: 'Projetos' },
]
const here = Astro.url.pathname
Expand Down
65 changes: 65 additions & 0 deletions src/components/TalentItem.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
import type { TalentEntry } from '../content'
import { day, excerpt, since, TEXT } from '../content/site'
import { anchor } from '../content/talents'
import Avatar from './Avatar.astro'

interface Props {
talent: TalentEntry
}

const { data } = Astro.props.talent
const labels = TEXT.talents
const terms = [...data.level, ...data.contract, ...data.modality]
const contacts: { url: string; label: string }[] = [
{ url: data.linkedin, label: labels.linkedin },
{ url: data.github, label: labels.github },
{ url: data.portfolio, label: labels.portfolio },
{ url: data.url, label: labels.profile },
].flatMap((contact) => (contact.url === null ? [] : [{ url: contact.url, label: contact.label }]))
---

<li class="bb-card" id={anchor(data.number)}>
<div class="bb-card__head">
<Avatar url={data.avatar} size={28} />
<p class="bb-card__who">
<span class="bb-card__author">{data.location}</span>
<span class="bb-card__when">
<span class="sr-only">{labels.updated} </span><time datetime={data.updated} title={day(data.updated)}
>{since(data.updated)}</time
>
</span>
</p>
</div>
<h3 class="bb-card__title">{data.name}{data.role && ` · ${data.role}`}</h3>
{data.about && <p class="bb-card__summary">{excerpt(data.about, 280)}</p>}
<div class="bb-card__foot">
{
terms.length + data.stack.length > 0 && (
<ul class="bb-chips">
{terms.map((term) => (
<li class="bb-chip bb-chip--strong">{term}</li>
))}
{data.stack.map((term) => (
<li class="bb-chip">{term}</li>
))}
</ul>
)
}
<p class="bb-actions">
{
contacts.map((contact) => (
<a
href={contact.url}
target="_blank"
rel="noopener noreferrer nofollow"
class="bb-link"
aria-label={labels.contactOf(data.name, contact.label)}
>
{contact.label}
</a>
))
}
</p>
</div>
</li>
35 changes: 34 additions & 1 deletion src/content.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { REPOSITORY as JOBS, openings } from './content/jobs'
import { rehypeLineBreaks, rehypeOutline, rehypeUntrusted, SHIKI } from './content/markdown'
import { byStars, githubHome, REPOSITORY as PROJECTS, projects as projectList } from './content/projects'
import { catalogued } from './content/repositories'
import { REPOSITORY as TALENTS, talents as sharedTalents } from './content/talents'
import { accountStars, file, labels, openIssues, organizationRepositories, repositoryStars } from './content/sources'

const repositories = defineCollection({
Expand Down Expand Up @@ -137,6 +138,38 @@ const jobs = defineCollection({
}),
})

const talents = defineCollection({
loader: {
name: 'backend-br-talents',
load: async ({ store, logger }) => {
const [issues, catalog] = await Promise.all([openIssues(TALENTS), labels(TALENTS)])
const found = sharedTalents(issues, catalog)
store.clear()
for (const talent of found) {
store.set({ id: String(talent.number), data: { ...talent } })
}
logger.info(`Read ${found.length} shared profiles.`)
},
},
schema: z.object({
number: z.number(),
name: z.string(),
role: z.string(),
about: z.string(),
location: z.string(),
url: z.string(),
updated: z.string(),
modality: z.array(z.string()),
level: z.array(z.string()),
contract: z.array(z.string()),
stack: z.array(z.string()),
linkedin: z.string().nullable(),
github: z.string().nullable(),
portfolio: z.string().nullable(),
avatar: z.string(),
}),
})

const STAR_BATCH = 10

const projects = defineCollection({
Expand Down Expand Up @@ -184,4 +217,4 @@ const projects = defineCollection({
}),
})

export const collections = { repositories, challenges, jobs, projects }
export const collections = { repositories, challenges, jobs, projects, talents }
2 changes: 1 addition & 1 deletion src/content/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const CATALOG: readonly CatalogEntry[] = [
{ name: 'opensource-br', page: { path: '/projetos/', label: 'Ver os projetos' } },
{ name: 'forum' },
{ name: 'como-instalar-xyz' },
{ name: 'me-contrata' },
{ name: 'me-contrata', page: { path: '/talentos/', label: 'Ver os talentos' } },
{ name: 'eventos' },
{ name: 'poste-mais' },
]
Expand Down
7 changes: 7 additions & 0 deletions src/content/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type RepositoryEntry = CollectionEntry<'repositories'>
export type Challenge = CollectionEntry<'challenges'>
export type JobEntry = CollectionEntry<'jobs'>
export type ProjectEntry = CollectionEntry<'projects'>
export type TalentEntry = CollectionEntry<'talents'>

export async function repositories(): Promise<readonly RepositoryEntry[]> {
return (await getCollection('repositories')).sort((a, b) => a.data.order - b.data.order)
Expand All @@ -17,6 +18,12 @@ export async function jobs(): Promise<readonly JobEntry[]> {
return (await getCollection('jobs')).sort((a, b) => b.data.opened.localeCompare(a.data.opened))
}

export async function talents(): Promise<readonly TalentEntry[]> {
return (await getCollection('talents')).sort(
(a, b) => b.data.updated.localeCompare(a.data.updated) || a.data.number - b.data.number,
)
}

export async function projects(): Promise<readonly ProjectEntry[]> {
return (await getCollection('projects')).sort((a, b) => a.data.order - b.data.order)
}
Expand Down
1 change: 1 addition & 0 deletions src/content/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface Issue {
readonly title: string
readonly html_url: string
readonly created_at: string
readonly updated_at?: string
readonly locked: boolean
readonly pull_request?: unknown
readonly labels: readonly { readonly name: string }[]
Expand Down
22 changes: 22 additions & 0 deletions src/content/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,28 @@ export const TEXT = {
postUrl: `${repositoryUrl('vagas')}#como-cadastrar-uma-vaga`,
all: 'Ver todas no GitHub',
empty: 'Nenhuma vaga aberta agora. Acompanhe o repositório backend-br/vagas no GitHub para saber da próxima.',
feed: 'Vagas abertas em JSON',
feedPath: '/vagas.json',
},
talents: {
title: 'Talentos',
headline: 'Talentos de backend',
lede: 'Pessoas desenvolvedoras backend que pediram para divulgar o perfil em backend-br/me-contrata, com nível, regime, modelo de trabalho e tecnologias.',
count: (count: number) => plural(count, 'perfil divulgado', 'perfis divulgados'),
listed: 'Atualizados mais recentemente primeiro',
updated: 'Atualizado',
post: 'Divulgar meu perfil',
postUrl: `${repositoryUrl('me-contrata')}/issues/new/choose`,
all: 'Ver todos os perfis no GitHub',
profile: 'Perfil no GitHub',
linkedin: 'LinkedIn',
github: 'GitHub',
portfolio: 'Portfólio',
contactOf: (name: string, channel: string) => `${channel} de ${name}`,
empty:
'Nenhum perfil divulgado agora. Quem abre um perfil em backend-br/me-contrata pode marcar a opção de divulgação no formulário.',
feed: 'Perfis divulgados em JSON',
feedPath: '/talentos.json',
},
projects: {
title: 'Projetos open-source',
Expand Down
91 changes: 91 additions & 0 deletions src/content/talents.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { describe, expect, it } from 'vitest'
import type { Issue, Label } from './jobs'
import { anchor, talents } from './talents'

const LABELS: readonly Label[] = [
{ name: 'Remoto', description: 'Tipo de alocação.' },
{ name: 'Sênior', description: 'Nível de experiência.' },
{ name: 'PJ', description: 'Tipo de contratação.' },
{ name: 'Go', description: 'Linguagem de programação.' },
{ name: 'Stale', description: '[USO INTERNO] Candidatura que serão fechadas.' },
{ name: 'verificado', description: null },
]

function body(fields: Record<string, string>): string {
return Object.entries({
'Nome completo': 'Maria Silva',
Cargo: 'Desenvolvedora Back-end',
Apresentação: 'Seis anos com APIs.',
Localização: 'Belo Horizonte - MG',
LinkedIn: 'https://www.linkedin.com/in/maria',
GitHub: 'https://github.com/maria',
Portfólio: '_No response_',
...fields,
})
.map(([heading, value]) => `### ${heading}\n\n${value}`)
.join('\n\n')
}

function issue(number: number, labels: readonly string[], extra: Partial<Issue> = {}): Issue {
return {
number,
title: 'Maria Silva - Back-end',
html_url: `https://github.com/backend-br/me-contrata/issues/${number}`,
created_at: '2026-11-01T00:00:00Z',
updated_at: `2026-11-0${number}T00:00:00Z`,
locked: false,
labels: labels.map((name) => ({ name })),
user: { login: 'maria', avatar_url: '' },
body: body({}),
...extra,
}
}

const SHARED = ['verificado', 'divulgar-perfil']

describe('the shared talents', () => {
it('lists only verified profiles that opted in', () => {
const read = talents(
[issue(1, ['verificado']), issue(2, ['divulgar-perfil']), issue(3, [...SHARED, 'Sênior'])],
LABELS,
)

expect(read.map((talent) => talent.number)).toEqual([3])
})

it('reads the facets from the labels and leaves the status labels out', () => {
const [talent] = talents([issue(1, [...SHARED, 'Sênior', 'PJ', 'Remoto', 'Go', 'Stale'])], LABELS)

expect(talent?.level).toEqual(['Sênior'])
expect(talent?.contract).toEqual(['PJ'])
expect(talent?.modality).toEqual(['Remoto'])
expect(talent?.stack).toEqual(['Go'])
})

it('reads the form and keeps only profile links', () => {
const [talent] = talents(
[issue(1, SHARED, { body: body({ GitHub: 'javascript:alert(1)', Portfólio: 'https://maria.dev' }) })],
LABELS,
)

expect(talent).toMatchObject({
name: 'Maria Silva',
role: 'Desenvolvedora Back-end',
location: 'Belo Horizonte - MG',
linkedin: 'https://www.linkedin.com/in/maria',
github: null,
portfolio: 'https://maria.dev',
url: 'https://github.com/backend-br/me-contrata/issues/1',
})
})

it('puts the latest updated profiles first', () => {
const read = talents([issue(1, SHARED), issue(3, SHARED), issue(2, SHARED)], LABELS)

expect(read.map((talent) => talent.number)).toEqual([3, 2, 1])
})

it('anchors each profile by its issue number', () => {
expect(anchor(42)).toBe('perfil-42')
})
})
Loading
Loading