@micacms/astro 0.6.0-rc.2 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micacms/astro",
3
- "version": "0.6.0-rc.2",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "Reads a Mica content repository as Astro Content Collections via the Content Layer API.",
6
6
  "license": "MIT",
@@ -44,14 +44,14 @@
44
44
  "peerDependencies": {
45
45
  "astro": "^7.0.0",
46
46
  "zod": "^4.3.6",
47
- "@micacms/core": "^0.6.0-rc.2"
47
+ "@micacms/core": "^0.6.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^22.20.1",
51
51
  "astro": "^7.2.2",
52
52
  "typescript": "^5.7.3",
53
53
  "zod": "^4.3.6",
54
- "@micacms/core": "0.6.0-rc.2"
54
+ "@micacms/core": "0.6.0"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "tsc -p tsconfig.json",
@@ -36,49 +36,104 @@ the integrations in `astro.config.*`. For each collection, find:
36
36
  - the number of entries, and whether the ids have folders (`2024/hello`);
37
37
  - what the bodies contain: plain Markdown, raw HTML, footnotes, MDX imports and
38
38
  components, images with relative paths;
39
- - the pages and URLs that use the collection.
40
-
41
- ## 3. Ask the user
42
-
43
- Show the inventory as a short table, and ask:
44
-
45
- 1. Which collections should Mica manage? Content that only developers change,
46
- such as documentation in the repository, can stay an Astro collection.
47
- 2. The model you propose for each collection, mapped as in step 4.
48
- 3. Every case where content cannot move without a change:
49
- - MDX components in a body. Markdoc does not run them. Options: a Markdoc
50
- tag that the website declares and renders, a field, or keep that
51
- collection in Astro. Remove the `import` lines too, and the text that
52
- refers to a component you drop.
53
- - Raw HTML in a body. Markdoc does not render it. Options: Markdown (`<b>`
54
- becomes `**`), a Unicode character, a Markdoc tag, or remove it. Some tags
55
- have no Markdown form (`<sub>`, `<sup>`, `<kbd>`, `<mark>`). Do not change
56
- HTML inside code blocks or inline code: that is text.
57
- - Footnotes (`[^1]`). Markdoc shows them as text. Options: a normal
58
- paragraph or a link. Remove the `[^1]` markers from the text too.
59
- - Images in a body (`![](./photo.jpg)`). The rich-text editor has no images.
60
- Options: a `media()` field or a `repeater()` with images, or files in
61
- `public/` with absolute URLs, which Astro does not optimize.
62
- - Ids with folders, or ids that are not slugs. They become flat slugs, so
63
- the URL can change. Options: keep the URL with Astro `redirects`, or
64
- accept the new URL.
65
- - A free list of strings, such as tags. See
66
- [reference.md](./reference.md#the-content-model).
67
- - Headings lose their `id` and code blocks lose their highlighting, unless
68
- the website adds them. See
69
- [reference.md](./reference.md#what-markdoc-renders-differently-from-astros-markdown).
70
- 4. Should editors put a collection in a manual order? If a collection has a
71
- number field that only sorts it, such as `order`, give the user the choice
72
- and the reason:
73
- - Keep it as a `number()` field. No page changes. Editors type numbers,
74
- and two entries can get the same one.
75
- - Make the collection `sortable: true`. Editors drag the entries into
76
- order, which is easier and cannot give two entries the same place. The
77
- import turns the numbers into `_order.json` (`--order`), the field goes, and each
78
- page that sorts by it sorts by `entry.data._mica.position` instead: one
79
- changed line per page.
80
-
81
- Wait for the answers.
39
+ - the pages, components and URLs that use the collection, and the lines that
40
+ read each field;
41
+ - whether the site uses Tailwind CSS 4: a stylesheet with
42
+ `@import "tailwindcss"`.
43
+
44
+ ## 3. Propose, and wait for the approval
45
+
46
+ Before you write the model or change any file, show the user one proposal and
47
+ wait for a short approval or correction. The user must know what will change
48
+ on their website, and why, before anything changes. Write for a reader who is
49
+ new to Mica and may know little about Astro: plain words, short sentences, no
50
+ code. Map the fields with the table in step 4. Use this form:
51
+
52
+ ```markdown
53
+ ## What editors will manage
54
+
55
+ **Team** (2 entries): the people on the team page.
56
+ - Name — text, required
57
+ - Role — text, required
58
+ - Photo — an image, with its alt text right under it (required)
59
+ - Editors put the people in order by dragging them.
60
+
61
+ **Stays as it is:** <collections that stay in Astro, and why>
62
+
63
+ ## What changes in the website's files
64
+
65
+ 1. **The team photos' alt text moves into the photo field.** Editors then
66
+ write it right under the photo, and Mica does not save a photo without it.
67
+ In `TeamSection.astro`, two lines read the photo and its alt text in the
68
+ new place. Visitors see no difference.
69
+ Recommended. Other option: keep the alt text as its own field; then this
70
+ file does not change.
71
+ 2. …
72
+
73
+ ## What cannot move as it is
74
+
75
+ - <each case from the list below, with the options>
76
+
77
+ Shall I go ahead like this? You can change any point.
78
+ ```
79
+
80
+ List every change to a page, a component, a layout, a style or a config file,
81
+ one per item: what changes, in which file, whether visitors can see it
82
+ (normally not), your recommendation, and the other option. Only what you list
83
+ here may change later. The usual items:
84
+
85
+ - **Manual order.** If a collection has a number field that only sorts it,
86
+ such as `order`: recommend that editors drag the entries into order. It is
87
+ easier, and two entries cannot get the same place. The import turns the
88
+ numbers into `_order.json` (`--order`), the field goes, and each page that
89
+ sorts by it sorts by `entry.data._mica.position`: one changed line per
90
+ page. Other option: keep the number field, with no page change.
91
+ - **Alt text.** If an image has its alt text in a separate field: recommend
92
+ the image field with alt text (`media({ accept: "image", alt: "required" })`,
93
+ `--map <collection>.<image>.alt=<field>`). Editors see it under the image,
94
+ and Mica requires it. The page then reads `entry.data.<image>.src` and
95
+ `.alt`, or `<Image {...entry.data.<image>} />`. Other option: keep the
96
+ separate field, with no page change.
97
+ - **Dates.** A date becomes text such as `2026-01-15`. Each page that formats
98
+ or sorts it changes (step 7). Visitors see the same date.
99
+ - **Bodies.** The Markdown body becomes Markdoc: `<Content />` is replaced
100
+ (step 7).
101
+ - **Tailwind CSS 4.** Tailwind reads every file of the project for class
102
+ names, now also `src/mica.ts` and `content/`. A word in a text, such as
103
+ "hidden", then becomes CSS, and the CSS changes when an editor changes a
104
+ text. Recommend excluding both, in the stylesheet with
105
+ `@import "tailwindcss"`, with paths from that file:
106
+ `@source not "./mica.ts";` and `@source not "../content";`. Visitors see no
107
+ difference.
108
+
109
+ What cannot move as it is, with the options to propose:
110
+
111
+ - MDX components in a body. Markdoc does not run them. Options: a Markdoc tag
112
+ that the website declares and renders, a field, or keep that collection in
113
+ Astro. Remove the `import` lines too, and the text that refers to a
114
+ component you drop.
115
+ - Raw HTML in a body. Markdoc does not render it. Options: Markdown (`<b>`
116
+ becomes `**`), a Unicode character, a Markdoc tag, or remove it. Some tags
117
+ have no Markdown form (`<sub>`, `<sup>`, `<kbd>`, `<mark>`). Do not change
118
+ HTML inside code blocks or inline code: that is text.
119
+ - Footnotes (`[^1]`). Markdoc shows them as text. Options: a normal paragraph
120
+ or a link. Remove the `[^1]` markers from the text too.
121
+ - Images in a body (`![](./photo.jpg)`). The rich-text editor has no images.
122
+ Options: a `media()` field or a `repeater()` with images, or files in
123
+ `public/` with absolute URLs, which Astro does not optimize.
124
+ - Ids with folders, or ids that are not slugs. They become flat slugs, so the
125
+ URL can change. Options: keep the URL with Astro `redirects`, or accept the
126
+ new URL.
127
+ - A free list of strings, such as tags. See
128
+ [reference.md](./reference.md#the-content-model).
129
+ - Headings lose their `id` and code blocks lose their highlighting, unless the
130
+ website adds them. See
131
+ [reference.md](./reference.md#what-markdoc-renders-differently-from-astros-markdown).
132
+
133
+ Collections that only developers change, such as documentation in the
134
+ repository, can stay Astro collections: propose that where it fits.
135
+
136
+ Wait for the answer. Change the proposal until the user agrees.
82
137
 
83
138
  ## 4. Map the schema to the model
84
139
 
@@ -158,8 +213,10 @@ from [reference.md](./reference.md#write-entries-with-a-script).
158
213
 
159
214
  ## 7. Change the pages
160
215
 
161
- Look at every file from the inventory: pages, layouts, components and
162
- endpoints such as `rss.xml.js`. See
216
+ Make the changes that the user agreed to in step 3, and no others. If you find
217
+ a change that the proposal did not list, describe it to the user and wait for
218
+ an answer first. Look at every file from the inventory: pages, layouts,
219
+ components, stylesheets and endpoints such as `rss.xml.js`. See
163
220
  [reference.md](./reference.md#render-the-content-in-astro).
164
221
 
165
222
  - `render(entry)` and `<Content />` become
package/setup/finish.md CHANGED
@@ -52,33 +52,49 @@ paths if the project uses others.
52
52
  - Before a commit that changes `content/`, `npm run check` must pass.
53
53
  ```
54
54
 
55
+ Change no other documentation, such as `README.md`, unless the user asks.
56
+
55
57
  ## 4. Tell the user
56
58
 
57
- - What you added and changed, file by file.
58
- - The decisions they made, and what was not converted, if anything.
59
- - How to commit: give the commands, and run them only if the user asks. With
60
- converted content, use two commits, so that the history keeps the setup
61
- apart from the content. Name the files of the first commit from
62
- `git status`:
63
-
64
- ```bash
65
- # 1. The setup: packages, model, collections config, agent notes, scripts.
66
- git add package.json package-lock.json src/mica.ts src/content.config.ts \
67
- content/.mica/schema.json AGENTS.md
68
- git commit -m "Add Mica"
69
- # 2. The content and the page changes: everything else that git status shows.
70
- git add -A
71
- git commit -m "Move the content to Mica"
72
- ```
73
-
74
- Use the project's lock file (`pnpm-lock.yaml`, `yarn.lock`). For a new
75
- project without converted content, one commit is enough.
76
- - How to publish the branch: on a branch that is not on the remote yet,
77
- `git push -u origin <branch>`. The editor's Publish does this too, the first
78
- time.
79
- - How to edit: `npm run mica` opens the editor on this computer. A save writes
80
- files in `content/`; Publish commits them. `npm run check` checks the content
81
- (and the types, if `@astrojs/check` is there). `@micacms/editor` is a dev
82
- dependency, so on another clone, run `npm install` first.
83
- - That a self-hosted editor for other people is described at
84
- https://micacms.com/docs/self-hosting/.
59
+ Your last message is the report. Its commands are for this one time: do not
60
+ write them into `README.md` or another file. Use this form, with the real
61
+ files from `git status`:
62
+
63
+ ````markdown
64
+ ## Done
65
+
66
+ Mica is set up. <one sentence on what editors can now edit>.
67
+
68
+ **What changed:** <file by file, one line each: what and why, in plain words>.
69
+ **Your decisions:** <each decision from the proposal, and the choice>.
70
+ **Not converted:** <anything that was not converted, or "nothing">.
71
+ **Checks:** `npm run check` and `npx astro build` pass. <how the website
72
+ compares with the version before>.
73
+
74
+ ## Commit it
75
+
76
+ ```bash
77
+ # 1. The setup: packages, model, collections config, agent notes.
78
+ git add package.json package-lock.json src/mica.ts src/content.config.ts \
79
+ content/.mica/schema.json AGENTS.md <other setup files>
80
+ git commit -m "Add Mica"
81
+ # 2. The content and the page changes.
82
+ git add -A
83
+ git commit -m "Move the content to Mica"
84
+ # 3. A branch that is not on the remote yet.
85
+ git push -u origin <branch>
86
+ ```
87
+
88
+ ## Edit the content
89
+
90
+ `npm run mica` opens the editor on this computer. A save writes files in
91
+ `content/`; Publish commits them, and pushes a new branch the first time.
92
+ `npm run check` checks the content (and the types, if `@astrojs/check` is
93
+ there). On another clone, run `npm install` first. A self-hosted editor for
94
+ other people: https://micacms.com/docs/self-hosting/.
95
+ ````
96
+
97
+ - Use the project's lock file (`pnpm-lock.yaml`, `yarn.lock`) and package
98
+ manager.
99
+ - For a new project without converted content, one commit is enough.
100
+ - Run the commands only if the user asks.
@@ -25,8 +25,24 @@ Ask these questions, and wait for the answers:
25
25
  file.
26
26
  6. Do they want example content, so that the pages show something at once?
27
27
 
28
- Suggest a model from the answers, as a short list of collections, singletons
29
- and fields. Change it until the user agrees.
28
+ Then show one proposal, and wait for a short approval or correction before
29
+ you write a file. Write for a reader who is new to Mica and may know little
30
+ about Astro: plain words, no code.
31
+
32
+ - **What editors will manage:** each collection and singleton, one line on
33
+ what it is, and its fields in plain words ("Title — text, required",
34
+ "Cover — an image, with its alt text under it").
35
+ - **The pages:** each page you will make, with its URL and what it shows.
36
+ - **Existing files that change:** in an empty Astro project, for example
37
+ `src/pages/index.astro` or a layout: what changes, and why. Nothing else
38
+ changes.
39
+ - Your recommendation where there is a choice, and the other option: manual
40
+ order by dragging, or sorting by a field; alt text required for images that
41
+ carry meaning.
42
+
43
+ End with: "Shall I go ahead like this? You can change any point." Change the
44
+ proposal until the user agrees, and later make no change that it did not
45
+ list without asking first.
30
46
 
31
47
  ## 2. Add Mica to the project
32
48