@purview-dev/astroc4 1.0.0-prerelease.5 → 1.0.0-prerelease.7
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 +155 -95
- package/dist/expressive-code.d.ts +0 -4
- package/dist/expressive-code.js.map +5 -5
- package/dist/fences.d.ts +37 -22
- package/dist/file-layout.d.ts +4 -0
- package/dist/grammar/langium.d.ts +0 -4
- package/dist/grammar/source.d.ts +0 -12
- package/dist/grammar/textmate.d.ts +0 -2
- package/dist/icon-assets.d.ts +28 -0
- package/dist/icon-plugin.d.ts +16 -0
- package/dist/index.d.ts +12 -49
- package/dist/index.js +629 -78
- package/dist/index.js.map +15 -10
- package/dist/integration.d.ts +14 -24
- package/dist/integration.js +612 -43
- package/dist/integration.js.map +11 -5
- package/dist/projects.d.ts +24 -0
- package/dist/translations.d.ts +1 -0
- package/dist/workspace.d.ts +5 -0
- package/package.json +8 -3
- package/src/components/DiagramFrame.astro +13 -23
- package/src/components/DiagramShell.astro +18 -30
- package/src/components/ErrorBoundary.tsx +1 -5
- package/src/components/LikeC4Fence.astro +1 -5
- package/src/components/LikeC4InlineView.tsx +6 -16
- package/src/components/LikeC4ProjectView.tsx +0 -5
- package/src/components/LikeC4View.astro +73 -28
- package/src/components/LoadingPlaceholder.astro +9 -14
- package/src/components/icon-source.ts +5 -22
- package/src/components/labels.ts +10 -16
- package/src/components/md-fences.tsx +37 -0
- package/src/components/render-icon.tsx +0 -9
- package/src/components/utils.ts +40 -7
- package/src/translations.ts +3 -10
package/README.md
CHANGED
|
@@ -6,13 +6,17 @@ Interactive [LikeC4](https://likec4.dev) architecture diagrams for Astro and
|
|
|
6
6
|
Starlight.
|
|
7
7
|
|
|
8
8
|
- `<LikeC4View viewId="…" />` — render a view from the site's `.c4` model.
|
|
9
|
-
- ` ```likec4 ` fences in `.mdx` —
|
|
10
|
-
build time, or an empty fence with `view="…"` pointing at the
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
9
|
+
- ` ```likec4 ` fences in `.md` and `.mdx` — inline DSL or a `.c4` file, compiled
|
|
10
|
+
and laid out at build time, or an empty fence with `view="…"` pointing at the
|
|
11
|
+
model.
|
|
12
|
+
- Projects from anywhere: discovered under the site root, or named in the
|
|
13
|
+
options, with any LikeC4 config file (`likec4.config.json`, `.likec4rc`,
|
|
14
|
+
`likec4.config.ts`, …) and their `imageAliases` unchanged.
|
|
15
|
+
- LikeC4 syntax highlighting for Expressive Code (` ```c4 `), derived at build
|
|
16
|
+
time from the Langium grammar in [likec4/likec4](https://github.com/likec4/likec4)
|
|
17
|
+
— no Expressive Code config under Starlight.
|
|
18
|
+
- Every UI string translatable through Starlight's i18n, and every colour a
|
|
19
|
+
`--likec4-*` token a site can set.
|
|
16
20
|
|
|
17
21
|
It works in **plain Astro** as well: `@purview-dev/astroc4/integration` is an
|
|
18
22
|
`AstroIntegration` that adds the same model compiler and fence transform. See
|
|
@@ -25,44 +29,36 @@ Full documentation lives in [`docs/wiki`](docs/wiki/README.md), grouped into
|
|
|
25
29
|
## Install
|
|
26
30
|
|
|
27
31
|
```sh
|
|
28
|
-
bun add @purview-dev/astroc4
|
|
32
|
+
bun add @purview-dev/astroc4
|
|
29
33
|
```
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
Only prereleases (`1.0.0-prerelease.N`) are published so far; `latest` and
|
|
36
|
+
`prerelease` both point at the newest one, and `@prerelease` will keep tracking
|
|
37
|
+
prereleases once a stable version ships. Astroc4 declares its peer dependencies,
|
|
38
|
+
so Bun and npm install them with it; under pnpm add them explicitly (`astro`,
|
|
34
39
|
`@astrojs/react`, `@astrojs/markdown-satteri`, `likec4`, `@likec4/core`,
|
|
35
40
|
`react`, `react-dom`, `shiki`, and `@astrojs/starlight` if you use the plugin —
|
|
36
41
|
Starlight is an optional peer, because plain Astro does not need it).
|
|
37
42
|
|
|
38
43
|
`astro add @purview-dev/astroc4` wires the **plain-Astro** shape for you: it
|
|
39
|
-
installs the package
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
render but the translated UI and LikeC4 highlighting do not, and the plugin warns
|
|
45
|
-
about it.
|
|
46
|
-
|
|
47
|
-
(`astro`'s integrations library indexes npm by keyword, and this package carries
|
|
48
|
-
`astro-integration` with `ui` for a category.)
|
|
49
|
-
|
|
50
|
-
Working on astroc4 itself? `bun add @purview-dev/astroc4@file:../path/to/astroc4` copies the
|
|
51
|
-
package into `node_modules`, so run `bun install` in the site again after
|
|
52
|
-
changing the plugin.
|
|
44
|
+
installs the package and writes `integrations: [astroc4()]`, which works because
|
|
45
|
+
the default export implements the Astro integration protocol too. In a Starlight
|
|
46
|
+
site move that call into `starlight({ plugins: [astroc4()] })`; left in
|
|
47
|
+
`integrations`, the diagrams still render but the translated UI and LikeC4
|
|
48
|
+
highlighting do not, and the plugin warns about it.
|
|
53
49
|
|
|
54
50
|
## Use
|
|
55
51
|
|
|
56
52
|
### With Starlight
|
|
57
53
|
|
|
58
|
-
```
|
|
59
|
-
// astro.config.
|
|
54
|
+
```ts
|
|
55
|
+
// astro.config.ts
|
|
56
|
+
import { defineConfig } from 'astro/config';
|
|
60
57
|
import starlight from '@astrojs/starlight';
|
|
61
|
-
import react from '@astrojs/react';
|
|
62
58
|
import astroc4 from '@purview-dev/astroc4';
|
|
63
59
|
|
|
64
60
|
export default defineConfig({
|
|
65
|
-
|
|
61
|
+
integrations: [starlight({ title: 'My docs', plugins: [astroc4()] })],
|
|
66
62
|
});
|
|
67
63
|
```
|
|
68
64
|
|
|
@@ -72,66 +68,100 @@ import LikeC4View from '@purview-dev/astroc4/components/LikeC4View.astro';
|
|
|
72
68
|
<LikeC4View viewId="index" height={560} />
|
|
73
69
|
```
|
|
74
70
|
|
|
71
|
+
`@astrojs/react` is added for you when the site has no React renderer (the
|
|
72
|
+
islands are `client:only="react"`); list `react()` yourself if you prefer it
|
|
73
|
+
explicit.
|
|
74
|
+
|
|
75
75
|
### With Astro (no Starlight)
|
|
76
76
|
|
|
77
|
-
```
|
|
78
|
-
// astro.config.
|
|
77
|
+
```ts
|
|
78
|
+
// astro.config.ts
|
|
79
79
|
import { defineConfig } from 'astro/config';
|
|
80
80
|
import mdx from '@astrojs/mdx';
|
|
81
81
|
import expressiveCode from 'astro-expressive-code';
|
|
82
82
|
import astroc4 from '@purview-dev/astroc4/integration';
|
|
83
|
+
import { likec4Language } from '@purview-dev/astroc4/expressive-code';
|
|
83
84
|
|
|
84
85
|
export default defineConfig({
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
// Expressive Code must come before mdx() — its own requirement.
|
|
87
|
+
integrations: [expressiveCode({ shiki: { langs: [likec4Language] } }), astroc4(), mdx()],
|
|
87
88
|
});
|
|
88
89
|
```
|
|
89
90
|
|
|
90
|
-
The
|
|
91
|
-
|
|
92
|
-
`astro-expressive-code`
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
The site supplies `@astrojs/mdx` (for `<LikeC4View>` and fences in `.mdx`;
|
|
92
|
+
fences in plain `.md` work without it) and, for highlighting,
|
|
93
|
+
`astro-expressive-code` given `likec4Language` — Starlight has an
|
|
94
|
+
`expressiveCode` option for the plugin to fill in, Astro does not.
|
|
95
|
+
[`examples/astro`](examples/astro) is a working site with exactly this config
|
|
96
|
+
(`bun run dev:astro`).
|
|
97
|
+
|
|
98
|
+
### Projects
|
|
99
|
+
|
|
100
|
+
A diagram comes from one of three places:
|
|
101
|
+
|
|
102
|
+
- **A discovered project** — every folder under the site root with a LikeC4
|
|
103
|
+
config file. All of LikeC4's names are read, the way LikeC4 reads them:
|
|
104
|
+
`.likec4rc`, `.likec4.config.json` and `likec4.config.json` as JSON5,
|
|
105
|
+
`likec4.config.{ts,mts,cts,js,mjs,cjs}` bundled with esbuild. The project is
|
|
106
|
+
named by its config's `name`, or after its folder.
|
|
107
|
+
- **A named project** — `projects: { <name>: <folder> }` adds LikeC4 projects
|
|
108
|
+
from anywhere: a sibling folder, another checkout, an absolute path. The key is
|
|
109
|
+
the name pages use. The project's own config, model and icons are used exactly
|
|
110
|
+
as they are.
|
|
111
|
+
- **A single file** — `<LikeC4View file="diagrams/flow.c4">`, or a fence's
|
|
112
|
+
`file="…"`, compiled at build time like an inline fence.
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
// src/likec4/likec4.config.ts
|
|
116
|
+
import { defineConfig } from 'likec4/config';
|
|
117
|
+
|
|
118
|
+
export default defineConfig({ name: 'docs', imageAliases: { '@': './images' } });
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
starlight({
|
|
123
|
+
plugins: [astroc4({ projects: { architecture: '../../docs/architecture/likec4' } })],
|
|
124
|
+
});
|
|
125
|
+
```
|
|
95
126
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
the full walkthrough, and [`examples/astro`](examples/astro) is a working site
|
|
100
|
-
with exactly this config (`bun run dev:astro`).
|
|
127
|
+
```mdx
|
|
128
|
+
<LikeC4View project="architecture" viewId="c1-context" />
|
|
129
|
+
```
|
|
101
130
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
131
|
+
With exactly one project, `project` may be left out. With more than one,
|
|
132
|
+
leaving it out fails the build and lists the names — for `<LikeC4View>` and
|
|
133
|
+
empty fences, in `.md` and `.mdx` alike. An unknown name fails the build the same
|
|
134
|
+
way. Two projects with the same name, or whose configs declare the same `name`,
|
|
135
|
+
fail the build naming both folders.
|
|
105
136
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
without a `projectId`, so a stray `.c4` project (a vendored example, say) can
|
|
110
|
-
silently replace your own.
|
|
137
|
+
Named projects are compiled through links in `.astro/astroc4/workspace` (Astro's
|
|
138
|
+
cache folder, which Astro sites already ignore); edits to their `.c4` files
|
|
139
|
+
reload in `astro dev` like any other.
|
|
111
140
|
|
|
112
141
|
### Options
|
|
113
142
|
|
|
114
143
|
| Option | Default | |
|
|
115
144
|
| --- | --- | --- |
|
|
116
|
-
| `
|
|
145
|
+
| `projects` | `{}` | Named LikeC4 project folders, relative to the site root or absolute. See above. |
|
|
146
|
+
| `vitePlugin` | `{}` | Passed to `LikeC4VitePlugin`. Setting `workspace` or `languageServices` takes discovery over: `projects` is then ignored (with a warning). |
|
|
117
147
|
| `fences` | `true` | Turn ` ```likec4 ` fences into diagrams. |
|
|
118
|
-
| `highlighting` | `true` | Highlight LikeC4 source. Starlight only — a plain Astro site
|
|
148
|
+
| `highlighting` | `true` | Highlight LikeC4 source. Starlight only — a plain Astro site passes `likec4Language` to Expressive Code. See below. |
|
|
119
149
|
|
|
120
150
|
### Syntax highlighting
|
|
121
151
|
|
|
122
152
|
Under Starlight the plugin reads `packages/language-server/src/like-c4.langium`
|
|
123
153
|
from `likec4/likec4`, derives a TextMate grammar from it, and registers that with
|
|
124
|
-
the site's Expressive Code — so ` ```c4 ` fences, ` ```likec4 `
|
|
154
|
+
the site's Expressive Code — so ` ```c4 ` fences, ` ```likec4 ` source and
|
|
125
155
|
`<Code lang="likec4">` all highlight with no configuration. Highlighting
|
|
126
156
|
follows the language: when upstream adds a shape or a keyword, the next build
|
|
127
157
|
picks it up.
|
|
128
158
|
|
|
129
|
-
```
|
|
159
|
+
```ts
|
|
130
160
|
starlight({
|
|
131
161
|
plugins: [
|
|
132
162
|
astroc4({
|
|
133
163
|
highlighting: {
|
|
134
|
-
ref: 'v1.
|
|
164
|
+
ref: 'v1.60.0', // branch, tag or commit SHA; default 'main'
|
|
135
165
|
},
|
|
136
166
|
}),
|
|
137
167
|
],
|
|
@@ -147,11 +177,12 @@ starlight({
|
|
|
147
177
|
| `cacheTtl` | `3600` | Seconds a cached fetch stays fresh. |
|
|
148
178
|
| `refresh` | `false` | Ignore the cache and refetch. |
|
|
149
179
|
| `cacheDir` | `node_modules/.cache/astroc4` | Where to cache. |
|
|
150
|
-
| `baseUrl` | `raw.githubusercontent.com` | Raw host to read from. |
|
|
180
|
+
| `baseUrl` | `https://raw.githubusercontent.com` | Raw host to read from. |
|
|
151
181
|
| `timeout` | `15000` | Request timeout in milliseconds. |
|
|
152
182
|
|
|
153
|
-
`ASTROC4_REF` and `ASTROC4_OFFLINE=1`
|
|
154
|
-
CI configuration out of the config
|
|
183
|
+
`ASTROC4_REF` overrides `ref`, and `ASTROC4_OFFLINE=1` stands in for `offline`
|
|
184
|
+
when the config does not set it, which keeps CI configuration out of the config
|
|
185
|
+
file.
|
|
155
186
|
|
|
156
187
|
The grammar is resolved while Astro loads its config, so `astro dev`,
|
|
157
188
|
`astro build`, `astro check` and `astro sync` all fail on a `ref` that does not
|
|
@@ -160,36 +191,48 @@ LikeC4 grammar — the same way any other build error does. Air-gapped builds us
|
|
|
160
191
|
`offline: true`; builds that must not hard-fail use `onError: 'warn'`, which
|
|
161
192
|
falls back to the last fetched grammar and then to the bundled snapshot.
|
|
162
193
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
A site that already has an `ec.config.mjs` keeps working, and can pin the
|
|
167
|
-
bundled grammar there instead — which is also what a plain Astro site does:
|
|
168
|
-
|
|
169
|
-
```js
|
|
170
|
-
// ec.config.mjs
|
|
171
|
-
import { defineEcConfig } from '@astrojs/starlight/expressive-code';
|
|
172
|
-
import { likec4Language } from '@purview-dev/astroc4/expressive-code';
|
|
173
|
-
|
|
174
|
-
export default defineEcConfig({ shiki: { langs: [likec4Language] } });
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
Expressive Code concatenates `shiki.langs` when it merges an `ec.config.mjs`
|
|
178
|
-
with the integration options, so its own languages and the plugin's coexist.
|
|
194
|
+
A Starlight site that already has an `ec.config.mjs` keeps working: Expressive
|
|
195
|
+
Code concatenates `shiki.langs` when it merges that file with the plugin's
|
|
196
|
+
options, so its own languages and LikeC4 coexist.
|
|
179
197
|
|
|
180
198
|
### `<LikeC4View>` props
|
|
181
199
|
|
|
182
200
|
| Prop | Type | Default |
|
|
183
201
|
| --- | --- | --- |
|
|
184
202
|
| `viewId` | `string` | required |
|
|
185
|
-
| `
|
|
203
|
+
| `project` | `string` | the only project; required when there are several |
|
|
204
|
+
| `file` | `string` | a `.c4` file relative to `src/`, instead of a project |
|
|
205
|
+
| `projectId` | `string` | deprecated alias of `project` |
|
|
186
206
|
| `title` / `description` | `string` | translated defaults |
|
|
187
207
|
| `height` | `number` | `480` |
|
|
188
208
|
| `collapsible` / `defaultOpen` | `boolean` | `true` |
|
|
189
209
|
|
|
210
|
+
`file` must name a `.c4` file under the site's `src/` folder; anything else
|
|
211
|
+
fails the build. A single file has no config, so it has no `imageAliases`: use a
|
|
212
|
+
pack, a URL or a `public/` icon there.
|
|
213
|
+
|
|
190
214
|
### Fence options
|
|
191
215
|
|
|
192
|
-
` ```likec4 view="…" title="…" description="…" height=420 collapsible=false defaultOpen=false `
|
|
216
|
+
` ```likec4 view="…" project="…" file="…" title="…" description="…" height=420 collapsible=false defaultOpen=false `
|
|
217
|
+
|
|
218
|
+
`file` is relative to the Markdown page and must stay inside the site. Fences in
|
|
219
|
+
`.md` and `.mdx` take the same options; in `.md` the UI strings are English.
|
|
220
|
+
|
|
221
|
+
### Styling
|
|
222
|
+
|
|
223
|
+
Set any token on an ancestor — `:root` works on any site:
|
|
224
|
+
|
|
225
|
+
```css
|
|
226
|
+
:root {
|
|
227
|
+
--likec4-border: #d4d4d8;
|
|
228
|
+
--likec4-accent: #0046be;
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
`--likec4-border`, `-surface`, `-surface-alt`, `-text`, `-text-muted`,
|
|
233
|
+
`-accent`, `-skeleton`, `-danger`, `-danger-soft` and `-danger-text`. Unset,
|
|
234
|
+
they fall back to Starlight's `--sl-color-*`, then to neutral greys. See
|
|
235
|
+
[Components](docs/wiki/guide/Components.md#styling).
|
|
193
236
|
|
|
194
237
|
### Translating
|
|
195
238
|
|
|
@@ -199,10 +242,21 @@ because some are filled in by the browser, not by i18next.
|
|
|
199
242
|
|
|
200
243
|
## Icons
|
|
201
244
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
245
|
+
Every form LikeC4 accepts works, in discovered and named projects alike:
|
|
246
|
+
|
|
247
|
+
- a bundled pack (`azure:`, `aws:`, `gcp:`, `tech:`, `bootstrap:`, `md:`);
|
|
248
|
+
- an absolute URL;
|
|
249
|
+
- `imageAliases` from the project's config — `"@": "../../.assets/images"` and
|
|
250
|
+
`icon @/azure/entra.svg` — with no change to the project;
|
|
251
|
+
- a path relative to the `.c4` file, inside or outside the project.
|
|
252
|
+
|
|
253
|
+
Local files are rendered by LikeC4 itself (SVGs inline) and also served at
|
|
254
|
+
`/_astroc4/<project>/<path>` — `@/azure/entra.svg` becomes
|
|
255
|
+
`/_astroc4/architecture/azure/entra.svg`, a named alias `@brand` adds a `brand/`
|
|
256
|
+
segment — and copied into the build output. Files under `public/` keep their
|
|
257
|
+
public URL. No `file://` path from the build machine reaches the bundle, and an
|
|
258
|
+
icon that does not exist fails the build. Nothing is written into your source
|
|
259
|
+
tree.
|
|
206
260
|
|
|
207
261
|
## Troubleshooting
|
|
208
262
|
|
|
@@ -215,7 +269,10 @@ architecture diagram…" — open the page in `astro dev`, or run
|
|
|
215
269
|
| --- | --- | --- |
|
|
216
270
|
| `The requested module '/node_modules/react/compiler-runtime.js' does not provide an export named 'c'` in the console, diagrams stuck on the loading placeholder | `likec4/react` (1.59.4 and later) is compiled with the React Compiler and imports `c` from React 19's CommonJS `react/compiler-runtime`; in dev Vite serves it unoptimized, so the island never mounts. Production builds bundle it, which is why the build still passes. | Fixed in `1.0.0-prerelease.5`: the plugin adds `react/compiler-runtime` to `vite.optimizeDeps.include`. On an older version, or to confirm by hand: `vite: { optimizeDeps: { include: ['react/compiler-runtime'] } }`. |
|
|
217
271
|
| Build fails with `could not fetch the LikeC4 grammar from https://raw.githubusercontent.com/…` | The grammar is resolved while the config loads, and the machine cannot reach GitHub. | `highlighting: { offline: true }` (bundled snapshot) or `onError: 'warn'`; `ASTROC4_OFFLINE=1` in CI. |
|
|
218
|
-
|
|
|
272
|
+
| Build fails with `Several LikeC4 projects exist (…); pass project="…"` | The site has more than one project (discovered or named) and a `<LikeC4View>` or fence names none. | Pass `project="<name>"`; the message lists the names. |
|
|
273
|
+
| Build fails with `two LikeC4 projects are named "…"` | A named project and a discovered one, or two folders, share a name or a config `name`. | Rename one, or name the configured project differently. |
|
|
274
|
+
| Build fails with `…likec4.config… could not be read` | The config does not parse (JSON5) or does not bundle (JS/TS). | Fix the error after the path; a JS/TS config's imports other than `likec4/config` must resolve from its folder. |
|
|
275
|
+
| A diagram shows "Unknown LikeC4 projectId" | Only on a site that sets `vitePlugin.workspace` itself, where astroc4 does not know the projects. | Pass a `project` the workspace contains. |
|
|
219
276
|
| `Cannot find module …/@purview-dev/astroc4/dist/index.js` | That version shipped without its build output (only `1.0.0-prerelease.3` did). | Move to `1.0.0-prerelease.4` or later. |
|
|
220
277
|
|
|
221
278
|
Everything else — highlighting that produces one colour, fences left as code,
|
|
@@ -228,12 +285,12 @@ Windows module-runner crashes — is in
|
|
|
228
285
|
bun install
|
|
229
286
|
bun run dev # Starlight playground at http://localhost:4321 (English + French)
|
|
230
287
|
bun run dev:astro # plain-Astro example at http://localhost:4322
|
|
231
|
-
bun run test # hermetic unit suite:
|
|
232
|
-
bun run test:network # the
|
|
288
|
+
bun run test # hermetic unit suite: config loading, grammar, fences, plugin
|
|
289
|
+
bun run test:network # the live check against likec4/likec4
|
|
233
290
|
bun run test:site # pack the tarball, install it into copies of playground/ and
|
|
234
291
|
# examples/astro/, build both, run the full smoke suite against
|
|
235
292
|
# the Starlight copy, and check the plain one hydrates
|
|
236
|
-
bun run check # astro check over playground/, examples/astro/ and src/
|
|
293
|
+
bun run check # astro check over playground/, examples/astro/ and src/, tsc over scripts/
|
|
237
294
|
bun run grammar:check # fail if the committed grammar snapshot is stale
|
|
238
295
|
bun run build && bun run preview
|
|
239
296
|
bun run build:astro # static build of the plain-Astro example
|
|
@@ -241,6 +298,8 @@ bun scripts/smoke.ts http://localhost:4321 # headless: hydration, icons, highl
|
|
|
241
298
|
bun scripts/hydration.ts http://localhost:4321 # headless: one diagram, nothing else
|
|
242
299
|
```
|
|
243
300
|
|
|
301
|
+
The source is TypeScript throughout, configs included (`astro.config.ts`), with
|
|
302
|
+
`.ts` relative imports; `bun run build:lib` bundles it into `dist/`.
|
|
244
303
|
`playground/` is the Starlight development site; `examples/astro/` is the
|
|
245
304
|
plain-Astro one, and `test:site` copies it so the checked-in example is what the
|
|
246
305
|
suite builds. Both import the package by name — Node's self-reference resolves
|
|
@@ -249,16 +308,17 @@ it from the repository, which *is* the package.
|
|
|
249
308
|
`test:site` and the two browser scripts need Chromium
|
|
250
309
|
(`bunx playwright install chromium`).
|
|
251
310
|
|
|
252
|
-
`Justfile` wraps each of those (`just verify` runs
|
|
253
|
-
`src/grammar/likec4.tmLanguage.json` and
|
|
254
|
-
generated — `bun run grammar:sync [--ref <tag>]`
|
|
255
|
-
and never by hand.
|
|
256
|
-
|
|
257
|
-
CI lives in `.github/workflows`: `pr.yml` runs the organisation gate
|
|
258
|
-
unit suite, the
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
release. See
|
|
311
|
+
`Justfile` wraps each of those (`just verify` runs the PR gate's chain plus
|
|
312
|
+
`test:site`). `src/grammar/likec4.tmLanguage.json` and
|
|
313
|
+
`src/grammar/like-c4.langium` are generated — `bun run grammar:sync [--ref <tag>]`
|
|
314
|
+
refreshes them from upstream, and never by hand.
|
|
315
|
+
|
|
316
|
+
CI lives in `.github/workflows`: `pr.yml` runs the organisation gate (grammar
|
|
317
|
+
snapshot, type-check, build, unit suite), the live grammar check, the browser
|
|
318
|
+
smoke test and the packed-consumer build; `release.yml` publishes to npm with
|
|
319
|
+
**trusted publishing** — an OIDC token, no stored npm secret — under the
|
|
320
|
+
`prerelease` dist-tag for prerelease versions, then tags the release. See
|
|
321
|
+
[`docs/wiki/contributing/Repository-CI-CD.md`](docs/wiki/contributing/Repository-CI-CD.md).
|
|
262
322
|
|
|
263
323
|
Open the folder in VS Code and install the recommended **LikeC4** extension
|
|
264
324
|
for the language server: diagnostics, go-to-definition, hover and a live
|
|
@@ -4,10 +4,6 @@ import { type GrammarSourceOptions } from './grammar/source.js';
|
|
|
4
4
|
export declare const likec4Language: LanguageRegistration & {
|
|
5
5
|
aliases: string[];
|
|
6
6
|
};
|
|
7
|
-
/**
|
|
8
|
-
* Resolve the grammar from likec4/likec4 at the ref you ask for and return it
|
|
9
|
-
* as a Shiki language registration.
|
|
10
|
-
*/
|
|
11
7
|
export declare function loadLikeC4Language(options?: GrammarSourceOptions): Promise<LanguageRegistration & {
|
|
12
8
|
aliases: string[];
|
|
13
9
|
}>;
|