Skip to content

Commit 8f16dd2

Browse files
committed
initial commit
0 parents  commit 8f16dd2

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
out

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# `generator-hello-world`
2+
3+
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.
4+
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`.
6+
7+
A template repository that references this generator can be found at: https://github.com/from-static/template-hello-world.
8+
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.

index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const fs = require('fs');
2+
3+
console.log('@from-static/generator-hello-world: Configuring "out" directory.')
4+
fs.rmSync('./out', { recursive: true });
5+
fs.mkdirSync('./out');
6+
7+
let _STATIC = {};
8+
9+
try {
10+
console.log('@from-static/generator-hello-world: Reading "static.json" file.')
11+
_STATIC = require('./static.json');
12+
} catch (e) {
13+
console.log('@from-static/generator-hello-world: Error reading "static.json" file.');
14+
}
15+
16+
fs.writeFileSync('./out/index.html', _STATIC?.data?.message || '');
17+
18+
console.log('@from-static/generator-hello-world: Done!')

package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "@from-static/generator-hello-world",
3+
"version": "1.0.0",
4+
"description": "An example generator for use in the static Application Design Approach",
5+
"scripts": {
6+
"build": "node index.js"
7+
},
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/from-static/generator-hello-world.git"
11+
},
12+
"author": "Joe Bottigliero",
13+
"license": "MIT",
14+
"bugs": {
15+
"url": "https://github.com/from-static/generator-hello-world/issues"
16+
},
17+
"homepage": "https://github.com/from-static/generator-hello-world#readme"
18+
}

0 commit comments

Comments
 (0)