You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/docs/reference/appendix.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,27 @@
1
1
---
2
2
layout: docs
3
-
order: 5
3
+
order: 4
4
4
tocHeading: 2
5
5
---
6
6
7
7
# Appendix
8
8
9
+
## Types
10
+
11
+
In addition to [supporting TypeScript](/docs/resources/typescript/) out of the box, Greenwood also exports a number of useful types that you can use if authoring your configuration files, plugins, etc as TypeScript. You can find all available types for the CLI [here](https://github.com/ProjectEvergreen/greenwood/blob/master/packages/cli/src/types/index.d.ts) including types for configuration, content as data APIs, graph and compilation objects, plugins, and more. Each of Greenwood's plugin will also provide their own set of types within their package at _src/types/index.d.ts_.
12
+
13
+
For example, here is how to author a TypeScript based configuration file:
14
+
15
+
```ts
16
+
importtype { Config } from"@greenwood/cli";
17
+
18
+
const config:Config= {
19
+
prerender: true,
20
+
};
21
+
22
+
exportdefaultconfig;
23
+
```
24
+
9
25
## Build Output
10
26
11
27
Greenwood produces a consistent build output that typically mirrors the source directory as it persists all file naming, albeit with hashes included. For static content, this can be used by static hosting sites with no additional configuration, on serverless hosting with our adapters, or self-hosted.
@@ -88,7 +104,7 @@ It is fine-tuned for creating Light and Shadow DOM based custom elements. The fu
88
104
-`customElements.define`
89
105
-`attachShadow`
90
106
-`innerHTML`
91
-
-`[get|set|has]Attribute`
107
+
-`[get|set|has]Attribute`
92
108
-`<template>` / DocumentFragment
93
109
-`addEventListener` (as a no-op)
94
110
-`CSSStyleSheet` (all methods act as no-ops on the server)
@@ -93,7 +96,7 @@ An adapter plugin is simply an `async` function that gets invoked by the Greenwo
93
96
94
97
### Example
95
98
96
-
The most common use case is to "shim" in a hosting platform handler function in front of Greenwood's, which is based on two parameters of `Request` / `Response`. In addition, producing any hosting provided specific metadata is also doable at this stage.
99
+
The most common use case is to "shim" in a hosting platform handler function in front of Greenwood's, which is based on standard `Request` / `Response` objects. In addition, producing any hosting provided specific metadata is also doable at this stage.
97
100
98
101
Here is an example of the "generic adapter" created for Greenwood's own internal test suite.
99
102
@@ -224,6 +227,7 @@ Your plugin might look like this:
0 commit comments