Skip to content

Commit adedde0

Browse files
committed
chore: release 1.0.3
1 parent efa0dbe commit adedde0

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,25 @@
22

33
This is a basic example of a `generator` in the static Application Design Approach. A `generator` (static site generator) processes a `static.json` file and produces a static web page or dynamic web application.
44

5-
By referencing this `generator` in a `static.json` file and providing a `data.message` value, the `generator` will produce a static web page with the provided `data.message`.
5+
By referencing this `generator` in a `static.json` file and providing a `data.attributes.message` value, the `generator` will produce a static web page with the provided `data.attributes.message`.
66

77
A template repository that references this generator can be found at: https://github.com/from-static/template-hello-world.
88

9-
This template repository can be used to create custom distributions of the generator on GitHub Pages by only modifying the `data.message` value in the `static.json` file.
9+
This template repository can be used to create custom distributions of the generator on GitHub Pages by only modifying the `data.attributes.message` value in the `static.json` file.
10+
11+
## Example `static.json` File
12+
13+
```json
14+
{
15+
"_static": {
16+
"generator": {
17+
"name": "@from-static/generator-hello-world"
18+
}
19+
},
20+
"data": {
21+
"attributes": {
22+
"message": "Hello, @from-static!"
23+
}
24+
}
25+
}
26+
```

index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
const fs = require('fs');
22

33
console.log('@from-static/generator-hello-world: Configuring "out" directory.')
4-
fs.rmSync('./out', { recursive: true });
4+
try {
5+
fs.rmSync('./out', { recursive: true });
6+
} catch (_e) {}
7+
58
fs.mkdirSync('./out');
69

710
let _STATIC = {};
@@ -13,6 +16,6 @@ try {
1316
console.log('@from-static/generator-hello-world: Error reading "static.json" file.');
1417
}
1518

16-
fs.writeFileSync('./out/index.html', _STATIC?.data?.message || '');
19+
fs.writeFileSync('./out/index.html', _STATIC?.data?.attributes?.message || '');
1720

1821
console.log('@from-static/generator-hello-world: Done!')

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@from-static/generator-hello-world",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "An example generator for use in the static Application Design Approach",
55
"scripts": {
66
"build": "node index.js"

0 commit comments

Comments
 (0)