diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index 901e6916..6daebbb0 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -4,8 +4,9 @@ # Fails on regressions against baselines/ and on new divergences. # How it all fits together, for people: site/content/docs/contributing/pipeline.mdx. # -# Publishing: the site goes to GitHub Pages from main when vars.PUBLISH_SITE == 'true'. -# vars.SITE_URL is its public URL, path included (default: https://.github.io/); +# Publishing: the site goes to Cloudflare Pages (project brazilian-utils-docs) from main when +# vars.PUBLISH_SITE == 'true', with the secrets CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID. +# vars.SITE_URL is its public URL, path included (default: https://brazilian-utils.com.br); # the issues link to it and the README badges point at it. name: Conformance @@ -55,7 +56,7 @@ jobs: - name: Site URL env: CONFIGURED: ${{ vars.SITE_URL }} - run: echo "SITE_URL=${CONFIGURED:-https://${GITHUB_REPOSITORY_OWNER}.github.io/${GITHUB_REPOSITORY#*/}}" >> "$GITHUB_ENV" + run: echo "SITE_URL=${CONFIGURED:-https://brazilian-utils.com.br}" >> "$GITHUB_ENV" - uses: actions/checkout@v4 with: fetch-depth: 0 # the PR step compares the contract with the base branch @@ -187,10 +188,11 @@ jobs: echo "ok=true" >> "$GITHUB_OUTPUT" env: PUBLISH_SITE: ${{ vars.PUBLISH_SITE }} - - uses: actions/upload-pages-artifact@v3 + - uses: actions/upload-artifact@v4 id: pages if: ${{ !cancelled() && steps.complete.outputs.ok == 'true' }} with: + name: site path: site/out/ - id: site if: ${{ !cancelled() && steps.pages.outcome == 'success' }} @@ -216,7 +218,7 @@ jobs: if: env.HAS_LIBS_TOKEN == 'true' env: CONFIGURED: ${{ vars.SITE_URL }} - run: echo "SITE_URL=${CONFIGURED:-https://${GITHUB_REPOSITORY_OWNER}.github.io/${GITHUB_REPOSITORY#*/}}" >> "$GITHUB_ENV" + run: echo "SITE_URL=${CONFIGURED:-https://brazilian-utils.com.br}" >> "$GITHUB_ENV" - uses: actions/checkout@v4 if: env.HAS_LIBS_TOKEN == 'true' with: @@ -307,14 +309,24 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 concurrency: - group: github-pages + group: cloudflare-pages cancel-in-progress: false permissions: - pages: write - id-token: write + contents: read environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + name: production + url: ${{ vars.SITE_URL || 'https://brazilian-utils.com.br' }} steps: - - id: deployment - uses: actions/deploy-pages@v4 + - uses: actions/download-artifact@v4 + with: + name: site + path: out/ + # The production branch of the Cloudflare Pages project is main: this deploy is the site. + - name: Deploy to Cloudflare Pages + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + # The first deploy creates the project; "already exists" afterwards is expected. + run: | + npx --yes wrangler@4.149.0 pages project create brazilian-utils-docs --production-branch main > /dev/null 2>&1 || true + npx --yes wrangler@4.149.0 pages deploy out --project-name brazilian-utils-docs --branch main --commit-hash "$GITHUB_SHA" --commit-dirty=true diff --git a/.github/workflows/site-check.yml b/.github/workflows/site-check.yml index bbd22204..1e4e5f29 100644 --- a/.github/workflows/site-check.yml +++ b/.github/workflows/site-check.yml @@ -1,7 +1,8 @@ # Pull request checks for the docs site: production dependencies audited, both languages present, lint and # types, the site builds (usage and guides cloned from the libraries, the status of the last -# published run), then accessibility and design checks. The full pipeline (conformance.yml) -# builds and publishes it with the results of its own run. +# published run) and goes to a Cloudflare Pages preview linked on the PR, then accessibility and +# design checks. The full pipeline (conformance.yml) builds and publishes it with the results of +# its own run. name: site / check on: @@ -14,6 +15,7 @@ on: permissions: contents: read + pull-requests: write # the preview link comment concurrency: group: site-check-${{ github.ref }} @@ -51,6 +53,36 @@ jobs: run: npm run build env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SITE_PREVIEW: 'true' # served at the root of the preview's own domain, noindex + # The preview: a Cloudflare Pages deployment on the branch pr-, at + # https://pr-..pages.dev, linked in one PR comment that each push updates. Pull requests from forks have no secrets and get no preview. wrangler runs outside + # site/, so the PR's own node_modules cannot stand in for it. + - name: Preview on Cloudflare Pages + if: github.event.pull_request.head.repo.full_name == github.repository + working-directory: ${{ runner.temp }} + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + GH_TOKEN: ${{ github.token }} + PR: ${{ github.event.pull_request.number }} + SHA: ${{ github.event.pull_request.head.sha }} + run: | + set -o pipefail + # The first deploy creates the project; "already exists" afterwards is expected. + npx --yes wrangler@4.149.0 pages project create brazilian-utils-docs --production-branch main > /dev/null 2>&1 || true + npx --yes wrangler@4.149.0 pages deploy "$GITHUB_WORKSPACE/site/out" --project-name brazilian-utils-docs --branch "pr-$PR" --commit-hash "$SHA" --commit-dirty=true | tee deploy.log + # The last pages.dev address wrangler prints is the branch alias, which stays the same for the PR. + url=$(grep -o 'https://[^ ]*\.pages\.dev' deploy.log | tail -1) + [ -n "$url" ] || { echo "::error::the deploy printed no pages.dev address"; exit 1; } + marker='' + body="$marker + **Preview:** $url (\`${SHA:0:7}\`)" + id=$(gh api "repos/$GITHUB_REPOSITORY/issues/$PR/comments" --paginate --jq ".[] | select(.body | startswith(\"$marker\")) | .id" | head -1) + if [ -n "$id" ]; then + gh api -X PATCH "repos/$GITHUB_REPOSITORY/issues/comments/$id" -f body="$body" > /dev/null + else + gh api "repos/$GITHUB_REPOSITORY/issues/$PR/comments" -f body="$body" > /dev/null + fi # After the build: it writes next-env.d.ts and the route types the check reads. - name: Types run: npm run typecheck diff --git a/README.md b/README.md index e5beb061..8928adf9 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ The pipeline publishes the docs site (`vars.PUBLISH_SITE`), with a status page p Add this badge to the README of each library: ```markdown -[![API contract](https://brazilian-utils.github.io/docs/badges/python.svg)](https://brazilian-utils.github.io/docs/libs/python/) +[![API contract](https://brazilian-utils.com.br/badges/python.svg)](https://brazilian-utils.com.br/libs/python/) ``` Each library keeps the usage examples for the site (`docs/usage/.md`, one @@ -206,7 +206,6 @@ test/ unit + integration tests, fixtures per language action.yml GitHub Action for the libs' CI templates/ workflows and test harnesses to copy into each lib repo site/ the docs site (Next.js + Fumadocs), built from all of the above -vercel.json review deployments of the site on Vercel ``` ## Development diff --git a/docs/roadmap.md b/docs/roadmap.md index 2771dbb1..01c9d2ab 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -11,7 +11,7 @@ is a number, not an opinion. | Step | Who | How | |---|---|---| | Merge the PR of this repository | maintainers | CI runs typecheck, the tests with the language toolchains, contract lint | -| Publish the docs site | org admin | Enable GitHub Pages (source: GitHub Actions). Set the repository variable `PUBLISH_SITE=true` (and `SITE_URL` when a custom domain serves the site) | +| Publish the docs site | org admin | Set up Cloudflare Pages and the repository variable `PUBLISH_SITE=true`, as in [pipeline.mdx](../site/content/docs/contributing/pipeline.mdx#secrets-and-variables) | | Turn on issue and test sync | org admin | Save a fine-grained token (or GitHub App) with `issues`, `contents` and `pull_requests: write` on every library repo as the secret `LIBS_TOKEN`. Do not give it the `workflows` permission | | Optional: release notification | org admin | Save a token that can send `repository_dispatch` to the docs repository (`contents: write`) as the secret `DOCS_DISPATCH_TOKEN` in each library, and add the step in [usage-files.mdx](../site/content/docs/contributing/usage-files.mdx#update-the-site-on-each-release) to its release workflow. A release then refreshes the site at once, not at the next nightly | | Add the Action to every library | one PR per library | Copy `templates/lib-ci/.yml` to `.github/workflows/api-contract.yml`. Add the badge to the README | diff --git a/site/.env.example b/site/.env.example index 66634405..828c5454 100644 --- a/site/.env.example +++ b/site/.env.example @@ -3,7 +3,7 @@ GITHUB_TOKEN= # Optional. The public URL, path included; its path becomes the base path of every link. -# Defaults to https://brazilian-utils.github.io/docs. +# Defaults to https://brazilian-utils.com.br. SITE_URL= # Optional. Set to "fixtures" to skip GitHub entirely and build from fixtures/usage/ (offline mode). @@ -14,6 +14,5 @@ USAGE_SOURCE= SITE_DATA_URL= SITE_DATA= -# Optional. Vercel builds are noindex; true lifts the meta tag (the X-Robots-Tag header lives in -# vercel.json). -SITE_INDEXABLE= +# Optional. true builds a pull request preview: served at the root of its own domain, noindex. +SITE_PREVIEW= diff --git a/site/README.md b/site/README.md index 1efc9bd1..46de257e 100644 --- a/site/README.md +++ b/site/README.md @@ -7,7 +7,7 @@ mora no repositório docs. As páginas saem do contrato (`../contract`), das bib `DESIGN.md` explica o visual. O site é um app [Next.js](https://nextjs.org) com [Fumadocs](https://fumadocs.dev), exportado -como HTML estático (`output: 'export'`). Não há servidor: o GitHub Pages serve a pasta `out/`. +como HTML estático (`output: 'export'`). Não há servidor: o Cloudflare Pages serve a pasta `out/`. ## Rodar localmente @@ -17,7 +17,7 @@ Requer **Node 22.12 ou mais novo** e npm 10.9+. npm ci # instalação reproduzível npm run dev # busca os arquivos de uso e sobe o Next em modo dev npm run build # mesmo fluxo, saída estática em out/ -npm run preview # serve out/ como o GitHub Pages serve (base path incluído) +npm run preview # serve out/ como o Cloudflare Pages serve (base path incluído) npm run lint # ESLint (Next.js, React hooks, jsx-a11y) npm run typecheck # TypeScript npm run check:i18n @@ -167,11 +167,11 @@ Com `--strict`, o script falha no CI quando falta a versão de um idioma. ## Deploy Um pipeline só faz tudo: `.github/workflows/conformance.yml`. Ele roda o validador (check, diff, -issues), o `site-data` e o build do site. Ele publica `out/` no GitHub Pages quando -`vars.PUBLISH_SITE == 'true'`. Ele roda a cada merge em `main` (contrato, libs, site), uma vez +issues), o `site-data` e o build do site. Ele publica `out/` no Cloudflare Pages (projeto +`brazilian-utils-docs`, branch de produção `main`) quando `vars.PUBLISH_SITE == 'true'`. Ele roda a cada merge em `main` (contrato, libs, site), uma vez por dia, e quando uma biblioteca manda `repository_dispatch` com `event_type=lib-released` na release. `SITE_URL` é a URL pública com o caminho (padrão -`https://.github.io/docs`); o caminho vira o `basePath` do Next. `site-check.yml` +`https://brazilian-utils.com.br`); o caminho vira o `basePath` do Next. `site-check.yml` roda em todo PR que toca `contract/`, `libs/` ou `site/`: `npm audit` (produção), `check:i18n --strict`, `lint` sem avisos, `typecheck`, o build (com os arquivos de uso e os guias das bibliotecas), a verificação de acessibilidade (`npm run a11y`) e a de design (`npm run design`). @@ -185,23 +185,26 @@ ferramenta ou uma convenção fixa: `README.md`, `DESIGN.md`, `LICENSE`, `CONTRI `Cargo.toml`, os arquivos que começam com `_` (ignorados pelo validador) e as fixtures escritas na convenção de cada linguagem. -## Deploy de revisão (Vercel) - -Cada push e cada PR que mexe no site, no contrato, nas libs ou no schema ganha um deploy de -revisão na Vercel, com o link no PR. A configuração é o `vercel.json` na raiz do repositório (o -projeto da Vercel usa a raiz como Root Directory): instala e monta `site/` e publica `site/out/`. - -Na Vercel o site fica na raiz do domínio (sem `basePath`). Nenhum deploy da Vercel entra em -buscador, em três camadas: o header `X-Robots-Tag: noindex, nofollow, noarchive` em toda resposta -(`vercel.json`), a meta `robots` `noindex, nofollow` em toda página e um `robots.txt` sem sitemap -(ele deixa o robô entrar, porque só assim ele lê o `noindex`). As URLs canônicas apontam para -`SITE_URL`. Para o dia em que a Vercel servir o site oficial: `SITE_INDEXABLE=true` tira a meta, e -o header sai do `vercel.json`. A Vercel não roda -o validador (precisaria de todas as linguagens), então o build baixa a situação da última execução -publicada. O `ignoreCommand` pula o build quando nada que o site usa mudou desde o último deploy. Não -precisa de variável de ambiente. As opcionais são `SITE_URL`, `SITE_DATA_URL` e `GITHUB_TOKEN` -(sem token, a versão de cada lib sai da tag mais nova, lida com `git ls-remote`). `SITE_DATA=skip` -monta sem a situação. O check de PR (`site-check.yml`) também baixa a situação publicada. +## Deploy de revisão (Cloudflare Pages) + +Cada push num PR que mexe no site, no contrato ou nas libs ganha um deploy de revisão no +Cloudflare Pages, no branch `pr-`, com o link num comentário do PR. Quem publica é o +`site-check.yml`, depois do build, com os segredos `CLOUDFLARE_API_TOKEN` e +`CLOUDFLARE_ACCOUNT_ID`. PRs de fork não têm segredos e não ganham deploy de revisão. + +O build de revisão roda com `SITE_PREVIEW=true`: o site fica na raiz do domínio (sem `basePath`) +e nenhum deploy de revisão entra em buscador, em três camadas: a Cloudflare põe +`X-Robots-Tag: noindex` em toda resposta de um deploy de revisão, toda página leva a meta +`robots` `noindex, nofollow` e o `robots.txt` sai sem sitemap (ele deixa o robô entrar, porque só +assim ele lê o `noindex`). As URLs canônicas apontam para `SITE_URL`. O check não roda o validador +(precisaria de todas as linguagens), então o build baixa a situação da última execução +publicada. As variáveis opcionais são `SITE_URL`, `SITE_DATA_URL` e `GITHUB_TOKEN` (sem token, a +versão de cada lib sai da tag mais nova, lida com `git ls-remote`). `SITE_DATA=skip` monta sem a +situação. + +`public/_headers` define os headers de toda resposta, e `public/_redirects` leva as páginas do +antigo site da biblioteca JavaScript, que ficava em `brazilian-utils.com.br`, para onde elas estão +agora. ## Pendências conhecidas diff --git a/site/content/docs/about/privacy.mdx b/site/content/docs/about/privacy.mdx index 880d9e76..9cc60672 100644 --- a/site/content/docs/about/privacy.mdx +++ b/site/content/docs/about/privacy.mdx @@ -7,7 +7,7 @@ This site has no accounts, no cookies, no analytics and no ads. It is a set of s ## Where the site is hosted -The site is served by [GitHub Pages](https://pages.github.com/). Like any web server, GitHub receives your IP address and your browser's details when you open a page. The [GitHub Privacy Statement](https://docs.github.com/site-policy/privacy-policies/github-general-privacy-statement) covers what GitHub does with them. Preview copies of the site, made for pull requests, are served by [Vercel](https://vercel.com/legal/privacy-policy) and are hidden from search engines. +The site is served by [Cloudflare Pages](https://pages.cloudflare.com/). Like any web server, Cloudflare receives your IP address and your browser's details when you open a page. The [Cloudflare Privacy Policy](https://www.cloudflare.com/privacypolicy/) covers what Cloudflare does with them. Preview copies of the site, made for pull requests, are served the same way and are hidden from search engines. ## What stays in your browser diff --git a/site/content/docs/about/privacy.pt-br.mdx b/site/content/docs/about/privacy.pt-br.mdx index 233580cc..8a94774f 100644 --- a/site/content/docs/about/privacy.pt-br.mdx +++ b/site/content/docs/about/privacy.pt-br.mdx @@ -7,7 +7,7 @@ Este site não tem contas, cookies, analytics nem anúncios. Ele é um conjunto ## Onde o site fica hospedado -O site é servido pelo [GitHub Pages](https://pages.github.com/). Como qualquer servidor web, o GitHub recebe o seu endereço IP e os dados do seu navegador quando você abre uma página. A [Declaração de Privacidade do GitHub](https://docs.github.com/site-policy/privacy-policies/github-general-privacy-statement) diz o que o GitHub faz com eles. As cópias de prévia do site, feitas para os pull requests, são servidas pela [Vercel](https://vercel.com/legal/privacy-policy) e ficam fora dos buscadores. +O site é servido pelo [Cloudflare Pages](https://pages.cloudflare.com/). Como qualquer servidor web, a Cloudflare recebe o seu endereço IP e os dados do seu navegador quando você abre uma página. A [Política de Privacidade da Cloudflare](https://www.cloudflare.com/privacypolicy/) diz o que a Cloudflare faz com eles. As cópias de prévia do site, feitas para os pull requests, são servidas do mesmo jeito e ficam fora dos buscadores. ## O que fica no seu navegador diff --git a/site/content/docs/contributing/pipeline.mdx b/site/content/docs/contributing/pipeline.mdx index 07adb013..acde1bba 100644 --- a/site/content/docs/contributing/pipeline.mdx +++ b/site/content/docs/contributing/pipeline.mdx @@ -11,7 +11,7 @@ The [Brazilian Utils](https://github.com/brazilian-utils) libraries follow one c | site / check | `.github/workflows/site-check.yml` | checks this site on pull requests | | Conformance | `.github/workflows/conformance.yml` | checks every library against the contract, keeps the issues and the suite PRs in the library repositories, and builds and publishes this site | -Vercel also builds a preview copy of the site. It is described below. +Each pull request that changes the site also gets a preview copy of it. It is described below. ## What runs on a pull request @@ -42,7 +42,7 @@ A merge to main starts the Conformance workflow when it changes the same paths a 2. **lib-repos** runs only when `LIBS_TOKEN` is set. It starts from a clean checkout and runs no library code. It opens an `Implement ` issue in every library that lacks a function the merge added. It opens a `Fix ` issue in every library that fails a case the merge added or changed. It refreshes every open `api-contract` issue and closes the ones that are done. Last, it pushes each suite patch to an `api-contract/cases` branch in the library and opens a PR, if none is open. -3. **publish** deploys the site to GitHub Pages. It runs only when the site is complete and `PUBLISH_SITE` is `true`. +3. **publish** deploys the site to Cloudflare Pages. It runs only when the site is complete and `PUBLISH_SITE` is `true`. @@ -93,33 +93,37 @@ The harness of the library runs the cases in `api-contract/` in the library's ow ## Preview deployments -Vercel builds a copy of the site for each push that changes `site/`, `contract/`, `libs/`, `schema/` or `vercel.json`. The link shows up on the pull request. A preview is served at the root of its own domain. Vercel does not run the validator, so the preview takes the status of each library from the published site. +The site / check workflow deploys a copy of the site for each push to a pull request that changes `site/`, `contract/` or `libs/`. The copy goes to Cloudflare Pages, on the branch `pr-`, and one comment on the pull request links to it. Each push updates the copy and the comment. A preview is served at the root of its own domain. The check does not run the validator, so the preview takes the status of each library from the published site. Pull requests from forks get no preview, because their runs have no secrets. Search engines do not index any preview: -- every response has the header `X-Robots-Tag: noindex, nofollow, noarchive` +- Cloudflare adds the header `X-Robots-Tag: noindex` to every preview response - every page has a `robots` meta tag with `noindex` - `robots.txt` lists no sitemap - canonical links point at `SITE_URL` -The official site is the one on GitHub Pages. It is the only one that search engines index. +The official site is the one at `SITE_URL`. It is the only one that search engines index. ## Publishing -The publish job deploys to GitHub Pages. It has its own concurrency group, `github-pages`. One deploy runs at a time. A run that finishes late does not put an older site over a newer one. +The publish job deploys to the production branch, `main`, of the Cloudflare Pages project `brazilian-utils-docs`. It has its own concurrency group, `cloudflare-pages`. One deploy runs at a time. A run that finishes late does not put an older site over a newer one. -`SITE_URL` is the public address of the site, with its path. Its path becomes the base path of the site. The issues link to it, and so do the badges in the library READMEs. Without the variable, the workflow uses `https://.github.io/`, from the name of the repository. +`SITE_URL` is the public address of the site, with its path. Its path becomes the base path of the site. The issues link to it, and so do the badges in the library READMEs. Without the variable, the workflow uses `https://brazilian-utils.com.br`. + +`site/public/_headers` sets the response headers, and `site/public/_redirects` sends the pages of the old JavaScript library site to where they are now. ## Secrets and variables | Name | Kind | Where | What it does | | --- | --- | --- | --- | | `LIBS_TOKEN` | secret | docs | A fine-grained token or a GitHub App, with write access to Issues, Contents and Pull requests on the library repositories. Never give it the Workflows permission. It turns on the issues and the suite PRs. | -| `PUBLISH_SITE` | variable | docs | `true` turns on the deploys to GitHub Pages from main. The Pages source must be GitHub Actions. | -| `SITE_URL` | variable | docs | The public address of the site, with its path. Set it for a custom domain. | +| `PUBLISH_SITE` | variable | docs | `true` turns on the deploys to Cloudflare Pages from main. | +| `CLOUDFLARE_API_TOKEN` | secret | docs | A Cloudflare API token with the Cloudflare Pages: Edit permission. The publish job and the previews deploy with it. | +| `CLOUDFLARE_ACCOUNT_ID` | secret | docs | The ID of the Cloudflare account that owns the Pages project. | +| `SITE_URL` | variable | docs | The public address of the site, with its path. Set it when the site moves. | | `DOCS_DISPATCH_TOKEN` | secret | each library | A token that can send `repository_dispatch` to the docs repository (Contents: write). Without it, a release reaches the site at the next nightly run. | -Vercel needs no variable. These are optional there: +A build outside the pipeline needs no variable. These are optional: | Name | What it does | | --- | --- | @@ -127,7 +131,7 @@ Vercel needs no variable. These are optional there: | `SITE_DATA_URL` | where the build reads the status from (default: `SITE_URL`) | | `GITHUB_TOKEN` | raises the GitHub API limit when the build reads the libraries | | `SITE_DATA=skip` | builds without the status | -| `SITE_INDEXABLE=true` | removes the `noindex` meta tag, for the day Vercel serves the official site. The header in `vercel.json` must go too. | +| `SITE_PREVIEW=true` | builds a preview: served at the root of its own domain, with the `noindex` meta tag | ## What can go wrong diff --git a/site/content/docs/contributing/pipeline.pt-br.mdx b/site/content/docs/contributing/pipeline.pt-br.mdx index ed8514d0..c36f891c 100644 --- a/site/content/docs/contributing/pipeline.pt-br.mdx +++ b/site/content/docs/contributing/pipeline.pt-br.mdx @@ -11,7 +11,7 @@ As bibliotecas do [Brazilian Utils](https://github.com/brazilian-utils) seguem u | site / check | `.github/workflows/site-check.yml` | verifica este site nos pull requests | | Conformance | `.github/workflows/conformance.yml` | verifica cada biblioteca contra o contrato, cuida das issues e dos PRs da suíte nos repositórios das bibliotecas, e monta e publica este site | -A Vercel também monta uma cópia de revisão do site. Ela está descrita mais abaixo. +Cada pull request que muda o site também ganha uma cópia de revisão dele. Ela está descrita mais abaixo. ## O que roda num pull request @@ -42,7 +42,7 @@ Um merge em main inicia o workflow Conformance quando muda os mesmos caminhos ac 2. O **lib-repos** só roda quando o `LIBS_TOKEN` existe. Ele começa de um checkout limpo e não roda código de biblioteca. Ele abre uma issue `Implement ` em cada biblioteca que não tem uma função que o merge adicionou. Ele abre uma issue `Fix ` em cada biblioteca que falha num caso que o merge adicionou ou mudou. Ele atualiza cada issue `api-contract` aberta e fecha as que estão resolvidas. Por último, envia cada patch da suíte para um branch `api-contract/cases` na biblioteca e abre um PR, se nenhum estiver aberto. -3. O **publish** publica o site no GitHub Pages. Ele só roda quando o site está completo e `PUBLISH_SITE` é `true`. +3. O **publish** publica o site no Cloudflare Pages. Ele só roda quando o site está completo e `PUBLISH_SITE` é `true`. @@ -93,33 +93,37 @@ O harness da biblioteca roda os casos de `api-contract/` no próprio comando de ## Deploys de revisão -A Vercel monta uma cópia do site para cada push que muda `site/`, `contract/`, `libs/`, `schema/` ou `vercel.json`. O link aparece no pull request. Uma cópia de revisão fica na raiz do próprio domínio. A Vercel não roda o validador, então a cópia pega a situação de cada biblioteca do site publicado. +O workflow site / check publica uma cópia do site para cada push num pull request que muda `site/`, `contract/` ou `libs/`. A cópia vai para o Cloudflare Pages, no branch `pr-`, e um comentário no pull request aponta para ela. Cada push atualiza a cópia e o comentário. Uma cópia de revisão fica na raiz do próprio domínio. O check não roda o validador, então a cópia pega a situação de cada biblioteca do site publicado. Pull requests de forks não ganham cópia, porque as execuções deles não têm segredos. Nenhum buscador indexa uma cópia de revisão: -- toda resposta tem o header `X-Robots-Tag: noindex, nofollow, noarchive` +- a Cloudflare põe o header `X-Robots-Tag: noindex` em toda resposta de uma cópia de revisão - toda página tem uma meta tag `robots` com `noindex` - o `robots.txt` não lista sitemap - os links canônicos apontam para `SITE_URL` -O site oficial é o do GitHub Pages. É o único que os buscadores indexam. +O site oficial é o de `SITE_URL`. É o único que os buscadores indexam. ## Publicação -O job publish publica no GitHub Pages. Ele tem o próprio grupo de concorrência, `github-pages`. Roda um deploy de cada vez. Uma execução que termina tarde não coloca um site mais antigo por cima de um mais novo. +O job publish publica no branch de produção, `main`, do projeto `brazilian-utils-docs` do Cloudflare Pages. Ele tem o próprio grupo de concorrência, `cloudflare-pages`. Roda um deploy de cada vez. Uma execução que termina tarde não coloca um site mais antigo por cima de um mais novo. -`SITE_URL` é o endereço público do site, com o caminho. O caminho vira o base path do site. As issues apontam para ele, e os badges nos READMEs das bibliotecas também. Sem a variável, o workflow usa `https://.github.io/`, a partir do nome do repositório. +`SITE_URL` é o endereço público do site, com o caminho. O caminho vira o base path do site. As issues apontam para ele, e os badges nos READMEs das bibliotecas também. Sem a variável, o workflow usa `https://brazilian-utils.com.br`. + +O `site/public/_headers` define os headers das respostas, e o `site/public/_redirects` leva as páginas do antigo site da biblioteca JavaScript para onde elas estão agora. ## Segredos e variáveis | Nome | Tipo | Onde | O que faz | | --- | --- | --- | --- | | `LIBS_TOKEN` | segredo | docs | Um token fine-grained ou um GitHub App, com escrita em Issues, Contents e Pull requests nos repositórios das bibliotecas. Nunca dê a ele a permissão Workflows. Ele liga as issues e os PRs da suíte. | -| `PUBLISH_SITE` | variável | docs | `true` liga os deploys no GitHub Pages a partir de main. A fonte do Pages precisa ser GitHub Actions. | -| `SITE_URL` | variável | docs | O endereço público do site, com o caminho. Defina para um domínio próprio. | +| `PUBLISH_SITE` | variável | docs | `true` liga os deploys no Cloudflare Pages a partir de main. | +| `CLOUDFLARE_API_TOKEN` | segredo | docs | Um token da API da Cloudflare com a permissão Cloudflare Pages: Edit. O job publish e as cópias de revisão publicam com ele. | +| `CLOUDFLARE_ACCOUNT_ID` | segredo | docs | O ID da conta da Cloudflare dona do projeto do Pages. | +| `SITE_URL` | variável | docs | O endereço público do site, com o caminho. Defina quando o site mudar de endereço. | | `DOCS_DISPATCH_TOKEN` | segredo | cada biblioteca | Um token que pode enviar `repository_dispatch` para o repositório docs (Contents: write). Sem ele, uma release chega ao site na próxima execução noturna. | -A Vercel não precisa de variável. Estas são opcionais lá: +Um build fora do pipeline não precisa de variável. Estas são opcionais: | Nome | O que faz | | --- | --- | @@ -127,7 +131,7 @@ A Vercel não precisa de variável. Estas são opcionais lá: | `SITE_DATA_URL` | de onde o build lê a situação (padrão: `SITE_URL`) | | `GITHUB_TOKEN` | aumenta o limite da API do GitHub quando o build lê as bibliotecas | | `SITE_DATA=skip` | monta sem a situação | -| `SITE_INDEXABLE=true` | tira a meta tag `noindex`, para o dia em que a Vercel servir o site oficial. O header no `vercel.json` também precisa sair. | +| `SITE_PREVIEW=true` | monta uma cópia de revisão: na raiz do próprio domínio, com a meta tag `noindex` | ## O que pode dar errado diff --git a/site/content/docs/contributing/usage-files.mdx b/site/content/docs/contributing/usage-files.mdx index 76fcbc0b..eb96eab4 100644 --- a/site/content/docs/contributing/usage-files.mdx +++ b/site/content/docs/contributing/usage-files.mdx @@ -83,6 +83,8 @@ Some tasks need more than one call: a form field that masks and validates while } ``` +A guide's front matter gives its `title` and its `description`. The guides of a library come in file name order. A guide with `order: 1` in the front matter goes after the others, and one with `order: -1` goes before them. + In a guide, mark each example with these tags. Put each tag on its own line. docsify renders the same markup, so a library can use the same files for its own site. ````markdown diff --git a/site/content/docs/contributing/usage-files.pt-br.mdx b/site/content/docs/contributing/usage-files.pt-br.mdx index 7273addb..aab5b1b0 100644 --- a/site/content/docs/contributing/usage-files.pt-br.mdx +++ b/site/content/docs/contributing/usage-files.pt-br.mdx @@ -83,6 +83,8 @@ Algumas tarefas precisam de mais de uma chamada: um campo que aplica máscara e } ``` +O front matter de um guia dá o `title` e a `description` dele. Os guias de uma biblioteca seguem a ordem dos nomes de arquivo. Um guia com `order: 1` no front matter vai depois dos outros, e um com `order: -1` vai antes deles. + Num guia, marque cada exemplo com estas tags. Coloque cada tag numa linha própria. O docsify também entende essa marcação, então uma biblioteca pode usar os mesmos arquivos no próprio site. ````markdown diff --git a/site/next.config.mjs b/site/next.config.mjs index 08d73f2d..cc92f4de 100644 --- a/site/next.config.mjs +++ b/site/next.config.mjs @@ -1,10 +1,10 @@ import path from 'node:path'; import { createMDX } from 'fumadocs-mdx/next'; -// SITE_URL is the public (canonical) URL, path included; its path becomes the base path. Vercel -// serves every deployment at the root of its own domain, so there the base path is empty; the -// canonical links still point at SITE_URL. -const base = process.env.VERCEL ? '' : new URL(process.env.SITE_URL || 'https://brazilian-utils.github.io/docs').pathname.replace(/\/$/, ''); +// SITE_URL is the public (canonical) URL, path included; its path becomes the base path. A +// preview (SITE_PREVIEW=true) is served at the root of its own domain, so there the base path is +// empty; the canonical links still point at SITE_URL. +const base = process.env.SITE_PREVIEW === 'true' ? '' : new URL(process.env.SITE_URL || 'https://brazilian-utils.com.br').pathname.replace(/\/$/, ''); /** @type {import('next').NextConfig} */ const config = { diff --git a/site/package-lock.json b/site/package-lock.json index 9a03b725..1cfc3918 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -17,7 +17,7 @@ "hast-util-to-html": "9.0.5", "hast-util-to-jsx-runtime": "2.3.6", "lucide-react": "1.47.0", - "next": "16.3.6", + "next": "16.4.0", "react": "19.3.0", "react-dom": "19.3.0", "remark-gfm": "4.0.1", @@ -34,7 +34,7 @@ "@types/react": "19.3.0", "@types/react-dom": "19.3.0", "eslint": "9.39.5", - "eslint-config-next": "16.3.6", + "eslint-config-next": "16.4.0", "impeccable": "4.1.0", "postcss": "8.5.28", "tailwindcss": "4.3.3", @@ -1755,15 +1755,15 @@ } }, "node_modules/@next/env": { - "version": "16.3.6", - "resolved": "https://registry.npmjs.org/@next/env/-/env-16.3.6.tgz", - "integrity": "sha512-x9Vblze1EbtltQYnNH38xCPWU3TVfBd1eXqA3+w9+BTpedkkdNpAaltXlGQ/nsc1+E0mVTNrtcbX3GoO09zeLQ==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/@next/env/-/env-16.4.0.tgz", + "integrity": "sha512-pyLlT5oafGlX8X7xjgGNXz5dNIDSxREm+qD6i9VLSZiZFopA/XWl8NM/KPmLx/8EG/++c49iid3gNWSQW1+2dQ==", "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { - "version": "16.3.6", - "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-16.3.6.tgz", - "integrity": "sha512-jowwDX+7DOlDIjJLgTMxudw+k37QnWu1JkZLkSi9MaJBfDYcfhAPMKBhXL0idYzFN/AGg//axnOR4cLkHX/Rng==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-16.4.0.tgz", + "integrity": "sha512-ffeflB/dL8RrvWejQximw01pOpKHN692Y3FjDB82DCd0YVvXvBD6vY7mcZp27yvSVFVM6wA73xVodEKF4spizA==", "dev": true, "license": "MIT", "dependencies": { @@ -1804,9 +1804,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "16.3.6", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.3.6.tgz", - "integrity": "sha512-E/7GEqaUkt8mk/T8v9lAnrhzR06kdq1ZBkC12F8tAMkdIadwNp3H1KqHynDHrpcTlGCUdq/qu6vUL2aYVyYBdw==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.4.0.tgz", + "integrity": "sha512-yyZ+9MgViAKLLb5l1gPBGjRwnq3teNLb5Zx6JEw8LzNSTjlsnp+baUHFxTgl7PpjCmKf48VQfyipG1eBflb48Q==", "cpu": [ "arm64" ], @@ -1820,9 +1820,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "16.3.6", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.3.6.tgz", - "integrity": "sha512-yBE893/nDWTlaiBD1p+qgt7NUen4U5R6FXyH0s67Npq1S3E0cVSef1WIXC2xBRgQvwAvJq6DnS6Y6PrY0cy4Ew==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.4.0.tgz", + "integrity": "sha512-RePEEejEj1Auf5s9qEcG0JbcDP3ceNUS/ofNX8AhxzgIjTVlZIHMatlp16YplcSMpsVo/ZMQHJTjbMYJznjGUg==", "cpu": [ "x64" ], @@ -1836,12 +1836,15 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "16.3.6", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.3.6.tgz", - "integrity": "sha512-KJDpjBqBPYlvkivmyrp+Qys6k/7ksbqGQvRVc6ZEGfR+cjQxx+nUkJaWmNZJsmoOrqYNbaXByF8wa0lBwDhB3Q==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.4.0.tgz", + "integrity": "sha512-HhsyCqd+NpmvDDVY/LqkAN24f+QVvXh3ie+PfcwKinWL2Mu826JymQxJXGjAIfmJ4VlHjp4Pe/nZtXtUoEMAqw==", "cpu": [ "arm64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1852,12 +1855,15 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "16.3.6", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.3.6.tgz", - "integrity": "sha512-mqNg2K+hvWskSRb/QM+Ix412DvBsuSF0XV+frTSw5vmoucNnIlynFwKYew8D01bfATErMOM7Bujrf0BA5DRKFA==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.4.0.tgz", + "integrity": "sha512-sN9Pf+Zh+RpZAOmbR7d8KAA8T61CVhawtbEJ2Bk6QrRzx6Z/6haaF4UiwBzytM96GRRRWZh9/WALIEO3npMamA==", "cpu": [ "arm64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1868,12 +1874,15 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "16.3.6", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.3.6.tgz", - "integrity": "sha512-nFncBNGAYouRHjRVaITs9beZRfhX4ssVwpnvPIAbkZVH6LtGoAVlH4bJ8Cnf9SOo9bsXgPFer/GdHtEE3JNOkw==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.4.0.tgz", + "integrity": "sha512-D5M5xLWQVd1CvR+L7BickM1weRfmM41x3L1NWcnKY/oyJJqr1qwaCgmu3dMAhLBOMdZwSuDCRV6DJRRpiUkbDQ==", "cpu": [ "x64" ], + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -1884,12 +1893,15 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "16.3.6", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.3.6.tgz", - "integrity": "sha512-5Mf3cHDGR/Iz0ng2Bj3zUR3p5QS9YK3Hn2QiAfavFmyF48zwThAjpFoiTKNIcOHLYS4zEk+gzyJ/9deQ2ZB8yQ==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.4.0.tgz", + "integrity": "sha512-8d5WLS6a9YalqpOgXdlbvonFu+sIgjA+CO6tGzetrpPVcUL56foa7B7664h41rAlbLi5fJwK4vWji3zf4QDy+w==", "cpu": [ "x64" ], + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -1900,9 +1912,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "16.3.6", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.3.6.tgz", - "integrity": "sha512-0jkJy0C2kbrJWTk4YLa3xk80pVBpx8FCHJym7CnUfDAXe/FWv5qT7SQJbR0KuemyxaEDlEx5WT4VQJoTW+/9Qw==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.4.0.tgz", + "integrity": "sha512-sQuOIiW3snb48UwrBcDMvFA/u03qtw2LeuSIxFIQ9AJuW9UG/4Ddsfo+eV73PnZwBhyncMtsKVh7PrzMol2/fA==", "cpu": [ "arm64" ], @@ -1916,9 +1928,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "16.3.6", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.3.6.tgz", - "integrity": "sha512-/YXjI1e5OXcZ7YpxRwgP/1jAV/SBKTzeVKqN2mk7mLpcICsyn3Gl5+dIfDTJp70M0ccMhyMMRso4v6mPDCGepg==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.4.0.tgz", + "integrity": "sha512-6/33lCuxpdHUy27RegyGM/5uTpF7YZd3UR4D0gpkOA/tWY5YR7msbQjqPgCZmSmxrrTLGCXYA4A8vT2H5DPGTQ==", "cpu": [ "x64" ], @@ -5052,21 +5064,21 @@ } }, "node_modules/eslint-config-next": { - "version": "16.3.6", - "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-16.3.6.tgz", - "integrity": "sha512-1Upt3U7BDwU+ilpe2byZjAfts9oNq4d4fv/zXEvs8/4yS+cwOQW/WCxUNy8gCDquX67SzeehDvKblVC6ZBMocQ==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-16.4.0.tgz", + "integrity": "sha512-2RHLYswzc+hNRktWAjIL6XAvwb1cKcjLawJ5KWywAxn/JivNHtG42ZigL1yobVXDqsimuuL2F9jcEcnHFzbppQ==", "dev": true, "license": "MIT", "dependencies": { - "@next/eslint-plugin-next": "16.3.6", + "@next/eslint-plugin-next": "16.4.0", "eslint-import-resolver-node": "^0.3.6", "eslint-import-resolver-typescript": "^3.5.2", "eslint-plugin-import": "^2.32.0", "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-react": "^7.37.0", - "eslint-plugin-react-hooks": "^7.0.0", + "eslint-plugin-react-hooks": "^7.1.0", "globals": "16.4.0", - "typescript-eslint": "^8.46.0" + "typescript-eslint": "^8.56.0" }, "peerDependencies": { "eslint": ">=9.0.0", @@ -8982,12 +8994,12 @@ "license": "MIT" }, "node_modules/next": { - "version": "16.3.6", - "resolved": "https://registry.npmjs.org/next/-/next-16.3.6.tgz", - "integrity": "sha512-L+otWM/aQbYTx98aZhgEoMb4bZAXx1YVW4UMA/vuCyCoWG5HJyZUili8QAkqzrcC+5///tsz3s0M+SlyB5bLMw==", + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/next/-/next-16.4.0.tgz", + "integrity": "sha512-N2C+9q89Z/oLrsepSRS4jRMtwmUZAoZuAHU0e9T6+sAB5DdhADmrnOW+zjYijlrYFmVfmQhGVGy9eMFoB7UgKg==", "license": "MIT", "dependencies": { - "@next/env": "16.3.6", + "@next/env": "16.4.0", "@swc/helpers": "0.5.23", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", @@ -9001,14 +9013,14 @@ "node": ">=20.9.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "16.3.6", - "@next/swc-darwin-x64": "16.3.6", - "@next/swc-linux-arm64-gnu": "16.3.6", - "@next/swc-linux-arm64-musl": "16.3.6", - "@next/swc-linux-x64-gnu": "16.3.6", - "@next/swc-linux-x64-musl": "16.3.6", - "@next/swc-win32-arm64-msvc": "16.3.6", - "@next/swc-win32-x64-msvc": "16.3.6", + "@next/swc-darwin-arm64": "16.4.0", + "@next/swc-darwin-x64": "16.4.0", + "@next/swc-linux-arm64-gnu": "16.4.0", + "@next/swc-linux-arm64-musl": "16.4.0", + "@next/swc-linux-x64-gnu": "16.4.0", + "@next/swc-linux-x64-musl": "16.4.0", + "@next/swc-win32-arm64-msvc": "16.4.0", + "@next/swc-win32-x64-msvc": "16.4.0", "sharp": "^0.35.4" }, "peerDependencies": { diff --git a/site/package.json b/site/package.json index 4e71e7af..cdf270a5 100644 --- a/site/package.json +++ b/site/package.json @@ -28,7 +28,7 @@ "hast-util-to-html": "9.0.5", "hast-util-to-jsx-runtime": "2.3.6", "lucide-react": "1.47.0", - "next": "16.3.6", + "next": "16.4.0", "react": "19.3.0", "react-dom": "19.3.0", "remark-gfm": "4.0.1", @@ -49,7 +49,7 @@ "@types/react": "19.3.0", "@types/react-dom": "19.3.0", "eslint": "9.39.5", - "eslint-config-next": "16.3.6", + "eslint-config-next": "16.4.0", "impeccable": "4.1.0", "postcss": "8.5.28", "tailwindcss": "4.3.3", diff --git a/site/public/_headers b/site/public/_headers new file mode 100644 index 00000000..18bec630 --- /dev/null +++ b/site/public/_headers @@ -0,0 +1,10 @@ +# Cloudflare Pages response headers, for every file of the site. Previews also get +# X-Robots-Tag: noindex from Cloudflare itself. +/* + X-Content-Type-Options: nosniff + Referrer-Policy: strict-origin-when-cross-origin + +# The same site at the project's pages.dev address stays out of search engines: only SITE_URL is +# indexed. +https://:project.pages.dev/* + X-Robots-Tag: noindex diff --git a/site/public/_redirects b/site/public/_redirects new file mode 100644 index 00000000..8ef9e82f --- /dev/null +++ b/site/public/_redirects @@ -0,0 +1,33 @@ +# Cloudflare Pages redirects: the pages of the JavaScript library site that brazilian-utils.com.br +# served before this one, to where they are now. +/utilities /libs/javascript/ 301 +/utilities/ /libs/javascript/ 301 +/guides/document-field /guides/javascript/document-field/ 301 +/guides/document-field/ /guides/javascript/document-field/ 301 +/guides/address-form /guides/javascript/address-form/ 301 +/guides/address-form/ /guides/javascript/address-form/ 301 +/guides/state-city /guides/javascript/state-city/ 301 +/guides/state-city/ /guides/javascript/state-city/ 301 +/guides/schema /guides/javascript/schema/ 301 +/guides/schema/ /guides/javascript/schema/ 301 +/migration-v1-to-v2 /guides/javascript/migration-v1-to-v2/ 301 +/migration-v1-to-v2/ /guides/javascript/migration-v1-to-v2/ 301 +/getting-started.md https://github.com/brazilian-utils/javascript/blob/main/docs/getting-started.md 301 +/utilities.md https://github.com/brazilian-utils/javascript/blob/main/docs/utilities.md 301 +/migration-v1-to-v2.md https://github.com/brazilian-utils/javascript/blob/main/docs/guides/migration-v1-to-v2.md 301 +/pt-br/utilities /pt-br/libs/javascript/ 301 +/pt-br/utilities/ /pt-br/libs/javascript/ 301 +/pt-br/guides/document-field /pt-br/guides/javascript/document-field/ 301 +/pt-br/guides/document-field/ /pt-br/guides/javascript/document-field/ 301 +/pt-br/guides/address-form /pt-br/guides/javascript/address-form/ 301 +/pt-br/guides/address-form/ /pt-br/guides/javascript/address-form/ 301 +/pt-br/guides/state-city /pt-br/guides/javascript/state-city/ 301 +/pt-br/guides/state-city/ /pt-br/guides/javascript/state-city/ 301 +/pt-br/guides/schema /pt-br/guides/javascript/schema/ 301 +/pt-br/guides/schema/ /pt-br/guides/javascript/schema/ 301 +/pt-br/migration-v1-to-v2 /pt-br/guides/javascript/migration-v1-to-v2/ 301 +/pt-br/migration-v1-to-v2/ /pt-br/guides/javascript/migration-v1-to-v2/ 301 +/pt-br/getting-started.md https://github.com/brazilian-utils/javascript/blob/main/docs/pt-br/getting-started.md 301 +/pt-br/utilities.md https://github.com/brazilian-utils/javascript/blob/main/docs/pt-br/utilities.md 301 +/pt-br/migration-v1-to-v2.md https://github.com/brazilian-utils/javascript/blob/main/docs/pt-br/guides/migration-v1-to-v2.md 301 +/llms-full.txt /llms.txt 301 diff --git a/site/scripts/a11y.mjs b/site/scripts/a11y.mjs index 1c7df8a7..22c3b781 100644 --- a/site/scripts/a11y.mjs +++ b/site/scripts/a11y.mjs @@ -24,14 +24,17 @@ const axeSource = fs.readFileSync(require.resolve('axe-core/axe.min.js'), 'utf8' const PORT = 4399; const OUT = 'out'; // The base path the site was built with (SITE_URL's path, as next.config.mjs reads it). -const BASE = (process.env.BASE_PATH ?? new URL(process.env.SITE_URL || 'https://brazilian-utils.github.io/docs').pathname).replace(/\/$/, ''); +const BASE = (process.env.BASE_PATH ?? new URL(process.env.SITE_URL || 'https://brazilian-utils.com.br').pathname).replace(/\/$/, ''); // One page of each type, in both languages; generated pages exist in every build. const PAGES = [ '/', '/getting-started/', '/utils/cpf/', '/utils/license-plate/', '/libs/javascript/', '/libs/go/', '/reference/parity/', '/contributing/usage-files/', '/about/team/', '/pt-br/about/faq/', '/pt-br/', '/pt-br/utils/cnpj/', '/pt-br/libs/python/', '/does-not-exist/', ]; -for (const guide of fs.existsSync(`${OUT}/guides`) ? fs.readdirSync(`${OUT}/guides`) : []) { - const first = fs.readdirSync(`${OUT}/guides/${guide}`).find((f) => !f.endsWith('.txt')); +// The guides page, then the first guide of each library (out/guides///; the rest are files). +const dirs = (dir) => fs.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name); +if (fs.existsSync(`${OUT}/guides`)) PAGES.push('/guides/', '/pt-br/guides/'); +for (const guide of fs.existsSync(`${OUT}/guides`) ? dirs(`${OUT}/guides`) : []) { + const first = dirs(`${OUT}/guides/${guide}`)[0]; if (first) PAGES.push(`/guides/${guide}/${first}/`, `/pt-br/guides/${guide}/${first}/`); } diff --git a/site/scripts/design-check.mjs b/site/scripts/design-check.mjs index 57e2bf39..201867b3 100644 --- a/site/scripts/design-check.mjs +++ b/site/scripts/design-check.mjs @@ -13,13 +13,16 @@ import path from 'node:path'; import fs from 'node:fs'; const PORT = 4398; -const BASE = new URL(process.env.SITE_URL || 'https://brazilian-utils.github.io/docs').pathname.replace(/\/$/, ''); +const BASE = new URL(process.env.SITE_URL || 'https://brazilian-utils.com.br').pathname.replace(/\/$/, ''); const PAGES = [ '/', '/pt-br/', '/getting-started/', '/utils/cpf/', '/utils/license-plate/', '/pt-br/utils/cnpj/', '/libs/javascript/', '/libs/go/', '/reference/parity/', '/contributing/specs/', '/contributing/usage-files/', '/about/faq/', '/about/team/', '/does-not-exist/', ]; -for (const guide of fs.existsSync('out/guides') ? fs.readdirSync('out/guides') : []) { - for (const slug of fs.readdirSync(`out/guides/${guide}`).filter((f) => !f.includes('.'))) PAGES.push(`/guides/${guide}/${slug}/`); +// The guides page, then every guide (out/guides///; the rest are files). +const dirs = (dir) => fs.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name); +if (fs.existsSync('out/guides')) PAGES.push('/guides/'); +for (const guide of fs.existsSync('out/guides') ? dirs('out/guides') : []) { + for (const slug of dirs(`out/guides/${guide}`)) PAGES.push(`/guides/${guide}/${slug}/`); } const VIEWPORTS = ['1280x800', '390x844']; diff --git a/site/scripts/fetch-libs.mjs b/site/scripts/fetch-libs.mjs index 6b492b18..eba4ddd5 100644 --- a/site/scripts/fetch-libs.mjs +++ b/site/scripts/fetch-libs.mjs @@ -106,7 +106,7 @@ async function sourceOf(lib) { }; if (MODE === 'local') return localSource(); try { - // Without the API (rate limit, no token: Vercel builds) the newest version tag stands in for + // Without the API (rate limit, no token: a local build) the newest version tag stands in for // the latest release, and without tags the clone takes the default branch. const ref = await resolveRef(lib).catch((error) => { const tag = lib.ref === 'latest-release' ? newestTag(lib) : null; @@ -304,12 +304,14 @@ function readGuides(lib, src) { const guide = parseGuide({ lib, src, file: path.join(dir, name), locale, siblings: names.map((n) => n.replace(/\.md$/, '')), status, specs, warn: (w) => warnings.push(w) }); fs.mkdirSync(path.join(GUIDES_DIR, lib.id), { recursive: true }); fs.writeFileSync(path.join(GUIDES_DIR, lib.id, `${slug}.${locale}.json`), JSON.stringify(guide)); - const entry = found.get(slug) ?? { lib: lib.id, slug, order: found.size, title: {}, description: {}, fns: [], source: guide.source }; + const entry = found.get(slug) ?? { lib: lib.id, slug, order: guide.order, title: {}, description: {}, fns: [], source: guide.source }; entry.title[locale] = guide.title; entry.description[locale] = guide.description; entry.fns = [...new Set([...entry.fns, ...guide.fns])].sort(); found.set(slug, entry); } } - guides.push(...found.values()); + // By the front matter's `order` (default 0), then by file name. + const sorted = [...found.values()].sort((a, b) => a.order - b.order || a.slug.localeCompare(b.slug)); + guides.push(...sorted.map((g, i) => ({ ...g, order: i }))); } diff --git a/site/scripts/fetch-site-data.mjs b/site/scripts/fetch-site-data.mjs index 9d13b2f2..34265a06 100644 --- a/site/scripts/fetch-site-data.mjs +++ b/site/scripts/fetch-site-data.mjs @@ -1,11 +1,11 @@ /** * Runs before fetch-libs.mjs, which needs the status (reference pages, guide functions). Builds - * that did not run the validator (Vercel review deployments, a fresh clone) take the + * that did not run the validator (pull request previews, a fresh clone) take the * status of the last run from the published site: /status.json and the badges. The GitHub * Actions pipeline runs the validator and writes these files itself (`docs site-data`), * so this step does nothing there. * - * SITE_DATA_URL where to read from (default: SITE_URL, else the GitHub Pages site) + * SITE_DATA_URL where to read from (default: SITE_URL, else the published site) * SITE_DATA=skip never download (the pages show no status) * * Nothing here fails the build: without the data, the site builds without the status. @@ -16,7 +16,7 @@ import { loadLibs } from '../src/lib/registry.mjs'; const STATUS = path.join('.generated', 'status.json'); const BADGES = path.join('public', 'badges'); -const from = (process.env.SITE_DATA_URL || process.env.SITE_URL || 'https://brazilian-utils.github.io/docs').replace(/\/$/, ''); +const from = (process.env.SITE_DATA_URL || process.env.SITE_URL || 'https://brazilian-utils.com.br').replace(/\/$/, ''); if (process.env.SITE_DATA === 'skip' || process.env.USAGE_SOURCE === 'fixtures') process.exit(0); // A validator run wrote the file (no `fetchedFrom`): keep it. A copy fetched earlier is refreshed. diff --git a/site/scripts/serve.mjs b/site/scripts/serve.mjs index 1dfc32a1..c84297a3 100644 --- a/site/scripts/serve.mjs +++ b/site/scripts/serve.mjs @@ -1,6 +1,6 @@ #!/usr/bin/env node /** - * Serves the built site (out/) the way GitHub Pages does: under the base path, index.html for + * Serves the built site (out/) the way Cloudflare Pages does: under the base path, index.html for * folders, 404.html for anything else. `npm run preview`, after `npm run build`. * Env: SITE_URL (as for the build), PORT (default 4321). */ @@ -10,7 +10,7 @@ import path from 'node:path'; import zlib from 'node:zlib'; const OUT = path.resolve('out'); -const BASE = new URL(process.env.SITE_URL || 'https://brazilian-utils.github.io/docs').pathname.replace(/\/$/, ''); +const BASE = new URL(process.env.SITE_URL || 'https://brazilian-utils.com.br').pathname.replace(/\/$/, ''); const PORT = Number(process.env.PORT) || 4321; const TYPES = { '.html': 'text/html', '.js': 'text/javascript', '.css': 'text/css', '.svg': 'image/svg+xml', '.png': 'image/png', '.ico': 'image/x-icon', '.json': 'application/json', '.txt': 'text/plain', '.xml': 'application/xml', '.woff2': 'font/woff2', '.ttf': 'font/ttf' }; diff --git a/site/src/app/(en)/(docs)/guides/page.tsx b/site/src/app/(en)/(docs)/guides/page.tsx new file mode 100644 index 00000000..699dcd6d --- /dev/null +++ b/site/src/app/(en)/(docs)/guides/page.tsx @@ -0,0 +1,9 @@ +import { GuidesPage, guidesText } from '@/components/pages/guides'; +import { pageMetadata } from '@/lib/meta'; + +const { title, description } = guidesText('en'); +export const metadata = pageMetadata('en', '/guides/', title, description); + +export default function Page() { + return ; +} diff --git a/site/src/app/(pt)/pt-br/(docs)/guides/page.tsx b/site/src/app/(pt)/pt-br/(docs)/guides/page.tsx new file mode 100644 index 00000000..590bf076 --- /dev/null +++ b/site/src/app/(pt)/pt-br/(docs)/guides/page.tsx @@ -0,0 +1,9 @@ +import { GuidesPage, guidesText } from '@/components/pages/guides'; +import { pageMetadata } from '@/lib/meta'; + +const { title, description } = guidesText('pt-BR'); +export const metadata = pageMetadata('pt-BR', '/guides/', title, description); + +export default function Page() { + return ; +} diff --git a/site/src/app/global-not-found.tsx b/site/src/app/global-not-found.tsx index 43a3a307..7f76320d 100644 --- a/site/src/app/global-not-found.tsx +++ b/site/src/app/global-not-found.tsx @@ -1,4 +1,4 @@ -// 404 for every path (GitHub Pages serves 404.html): both languages, links back into the site. +// 404 for every path (Cloudflare Pages serves 404.html): both languages, links back into the site. import Link from '@/components/link'; import { Html } from '@/components/html'; import { SiteMark } from '@/lib/layout'; diff --git a/site/src/app/sitemap.ts b/site/src/app/sitemap.ts index bf331bd8..9eac3970 100644 --- a/site/src/app/sitemap.ts +++ b/site/src/app/sitemap.ts @@ -16,6 +16,7 @@ export default function sitemap(): MetadataRoute.Sitemap { ...folderPages('en', 'about').map((p) => `/about/${p.slug}/`), ...loadSpecs().map((s: any) => `/utils/${s.id}/`), ...loadLibs().map((l: any) => `/libs/${l.id}/`), + ...(loadGuides().length ? ['/guides/'] : []), ...loadGuides().map((g: any) => `/guides/${g.lib}/${g.slug}/`), ]; return paths.flatMap((path) => { diff --git a/site/src/components/pages/guides.tsx b/site/src/components/pages/guides.tsx new file mode 100644 index 00000000..7935e0c1 --- /dev/null +++ b/site/src/components/pages/guides.tsx @@ -0,0 +1,60 @@ +// Every guide, grouped by the library that publishes it, in the order of the libraries. +import Link from '@/components/link'; +import { ArrowRight } from 'lucide-react'; +import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/layouts/notebook/page'; +import { loadGuides, loadLibs } from '@/lib/data'; +import { type Locale, pick, prefixOf } from '@/lib/i18n'; +import { LangIcon } from '@/components/lang-icon'; +import { DocsPager } from '@/components/docs-pager.client'; + +const L = (locale: Locale, en: string, pt: string) => (locale === 'en' ? en : pt); +export const guidesText = (locale: Locale) => ({ + title: L(locale, 'Guides', 'Guias'), + description: L(locale, 'Forms and components built with each library, with live demos and the code for each framework.', 'Formulários e componentes feitos com cada biblioteca, com exemplos interativos e o código de cada framework.'), +}); + +/** The libraries that have guides, each with its guides. */ +export function guidesByLib() { + const guides = loadGuides(); + return loadLibs() + .map((lib: any) => ({ lib, guides: guides.filter((g: any) => g.lib === lib.id) })) + .filter((group: any) => group.guides.length); +} + +export function GuidesPage({ locale }: { locale: Locale }) { + const p = prefixOf(locale); + const { title, description } = guidesText(locale); + return ( + + {title} + {description} + + {guidesByLib().map(({ lib, guides }: any) => ( +
+

+ {lib.label} +

+ {/* Rows between rules, like the home page's lists: a guide is a link and a sentence. */} +
    + {guides.map((g: any) => ( +
  • + + + {pick(g.title, locale)} + {pick(g.description, locale)} + + + +
  • + ))} +
+
+ ))} +

+ {L(locale, 'Any library can publish guides: ', 'Qualquer biblioteca pode publicar guias: ')} + {L(locale, 'see how', 'veja como')}. +

+
+
+ ); +} diff --git a/site/src/content/team.json b/site/src/content/team.json index 7a559d38..6ec165f5 100644 --- a/site/src/content/team.json +++ b/site/src/content/team.json @@ -4,30 +4,30 @@ { "name": "Hyan Mandian", "login": "hyanmandian", - "role": { "en": "Creator", "pt-BR": "Criador" } + "role": { "en": "Project Founder", "pt-BR": "Fundador do projeto" } }, { "name": "Camila Maia", "login": "camilamaia", - "role": { "en": "Contributor", "pt-BR": "Contribuidora" }, + "role": { "en": "Python contributor", "pt-BR": "Contribuidora de Python" }, "cumbucadev": true }, { "name": "Maria Antônia Maia", "login": "antoniamaia", - "role": { "en": "Contributor", "pt-BR": "Contribuidora" }, + "role": { "en": "Python contributor", "pt-BR": "Contribuidora de Python" }, "cumbucadev": true }, { "name": "Nilton Pimentel", "login": "niltonpimentel02", - "role": { "en": "Contributor", "pt-BR": "Contribuidor" }, + "role": { "en": "Python contributor", "pt-BR": "Contribuidor de Python" }, "cumbucadev": true }, { "name": "Leonel Sanches da Silva", "login": "leonelsanchesdasilva", - "role": { "en": "Contributor", "pt-BR": "Contribuidor" }, + "role": { "en": "Rust, Ruby, Go and .NET contributor", "pt-BR": "Contribuidor de Rust, Ruby, Go e .NET" }, "cumbucadev": true } ] diff --git a/site/src/lib/git.ts b/site/src/lib/git.ts index c097ed60..c3386959 100644 --- a/site/src/lib/git.ts +++ b/site/src/lib/git.ts @@ -2,7 +2,7 @@ import { execFileSync } from 'node:child_process'; const git = (...args: string[]) => execFileSync('git', args, { cwd: '..', stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim(); -// A shallow clone (Vercel's) has lost the commits that last touched most files: `git log` would +// A shallow clone (a CI checkout's default) has lost the commits that last touched most files: `git log` would // name the oldest commit it has, a wrong date. There, no date at all. let shallow: boolean | undefined; const isShallow = () => { diff --git a/site/src/lib/guides.d.mts b/site/src/lib/guides.d.mts index 5ea74db3..ab8474a3 100644 --- a/site/src/lib/guides.d.mts +++ b/site/src/lib/guides.d.mts @@ -2,7 +2,7 @@ export interface GuideFile { kind: 'file'; name: string; lang: string; code: string } export interface GuideNode { kind: 'example' | 'variant'; name?: string; demo?: string; intro?: string; children: Array } export type GuideBlock = { type: 'markdown'; text: string } | { type: 'examples'; examples: GuideNode[] }; -export interface Guide { title: string; description: string; blocks: GuideBlock[]; fns: string[]; source: string } +export interface Guide { title: string; description: string; order: number; blocks: GuideBlock[]; fns: string[]; source: string } export interface GuideContext { lib: { id: string; repo: string; root: string; guides: Record; reference?: Record }; src: { dir: string; url: string }; diff --git a/site/src/lib/guides.mjs b/site/src/lib/guides.mjs index 24d790ee..d56ac7ec 100644 --- a/site/src/lib/guides.mjs +++ b/site/src/lib/guides.mjs @@ -93,6 +93,7 @@ export function parseGuide(ctx) { return { title: data.title ?? path.basename(file, '.md'), description: data.description ?? '', + order: typeof data.order === 'number' ? data.order : 0, blocks, fns: functionsUsed(ctx, [...code, ...blocks.filter((b) => b.type === 'markdown').map((b) => b.text)].join('\n')), source: src.url + relFile, diff --git a/site/src/lib/layout.tsx b/site/src/lib/layout.tsx index f0f93822..8dd39c14 100644 --- a/site/src/lib/layout.tsx +++ b/site/src/lib/layout.tsx @@ -48,12 +48,11 @@ const githubIcon = ( /** The sections of the documentation, in the header of every page (the sidebar's root folders). */ export function siteSections(locale: Locale): Section[] { const p = prefixOf(locale); - const guide = loadGuides()[0]; const first = (folder: string) => folderPages(locale, folder)[0]?.slug; return [ { title: L(locale, 'Utilities', 'Utilitários'), url: `${p}/getting-started/`, match: ['/getting-started', '/utils/'] }, { title: L(locale, 'Libraries', 'Bibliotecas'), url: `${p}/reference/parity/`, match: ['/reference/', '/libs/'] }, - ...(guide ? [{ title: L(locale, 'Guides', 'Guias'), url: `${p}/guides/${guide.lib}/${guide.slug}/`, match: ['/guides/'] }] : []), + ...(loadGuides().length ? [{ title: L(locale, 'Guides', 'Guias'), url: `${p}/guides/`, match: ['/guides/'] }] : []), { title: L(locale, 'Contributing', 'Como contribuir'), url: `${p}/contributing/${first('contributing')}/`, match: ['/contributing/'] }, ...(first('about') ? [{ title: L(locale, 'About', 'Sobre'), url: `${p}/about/${first('about')}/`, match: ['/about/'] }] : []), ]; diff --git a/site/src/lib/meta.ts b/site/src/lib/meta.ts index 6c8c6a67..47040e9b 100644 --- a/site/src/lib/meta.ts +++ b/site/src/lib/meta.ts @@ -4,19 +4,19 @@ import type { Metadata } from 'next'; import { loadSpec, loadSpecs } from './data'; import { type Locale, pick, prefixOf } from './i18n'; -export const SITE = new URL(process.env.SITE_URL || 'https://brazilian-utils.github.io/docs'); +export const SITE = new URL(process.env.SITE_URL || 'https://brazilian-utils.com.br'); const base = SITE.pathname.replace(/\/$/, ''); export const SITE_ROOT = `${SITE.origin}${base}`; const OG_IMAGE = `${SITE_ROOT}/og.png`; -/** Where this build is served from (Vercel serves at the domain root, GitHub Pages under a path). */ +/** Where this build is served from (a preview at the domain root, the site under SITE_URL's path). */ const servedBase = process.env.NEXT_PUBLIC_BASE ?? ''; /** - * A build that is not the canonical site: every Vercel deployment (review links). Its pages, files - * and headers all say noindex (vercel.json adds X-Robots-Tag), and canonical links point at - * SITE_URL. SITE_INDEXABLE=true lifts it, for the day Vercel serves the canonical site. + * A build that is not the canonical site: a pull request preview (SITE_PREVIEW=true). Its pages + * and files say noindex (Cloudflare Pages also adds X-Robots-Tag to every preview), and canonical + * links point at SITE_URL. */ -export const NOINDEX = Boolean(process.env.VERCEL) && process.env.SITE_INDEXABLE !== 'true'; +export const NOINDEX = process.env.SITE_PREVIEW === 'true'; /** Metadata for a page at `path` (without language prefix, starting and ending with /). */ export function pageMetadata(locale: Locale, path: string, title: string, description: string): Metadata { diff --git a/site/src/lib/search-index.ts b/site/src/lib/search-index.ts index 73d16367..3b905e75 100644 --- a/site/src/lib/search-index.ts +++ b/site/src/lib/search-index.ts @@ -5,6 +5,7 @@ import { LOCALES, type Locale, pick, prefixOf } from './i18n'; import { slug } from './prose'; import { fileLocale, source } from './source'; import { libDescription, libTitle } from '@/components/pages/lib'; +import { guidesText } from '@/components/pages/guides'; import { parityText } from '@/components/pages/parity'; const trim = (url: string) => url.replace(/\/$/, '') || '/'; @@ -33,6 +34,10 @@ export function searchIndexes() { } for (const lib of libs as any[]) out.push({ locale, title: libTitle(locale, lib.label), description: libDescription(locale, lib.label), content: `${lib.package} ${lib.install}`, url: `${p}/libs/${lib.id}` }); for (const g of loadGuides() as any[]) out.push({ locale, title: pick(g.title, locale), description: pick(g.description, locale), content: pick(g.description, locale), url: `${p}/guides/${g.lib}/${g.slug}` }); + if (loadGuides().length) { + const guides = guidesText(locale); + out.push({ locale, title: guides.title, description: guides.description, content: guides.description, url: `${p}/guides` }); + } const parity = parityText(locale); out.push({ locale, title: parity.title, description: parity.description, content: parity.description, url: `${p}/reference/parity` }); for (const page of source.getPages(fileLocale(locale))) out.push({ locale, title: page.data.title, description: page.data.description, content: page.data.description ?? '', url: trim(`${p}${page.url.replace(/^\/pt-br/, '')}`) }); diff --git a/site/src/lib/tree.tsx b/site/src/lib/tree.tsx index aae169b6..88a77c07 100644 --- a/site/src/lib/tree.tsx +++ b/site/src/lib/tree.tsx @@ -2,6 +2,7 @@ import type * as PageTree from 'fumadocs-core/page-tree'; import { BookOpen, Boxes, Compass, GitPullRequest, Info } from 'lucide-react'; import { CATEGORIES, loadGuides, loadLibs, loadSpecs } from './data'; +import { guidesByLib } from '@/components/pages/guides'; import { type Locale, pick, prefixOf } from './i18n'; import { LangIcon } from '@/components/lang-icon'; import { folderPages } from './source'; @@ -70,7 +71,18 @@ export function pageTree(locale: Locale): PageTree.Root { name: L(locale, 'Guides', 'Guias'), description: L(locale, 'Forms and components, with live demos', 'Formulários e componentes, com exemplos interativos'), icon: , - children: guides.map((g: any) => page(pick(g.title, locale), `/guides/${g.lib}/${g.slug}/`)), + // The overview, then a folder per library that has guides (JavaScript first, more as they come). + children: [ + page(L(locale, 'Overview', 'Visão geral'), '/guides/'), + ...guidesByLib().map(({ lib, guides }: any) => ({ + $id: `${locale}:guides:${lib.id}`, + type: 'folder' as const, + name: lib.label, + icon: , + defaultOpen: true, + children: guides.map((g: any) => page(pick(g.title, locale), `/guides/${g.lib}/${g.slug}/`)), + })), + ], }; const contributing: PageTree.Folder = { diff --git a/vercel.json b/vercel.json deleted file mode 100644 index 3dc35070..00000000 --- a/vercel.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "$schema": "https://openapi.vercel.sh/vercel.json", - "framework": null, - "installCommand": "npm ci --prefix site", - "buildCommand": "npm run build --prefix site", - "outputDirectory": "site/out", - "trailingSlash": true, - "ignoreCommand": "if [ -n \"$VERCEL_GIT_PREVIOUS_SHA\" ] && git cat-file -e \"$VERCEL_GIT_PREVIOUS_SHA^{commit}\" 2>/dev/null; then git diff --quiet \"$VERCEL_GIT_PREVIOUS_SHA\" HEAD -- site contract libs schema vercel.json || exit 1; else exit 1; fi", - "headers": [ - { - "source": "/(.*)", - "headers": [ - { "key": "X-Robots-Tag", "value": "noindex, nofollow, noarchive" }, - { "key": "X-Content-Type-Options", "value": "nosniff" }, - { "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" } - ] - } - ] -}