@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 CHANGED
@@ -1,23 +1,95 @@
1
1
  # `@grove-dev/astro`
2
2
 
3
- Composable Astro UI and generated-data adapters for Grove-powered directories.
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 generated files, and loads Grove's shared styles. It does not inject routes. Every route lives in the consumer's `src/pages`, where it can be reordered, replaced, or extended without a Grove sync overwriting it.
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
- `grove init` copies a complete working set of home, directory list, record detail, about, contributors, submit, 404, and legacy redirect pages from the canonical `apps/example/` scaffold. `grove.config.ts` determines the directory route and branding.
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
- The package exports granular components and layouts plus `@grove-dev/astro/server` view-model functions. Framework-independent filtering, sorting, lenses, scoring, formatting, and taxonomy logic live in `@grove-dev/core`.
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
- MIT
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.6.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.6.0"
64
+ "@grove-dev/core": "0.7.0"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "astro": "^6.0.0 || ^7.0.0"
@@ -24,7 +24,7 @@ interface Props {
24
24
  }
25
25
 
26
26
  const {
27
- href = "https://grove.dev.mn",
27
+ href = "https://withgrove.dev",
28
28
  size = 16,
29
29
  class: className = "",
30
30
  } = Astro.props;
@@ -381,7 +381,7 @@ export function getDirectoryIndexModel(
381
381
  description: seoDescription(
382
382
  undefined,
383
383
  page > 1
384
- ? `Browse page ${page} of ${pages} — ${items.length} curated ${plural} on ${siteName || "this site"}, filtered by ${facetNames || "category and stack"}.`
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"),