@grove-dev/astro 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -5
- package/package.json +2 -2
- package/src/components/PoweredBy.astro +1 -1
- package/src/server/models.ts +1 -1
package/README.md
CHANGED
|
@@ -1,23 +1,95 @@
|
|
|
1
1
|
# `@grove-dev/astro`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Astro integration, generated-data adapters, server view-model helpers,
|
|
4
|
+
and the composable UI used by Grove-powered sites.
|
|
4
5
|
|
|
5
|
-
The integration prepares generated data before Astro runs, aliases
|
|
6
|
+
The integration prepares generated data before Astro runs, aliases
|
|
7
|
+
the source directories of the package's components and layouts so
|
|
8
|
+
consumers can write
|
|
9
|
+
`import ProjectCard from "@grove-dev/astro/components/ProjectCard.astro"`,
|
|
10
|
+
auto-loads the consumer's `src/styles/global.css` when it exists,
|
|
11
|
+
and re-exports the framework-agnostic helpers from `@grove-dev/core`.
|
|
12
|
+
|
|
13
|
+
It does **not** inject routes. Every route lives in the consumer's
|
|
14
|
+
`src/pages/`, where it can be reordered, replaced, or extended
|
|
15
|
+
without a Grove sync overwriting it.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm add @grove-dev/astro
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Requires Node.js `>=22.12.0` and Astro `^6.0.0 || ^7.0.0`.
|
|
24
|
+
|
|
25
|
+
## Enable the integration
|
|
6
26
|
|
|
7
27
|
```js
|
|
28
|
+
// astro.config.mjs
|
|
8
29
|
import { defineConfig } from "astro/config";
|
|
9
30
|
import grove from "@grove-dev/astro";
|
|
10
31
|
|
|
11
32
|
export default defineConfig({ integrations: [grove()] });
|
|
12
33
|
```
|
|
13
34
|
|
|
14
|
-
|
|
35
|
+
When `grove()` loads it:
|
|
36
|
+
|
|
37
|
+
1. Runs `prepareDirectory()` so `@grove/generated` is up to date
|
|
38
|
+
before `astro dev`, `astro check`, or `astro build`.
|
|
39
|
+
2. Loads `grove.config.ts` and syncs the packaged icons into the
|
|
40
|
+
consumer's `public/icons/`.
|
|
41
|
+
3. Aliases `@grove-dev/astro/components`, `@grove-dev/astro/layouts`,
|
|
42
|
+
and `@grove/generated` to their on-disk locations.
|
|
43
|
+
4. Injects the consumer's `src/styles/global.css` when present, so
|
|
44
|
+
brand tokens defined there take effect without manual imports.
|
|
45
|
+
|
|
46
|
+
## What this package ships
|
|
47
|
+
|
|
48
|
+
| Surface | Contents |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `@grove-dev/astro` | The integration plus re-exports of `@grove-dev/core` and the generic `lib/` helpers (search, lenses, scores, repo, format, display, taxonomy counts). |
|
|
51
|
+
| `@grove-dev/astro/components` | Composable `.astro` components — `Hero`, `Card`, `Icon`, `FilterGroupMenu`, `SearchField`, `ThemeToggle`, `MarkdownBody`, and more. |
|
|
52
|
+
| `@grove-dev/astro/layouts` | Page-level layouts — `BaseLayout`, `Container`, `Header`, `Footer`, `SectionHeader`, `Seo`. |
|
|
53
|
+
| `@grove-dev/astro/server` | View-model helpers that take generated data and return the props a page expects. |
|
|
54
|
+
| `@grove-dev/astro/ui` | Small UI primitives — `Button`, `Badge`, `EmptyState`, `FilterDrawer`, `PageHeader`. |
|
|
55
|
+
| `@grove-dev/astro/styles.css` | The shared Grove stylesheet imported from the consumer's global layout. |
|
|
15
56
|
|
|
16
|
-
|
|
57
|
+
## Server view models
|
|
58
|
+
|
|
59
|
+
`@grove-dev/astro/server` builds the props each page needs from the
|
|
60
|
+
generated data, so route files stay small and pages remain
|
|
61
|
+
declarative.
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
// src/pages/index.astro
|
|
65
|
+
import { BaseLayout, Hero, Card } from "@grove-dev/astro";
|
|
66
|
+
import { buildHomeModel } from "@grove-dev/astro/server";
|
|
67
|
+
|
|
68
|
+
const model = await buildHomeModel();
|
|
69
|
+
---
|
|
70
|
+
<BaseLayout seo={model.seo}>
|
|
71
|
+
<Hero {...model.hero} />
|
|
72
|
+
<Card {...model.featuredCard} />
|
|
73
|
+
</BaseLayout>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Routes stay in the consumer project
|
|
77
|
+
|
|
78
|
+
`grove init` copies a complete working set of home, list, record
|
|
79
|
+
detail, about, contributors, submit, 404, and legacy redirect pages
|
|
80
|
+
from the canonical `apps/example/` scaffold. The copy is the source
|
|
81
|
+
of truth for those routes — the integration never injects them.
|
|
82
|
+
|
|
83
|
+
To customize a page, edit the file in `src/pages/` directly. Grove
|
|
84
|
+
will not overwrite it on the next sync.
|
|
85
|
+
|
|
86
|
+
## Develop Astro
|
|
17
87
|
|
|
18
88
|
```bash
|
|
19
89
|
pnpm --filter @grove-dev/astro check
|
|
20
90
|
pnpm --dir apps/example build
|
|
21
91
|
```
|
|
22
92
|
|
|
23
|
-
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
[MIT](../../LICENSE) © Grove contributors.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grove-dev/astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Composable Astro UI, data adapters, and integration for Grove directories.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"sanitize-html": "^2.17.5",
|
|
62
62
|
"shiki": "^1.29.2",
|
|
63
63
|
"yaml": "^2.9.0",
|
|
64
|
-
"@grove-dev/core": "0.
|
|
64
|
+
"@grove-dev/core": "0.7.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"astro": "^6.0.0 || ^7.0.0"
|
package/src/server/models.ts
CHANGED
|
@@ -381,7 +381,7 @@ export function getDirectoryIndexModel(
|
|
|
381
381
|
description: seoDescription(
|
|
382
382
|
undefined,
|
|
383
383
|
page > 1
|
|
384
|
-
? `Browse page ${page} of ${
|
|
384
|
+
? `Browse page ${page} of ${pageCount} — ${items.length} curated ${plural} on ${siteName || "this site"}, filtered by ${facetNames || "category and stack"}.`
|
|
385
385
|
: `Search and filter ${items.length} curated ${plural} on ${siteName || "this site"} — by ${facetNames || "category and stack"}.`,
|
|
386
386
|
),
|
|
387
387
|
image: ogPath("default"),
|