@terrymooreii/sia 1.0.1 → 1.0.2
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/lib/parse.js +7 -1
- package/lib/readconfig.js +4 -2
- package/package.json +1 -1
- package/readme.md +20 -5
- package/.github/workflows/main.yml +0 -33
package/lib/parse.js
CHANGED
|
@@ -19,7 +19,13 @@ const render = (srcFolder, publicFolder, file) => {
|
|
|
19
19
|
const fileName = path.parse(file).name
|
|
20
20
|
const fileNameHtml = `${fileName}.html`
|
|
21
21
|
|
|
22
|
-
if
|
|
22
|
+
if(page.draft) {
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!page.template) {
|
|
27
|
+
throw new Error(`Missing template tag in ${file}`)
|
|
28
|
+
}
|
|
23
29
|
|
|
24
30
|
page.date = formatDate(page.created_at)
|
|
25
31
|
|
package/lib/readconfig.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { findUp } from 'find-up'
|
|
2
2
|
|
|
3
|
+
const configFile = '.siarc.js'
|
|
4
|
+
|
|
3
5
|
async function getConfig() {
|
|
4
6
|
try {
|
|
5
|
-
const siarc = await findUp(
|
|
7
|
+
const siarc = await findUp(configFile)
|
|
6
8
|
const { default: config } = await import(siarc)
|
|
7
9
|
return config
|
|
8
10
|
} catch (err) {
|
|
9
|
-
|
|
11
|
+
throw new Error(`Unable to find and load the ${configFile} file.`)
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
const config = await getConfig()
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Sia
|
|
1
|
+
# Sia blog
|
|
2
2
|
|
|
3
3
|
Sia is static site generator
|
|
4
4
|
|
|
@@ -16,9 +16,9 @@ sia init
|
|
|
16
16
|
|
|
17
17
|
This will install the nunjucks template files, some base css and a shell `index.html`
|
|
18
18
|
|
|
19
|
-
It also add the
|
|
19
|
+
It also add the `.siarc.js` config file to the root of your project.
|
|
20
20
|
|
|
21
|
-
The
|
|
21
|
+
The `.siarc.js` file contains two sections. One for configuing your site information. The second is to configure the app's folders, numjucks template, and markdown configutation.
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
## Adding pages and posts
|
|
@@ -56,6 +56,7 @@ description: Testing out some markdown
|
|
|
56
56
|
- `create_at` is the date of the post
|
|
57
57
|
- `description` a short description of the post
|
|
58
58
|
|
|
59
|
+
Not ready to publish a post? Add `draft: true`
|
|
59
60
|
|
|
60
61
|
## Build
|
|
61
62
|
|
|
@@ -70,7 +71,11 @@ The default output folder is `/public`
|
|
|
70
71
|
|
|
71
72
|
The build command will also copy all `assets`, `js` and `css` to the `/public` folder. If a post or a page folder contain other files other than markdown then those files will also get moved to the `/public/<folder>`. This makes it easy to organize a single page or posts with custom js, css, or images.
|
|
72
73
|
|
|
73
|
-
All markdown files will get parsed with `markdown-it` and you can add additional `markdown-it` plugins in the
|
|
74
|
+
All markdown files will get parsed with `markdown-it` and you can add additional `markdown-it` plugins in the `.siarc.js` file.
|
|
75
|
+
|
|
76
|
+
## Plugins
|
|
77
|
+
|
|
78
|
+
There are lots of plugins that you can use in sia to extend [markdown-it](https://github.com/markdown-it/markdown-it) and in turn sia. Just install the plugin, import itto your `.siarc.js` file and then add it to the `app.markdown.plugins` array.
|
|
74
79
|
|
|
75
80
|
## Local developement
|
|
76
81
|
|
|
@@ -90,7 +95,7 @@ Currently these are the apps that I use on my blog for local development and bui
|
|
|
90
95
|
npm install forever concurrently http-server
|
|
91
96
|
```
|
|
92
97
|
|
|
93
|
-
|
|
98
|
+
Coming soon will be a simple way to run a local web server to see live updates to posts and pages as you work via the `sia` command.
|
|
94
99
|
|
|
95
100
|
## Templates and site configuration
|
|
96
101
|
|
|
@@ -98,3 +103,13 @@ All `njk` files are in a simple default state to generate a simple and clean web
|
|
|
98
103
|
|
|
99
104
|
If you make something cool please let me know.
|
|
100
105
|
|
|
106
|
+
|
|
107
|
+
## Todo
|
|
108
|
+
|
|
109
|
+
This is a list of items that still need to be tackled
|
|
110
|
+
|
|
111
|
+
[ ] Better error handling
|
|
112
|
+
[ ] Pagination
|
|
113
|
+
[ ] `sia init` to generate a new site and clean up of the initial theme
|
|
114
|
+
[ ] While pages and longer blog posts are great, i would like to add a mircoblogging feed to the site.
|
|
115
|
+
[ ] Github action to publish new version to npm
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
name: Build and GH-Page Deploy
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: write
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
build:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
|
|
15
|
-
steps:
|
|
16
|
-
- name: Checkout
|
|
17
|
-
uses: actions/checkout@v3
|
|
18
|
-
with:
|
|
19
|
-
persist-credentials: false
|
|
20
|
-
|
|
21
|
-
- name: Install
|
|
22
|
-
run: npm install
|
|
23
|
-
|
|
24
|
-
- name: Build
|
|
25
|
-
run: |
|
|
26
|
-
npm run build
|
|
27
|
-
|
|
28
|
-
- name: Deploy to GH Page
|
|
29
|
-
uses: JamesIves/github-pages-deploy-action@4.1.1
|
|
30
|
-
with:
|
|
31
|
-
branch: gh-pages
|
|
32
|
-
folder: public
|
|
33
|
-
ssh-key: ${{ secrets.DEPLOY_KEY }}
|