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
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: npm
directory: '/'
schedule:
interval: weekly
open-pull-requests-limit: 5
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: weekly
open-pull-requests-limit: 5
61 changes: 61 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI/CD

on:
push:
branches: [main, develop]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build

deploy:
name: Deploy to Cloudflare Workers (production)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --config wrangler.jsonc

deploy-staging:
name: Deploy to Cloudflare Workers (staging)
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy --config wrangler.staging.jsonc
16 changes: 0 additions & 16 deletions .github/workflows/notify-deploy.yml

This file was deleted.

29 changes: 17 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# Dependencies
/node_modules
node_modules/

# Production
/build
# Build output
dist/

# Generated files
.docusaurus
.cache-loader
# Astro generated types
.astro/

# Wrangler (Cloudflare)
# wrangler.jsonc (production) and wrangler.staging.jsonc (staging) ARE versioned — no secrets inside.
# .wrangler/ may contain sensitive state; a local wrangler.toml would conflict
# with the versioned wrangler.jsonc — if one exists, delete it.
.wrangler/
wrangler.toml

# Environment
.env
.env.production

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn-error.log*
64 changes: 64 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# AGENTS.md

Discorgento community site (Brazilian Magento/tech community + podcast), built with **Astro 7 + Tailwind v4**. All active development happens in this repository root.

## Language rules

- **Code, comments, filenames, commit messages and docs (this file, README, etc.) must be in English.**
- **Exception — site content stays in Portuguese**: blog posts under `src/content/posts/pt-br/*.md` and the `pt-BR` strings in `src/lib/i18n.ts` are the product itself (Brazilian community site). Never translate or "fix" them to English.
- UI copy that is hardcoded in components must be moved to `src/lib/i18n.ts` instead of being written inline.

## Commands

All commands run from the repo root.

- `npm install` — install deps
- `npm run dev:start` — start dev server in **background** (log in `.astro/dev.log`)
- `npm run dev:restart` — restart (kills current instance, starts fresh)
- `npm run dev:stop` — stop the dev server
- `npm run dev:status` — check if it's running (URL + PID)
- `npm run dev:logs` — view logs
- `npm run dev` — foreground dev server (Ctrl+C to stop)
- `npm run build` — production build to `dist/` (only meaningful verification)

No lint, typecheck, or test commands exist. `npm run build` is the only meaningful verification.

> Background mode relies on a lock file (`.astro/dev.json`). Servers started with `--ignore-lock` or via `nohup`/`setsid` are **not** tracked by `dev:stop`/`dev:status` — kill them by port (`lsof -ti :4321`).

## Architecture / content layout

- `astro.config.mjs` — Astro config: `output: 'static'`, Cloudflare adapter (Workers), i18n (`pt-BR` default with no prefix, `en` with `/en/` prefix), Tailwind via `@tailwindcss/vite`, sitemap.
- `src/content/posts/{pt-br,en}/*.md` — blog posts. Frontmatter: `title`, `pubDate`, `description`, `tags`, `locale`, `author`, `draft`. Slug = filename.
- `src/content/authors/*.json` — authors (`machado`, `mary`, `couto`).
- `src/content.config.ts` — Astro 7 Content Layer API: `defineCollection` + `glob` loader + Zod schema. **Imports come from `astro:content` / `astro/loaders` / `astro/zod`** (don't confuse: `defineCollection` from `astro:content`, `z` from `astro/zod`).
- `src/pages/` — routes per locale: root = pt-BR, `en/` = English. `posts/[slug].astro` dynamic via `getStaticPaths`; `404.astro` at root.
- `src/layouts/` — `MainLayout.astro` (html/navbar/footer/SEO: canonical, Open Graph, Twitter card, JSON-LD WebSite), `PostLayout.astro` (markdown render + author + translation button + JSON-LD Article).
- `src/components/` — `Home.astro` (full home, shared by pt/en), `ArticleCard`, `Episodes`, `Navbar`, `Footer`.
- `src/lib/i18n.ts` — UI strings per locale + `useTranslations(locale)` helper.
- `src/lib/youtube.ts` — channel RSS feed fetch at build (`getLatestVideos`, `episodeNum`, `formatEpDate`); on failure it degrades to `[]` silently.
- `src/styles/global.css` — Tailwind v4 CSS-first: `@import "tailwindcss"` + `@plugin "@tailwindcss/typography"` + `@theme` (colors `--color-primary`, etc. — **no `tailwind.config.js`**).

## Key gotchas

- **Default locale is `pt-BR`, content is in Portuguese.** Keep new blog prose in Brazilian Portuguese (site content exception — see Language rules). Locale folders must match `i18n.locales` exactly (`pt-BR`, `en`).
- **Astro 7 + Tailwind v4 — do not follow old tutorials (≤ Astro 5 / Tailwind v3).** Content Layer API (`content.config.ts` at root, `glob()` loader, `z` from `astro/zod`) and CSS-first Tailwind (`@theme`, no `tailwind.config.js`) changed everything.
- **`@tailwindcss/vite` ≥ 4.2.2 is required** with Vite 8 (Astro 7). Old versions break the build.
- **Frontmatter YAML:** colons (`:`) in values break the build — quote them (e.g. `description: "texto: com dois pontos"`).
- **English posts exist** (`src/content/posts/en/*.md`) — all posts have translations; the translation button only shows when the post exists in the other locale (same slug).
- **Deps with build scripts** (`esbuild`, `workerd`) need `allowScripts` in `package.json` (already configured).
- **Imports use the `~/` alias** (defined in `tsconfig.json` → `./src/*`) — never use relative `../`/`../../`.
- **Always run `npm run build` from the repo root.** The content layer `glob()` resolves `base` relative to the build cwd — if a CI/monorepo builds from another folder, it resolves to a nonexistent directory and returns an empty collection **silently** (build "passes", site ships without posts). `import.meta.url` is not an alternative: Astro rewrites the `content.config.ts` URL.
- `wrangler.toml` (local, legacy) and `.wrangler/` are in `.gitignore` — they may contain sensitive account_id/IDs. Versioned configs are `wrangler.jsonc` (production) and `wrangler.staging.jsonc` (staging) — both without secrets. If one exists locally, delete `wrangler.toml` so it doesn't conflict with the versioned configs.

## Deploy

- **Fully automated via GitHub Actions** — `.github/workflows/deploy.yml`:
- `build` job runs on every push/PR (gate: `npm run build`).
- `deploy` job runs on push to `main` only, via `cloudflare/wrangler-action@v3` (`wrangler deploy --config wrangler.jsonc`) — production Worker `discorgento` (first deploy creates it; then attach the `discorgento.com` custom domain).
- `deploy-staging` job runs on push to `develop` only, via `wrangler deploy --config wrangler.staging.jsonc` — staging Worker `staging`, served at `staging.jonatanaxe.workers.dev`.
- Requires two repo secrets: `CLOUDFLARE_API_TOKEN` (scoped: Workers Scripts Edit, Workers Routes Edit) and `CLOUDFLARE_ACCOUNT_ID`. Never use a full-account token. Trigger `workflow_dispatch` for manual deploys.
- **`wrangler.jsonc` is versioned** (static assets pointing at `dist/client`, `not_found_handling: 404-page`, no `account_id` inside — the action injects it via the `accountId` secret). The Worker `name` must match the existing Worker in the dashboard; a mismatch creates a duplicate Worker.
- **Cloudflare Git integration (Workers Builds) must stay disconnected** — it historically deployed alongside CI and conflicted with the GitHub Actions pipeline. CI owns the deploys now.
- **Dependabot** (`.github/dependabot.yml`) opens weekly PRs for `npm` and `github-actions`; security updates are automatic.
- Before a deploy, validate locally (no auth needed): `npm run build && npx wrangler deploy --dry-run`.
- `public/robots.txt` already allows AI crawlers explicitly (GPTBot, ClaudeBot, PerplexityBot, etc.) — **Cloudflare blocks AI by default** ("AI Crawlers"); if you touch robots.txt, keep the `Allow` lines or the AI-ready work dies at the firewall.
65 changes: 12 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,27 @@
<h1 align="center">
<img src="static/img/discorgento-logo.png" alt="Discorgento logo" width="128" height="128" title="Discorgento"/>
<img src="public/img/logo.svg" alt="Discorgento logo" width="128" height="128" title="Discorgento"/>
<br>
discorgento.com
<br>
</h1>

## Automated deploy
Brazilian tech community — born in Magento, today we talk about tech in general: PHP, JS, e-commerce, AI. Articles, podcast and daily knowledge sharing.

Everything uploaded to branch will be published on the production server
## Site

# Website
Built with **Astro 7 + Tailwind v4**, static, with i18n (pt-BR default, `/en/` prefix) and deployed on Cloudflare (Workers static assets).

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ npm install
```

### Local Development

```
$ npm run start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ npm run build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
See [AGENTS.md](AGENTS.md) for commands and architecture.

## Follow us

<div class="bottom-bar">
<a href="https://discorgento.com/discord" target="_blank" title="Discord">
<img src="static/img/social/discord-icon.png" width="40" height="40" />
</a>
<a href="https://github.com/discorgento" target="_blank" title="Github">
<img
src="static/img/social/github-icon.png" width="40" height="40"/>
</a>
<a href="https://www.instagram.com/discorgento/" target="_blank" title="Instagram">
<img
src="static/img/social/instagram-icon.png" width="40" height="40"/>
</a>
<a href="https://open.spotify.com/show/5h3gKepBezY4Iz5LM79nUn" target="_blank" title="Spotify">
<img
src="static/img/social/spotify-icon.png" width="40" height="40"/>
</a>
<a href="https://www.youtube.com/channel/UChJitnyFtNOoCe6cu-rHcow" target="_blank" title="Youtube">
<img
src="static/img/social/youtube-icon.png" width="40" height="40"/>
</a>
<a href="https://twitter.com/discorgento" target="_blank" title="Twitter">
<img
src="static/img/social/twitter-icon.png" width="40" height="40"/>
</a>
</div>
- [Discord](https://discorgento.com/discord)
- [GitHub](https://github.com/discorgento)
- [YouTube](https://www.youtube.com/channel/UChJitnyFtNOoCe6cu-rHcow)
- [Spotify](https://open.spotify.com/show/5h3gKepBezY4Iz5LM79nUn)
- [Instagram](https://www.instagram.com/discorgento/)
- [Twitter](https://twitter.com/discorgento)

<a href="https://github.com/discorgento/discorgento.com/graphs/contributors">
<img src="https://contrib.rocks/image?repo=discorgento/discorgento.com" />
</a>
</a>
26 changes: 26 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defineConfig } from 'astro/config';
import tailwindcss from '@tailwindcss/vite';
import cloudflare from '@astrojs/cloudflare';
import sitemap from '@astrojs/sitemap';

// https://astro.build/config
export default defineConfig({
site: 'https://discorgento.com',
output: 'static',
adapter: cloudflare({
platformProxy: {
enabled: true,
},
}),
i18n: {
locales: ['pt-BR', 'en'],
defaultLocale: 'pt-BR',
routing: {
prefixDefaultLocale: false,
},
},
integrations: [sitemap()],
vite: {
plugins: [tailwindcss()],
},
});
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

17 changes: 0 additions & 17 deletions blog/authors.yml

This file was deleted.

Empty file removed docs/intro.md
Empty file.
Loading
Loading