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
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,22 @@ jobs:
# automatically — no long-lived NPM_TOKEN secret required.
# Trusted publisher configured at:
# https://www.npmjs.com/package/@kamansoft/vite-plugin-flatwave-react/access

# ─── 3. Sync workspace version ──────────────────────────────────────────────
# semantic-release only bumps the plugin package.json (pkgRoot).
# This step syncs the version to the root workspace package.json for consistency.
- name: Sync workspace version
if: success()
run: |
PLUGIN_VERSION=$(cat packages/vite-plugin-flatwave-react/package.json | grep '"version"' | head -1 | sed 's/.*"version": "\(.*\)".*/\1/')
echo "Plugin version: $PLUGIN_VERSION"
# Update root package.json
npm pkg set version=$PLUGIN_VERSION --workspaces=false
# Commit and push the version sync (chore commit won't trigger new release)
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add package.json
git commit -m "chore: sync workspace version to $PLUGIN_VERSION" || echo "No changes to commit"
git push origin HEAD:main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Changelog

## 2.0.1 (2026-06-20)

### Documentation

- **documentation:** update documentation badges ([#14](https://github.com/kamansoft/vite-plugin-flatwave-react/pull/14))
- **docs:** add architecture, development, contributing documentation and refactor readme ([#13](https://github.com/kamansoft/vite-plugin-flatwave-react/pull/13))

## 2.0.0 (2026-06-20)

### ⚠ BREAKING CHANGES

- **rendering!:** rewrite SSG pipeline with fully-rendered HTML output ([#12](https://github.com/kamansoft/vite-plugin-flatwave-react/pull/12))

### Features

- **rendering:** new SSG pipeline with RenderStrategy interface, DefaultRenderStrategy, RenderPipeline, and hook phases (beforeRender, transformMarkdown, transformHtml, afterRender, onError)
- **rendering:** template system with built-in index.html.ejs and filesystem override convention
- **rendering:** markdown compiler extracted to reusable compileMarkdownToHtml function
- **ci-cd:** document enforce_admins lock and stale-tag cleanup procedure

## 1.1.0 (2026-06-19)

### Features

- **release:** scope package to @kamansoft org and fix CI/CD pipeline
- **ci:** switch to npm OIDC trusted publishing and enforce conventional commit pipeline

### Bug Fixes

- **publish:** force npm token auth for semantic-release
- **release:** enable npm trusted publishing in release workflow
- **release-workflow:** fix failure caused by registry resolution during semantic-release prepare
- **npm-publish:** resolve publishing pipeline conflicts and CI issues

## 1.0.0 (2026-06-17)

### ⚠ BREAKING CHANGES
Expand Down
32 changes: 10 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A Vite plugin that turns a directory of Markdown files into a **fully typed, i18
At build time the plugin:

- Scans `src/content/{locale}/*.md` and parses front-matter with [`gray-matter`](https://github.com/jonschlinkert/gray-matter)
- Validates required fields, duplicate IDs, slugs, component references, and missing locale variants
- Validates required fields, duplicate IDs, slugs, and missing locale variants
- Exposes a **virtual module** (`virtual:flatwave/content`) with typed helper functions usable in any React component
- Generates locale-prefixed static HTML pages via `react-dom/server`
- Emits `sitemap.xml`, `robots.txt`, and `route-manifest.json`
Expand Down Expand Up @@ -80,7 +80,6 @@ export default defineConfig({
locales: ['es', 'pt'], // all supported locales
defaultLocale: 'es', // must be in locales[]
strictMissingLocales: false, // true → missing locale = build error
componentsDir: path.resolve(__dirname, 'src/components'), // for component validation
sitemap: {
hostname: 'https://example.com', // used in sitemap.xml and robots.txt
},
Expand All @@ -104,11 +103,6 @@ src/
index.md
about.md
program.md
components/
SimplePage.tsx ← referenced by component: 'SimplePage' in frontmatter
ProgramPage.tsx
LanguageSwitcher.tsx
MarkdownRenderer.tsx
```

Each locale must mirror the same set of content IDs. Missing locale variants produce warnings (or errors with `strictMissingLocales: true`).
Expand All @@ -122,7 +116,6 @@ Every `.md` file must include these **required fields**:
title: 'About Us'
slug: 'about' # URL segment — becomes /{locale}/about
id: 'about' # groups translations: same id across locales
component: 'SimplePage' # React component name in componentsDir
public: true # false → excluded from routes, sitemap, manifest
description: 'Short description'
canonical: '/es/about' # optional, defaults to /{locale}/{slug}
Expand All @@ -142,12 +135,12 @@ jsonLd:
# Navigation hints
menu: 'main'
menu_position: 2
# Any extra keys are preserved in attributes and forwarded to the component
# Any extra keys are preserved in attributes
---
Markdown body here. GitHub-flavoured Markdown. No MDX in v1.
```

**All extra frontmatter keys** not in the baseline list are preserved in `attributes` and forwarded as props to the React component — no schema changes required.
**All extra frontmatter keys** not in the baseline list are preserved in `attributes` and accessible via React hooks and the virtual module.

---

Expand Down Expand Up @@ -394,15 +387,13 @@ The plugin validates content at build time (also exposed as a standalone CLI). V
| Duplicate content IDs per locale | **Error** — build fails |
| Duplicate slugs per locale | **Error** — build fails |
| Duplicate menu positions | **Error** — build fails |
| Component not found in `componentsDir` | **Error** — build fails |
| Content ID missing in one or more locales | **Warning** (or error with `strictMissingLocales: true`) |
| No public routes generated | **Warning** |

```ts
flatwaveContent({
// ...
requiredFields: ['title', 'slug', 'id', 'component', 'public'], // default
validateComponents: true, // default: true
requiredFields: ['title', 'slug', 'id', 'public'], // default
strictMissingLocales: false, // default: false
});
```
Expand All @@ -418,21 +409,18 @@ npx flatwave-validate \
--content-dir src/content \
--locales es,pt \
--default-locale es \
--components-dir src/components \
--strict-missing # optional: missing locale → error instead of warning

# Exit code 0 → passed
# Exit code 1 → errors found
```

| Option | Description |
| --------------------------- | --------------------------------------------------------------------------- |
| `--content-dir <dir>` | Path to the content directory |
| `--locales <list>` | Comma-separated locale identifiers |
| `--default-locale <locale>` | The primary locale |
| `--components-dir <dirs>` | Comma-separated component directories (default: `src/components,src/pages`) |
| `--strict-missing` | Treat missing locale variants as errors |
| `--no-validate-components` | Skip component existence check |
| Option | Description |
| --------------------- | --------------------------------------- |
| `--content-dir <dir>` | Path to the content directory |
| `--locales <list>` | Comma-separated locale identifiers |
| `--default-locale` | The primary locale |
| `--strict-missing` | Treat missing locale variants as errors |

---

Expand Down
Loading
Loading