@slybridges/kiss 0.5.2 → 0.5.6
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 +1 -1
- package/package.json +13 -13
- package/src/config/defaultConfig.js +6 -2
- package/src/data/computeTitle.js +6 -2
- package/src/data/computeURL.js +3 -0
- package/src/libs/loadMarked.js +1 -1
- package/src/loaders/index.js +2 -0
- package/src/loaders/jsonLoader.js +17 -0
- package/src/writers/sitemapContextWriter.js +1 -1
- package/clean.sh +0 -2
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slybridges/kiss",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "Keep It Simple and Static site generator",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -12,24 +12,24 @@
|
|
|
12
12
|
"author": "Sylvestre Dupont",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"browser-sync": "^2.
|
|
16
|
-
"chalk": "^4.1.
|
|
17
|
-
"cheerio": "^1.0.0-rc.
|
|
18
|
-
"chokidar": "^3.5.
|
|
19
|
-
"date-fns": "^2.
|
|
20
|
-
"fast-glob": "^3.2.
|
|
15
|
+
"browser-sync": "^2.27.7",
|
|
16
|
+
"chalk": "^4.1.2",
|
|
17
|
+
"cheerio": "^1.0.0-rc.10",
|
|
18
|
+
"chokidar": "^3.5.2",
|
|
19
|
+
"date-fns": "^2.27.0",
|
|
20
|
+
"fast-glob": "^3.2.7",
|
|
21
21
|
"front-matter": "^4.0.2",
|
|
22
|
-
"fs-extra": "^
|
|
22
|
+
"fs-extra": "^10.0.0",
|
|
23
23
|
"lodash": "^4.17.21",
|
|
24
|
-
"marked": "^
|
|
24
|
+
"marked": "^4.0.6",
|
|
25
25
|
"nunjucks": "^3.2.3",
|
|
26
|
-
"sharp": "^0.
|
|
27
|
-
"slugify": "^1.
|
|
26
|
+
"sharp": "^0.29.3",
|
|
27
|
+
"slugify": "^1.6.3",
|
|
28
28
|
"xml": "^1.0.1",
|
|
29
|
-
"yargs": "^
|
|
29
|
+
"yargs": "^17.3.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"eslint": "^
|
|
32
|
+
"eslint": "^8.3.0"
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|
|
@@ -8,6 +8,7 @@ const {
|
|
|
8
8
|
} = require("../libs")
|
|
9
9
|
const {
|
|
10
10
|
jsLoader,
|
|
11
|
+
jsonLoader,
|
|
11
12
|
markdownLoader,
|
|
12
13
|
staticLoader,
|
|
13
14
|
textLoader,
|
|
@@ -112,6 +113,7 @@ const defaultConfig = {
|
|
|
112
113
|
libs: {},
|
|
113
114
|
loaders: [
|
|
114
115
|
{ handler: jsLoader, namespace: "jsLoader" },
|
|
116
|
+
{ handler: jsonLoader, namespace: "jsonLoader" },
|
|
115
117
|
{ handler: markdownLoader, namespace: "markdownLoader" },
|
|
116
118
|
{ handler: staticLoader, namespace: "staticLoader" },
|
|
117
119
|
{ handler: textLoader, namespace: "textLoader" },
|
|
@@ -145,6 +147,7 @@ const defaultConfig = {
|
|
|
145
147
|
],
|
|
146
148
|
// Namespaced options
|
|
147
149
|
jsLoader: { match: ["**/*.js"] },
|
|
150
|
+
jsonLoader: { match: ["**/*.json"] },
|
|
148
151
|
markdownLoader: { match: ["**/*.md"] },
|
|
149
152
|
textLoader: { match: ["**/*.html"] },
|
|
150
153
|
staticLoader: {
|
|
@@ -171,7 +174,8 @@ const defaultConfig = {
|
|
|
171
174
|
rss: {
|
|
172
175
|
active: true,
|
|
173
176
|
target: "feed.xml",
|
|
174
|
-
pageFilter: (page) =>
|
|
177
|
+
pageFilter: (page) =>
|
|
178
|
+
page.url && page._meta.isPost && !page.excludeFromCollection,
|
|
175
179
|
xmlOptions: {
|
|
176
180
|
declaration: true,
|
|
177
181
|
indent: env === "production" ? null : " ",
|
|
@@ -196,7 +200,7 @@ const defaultConfig = {
|
|
|
196
200
|
collection: 0.5,
|
|
197
201
|
},
|
|
198
202
|
target: "sitemap.xml",
|
|
199
|
-
pageFilter: (page) => page._meta.outputType === "HTML",
|
|
203
|
+
pageFilter: (page) => page.url && page._meta.outputType === "HTML",
|
|
200
204
|
xmlOptions: {
|
|
201
205
|
declaration: true,
|
|
202
206
|
indent: env === "production" ? null : " ",
|
package/src/data/computeTitle.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// Super basic computation, you probably want to set the title manually
|
|
2
2
|
// or do something smarter according to your context
|
|
3
|
-
const computeTitle = ({ permalink }, config) =>
|
|
4
|
-
|
|
3
|
+
const computeTitle = ({ permalink }, config) => {
|
|
4
|
+
if (!permalink) {
|
|
5
|
+
return null
|
|
6
|
+
}
|
|
7
|
+
return config.libs.unslugify(permalink, { slash: " | " })
|
|
8
|
+
}
|
|
5
9
|
|
|
6
10
|
computeTitle.kissDependencies = ["permalink"]
|
|
7
11
|
|
package/src/data/computeURL.js
CHANGED
package/src/libs/loadMarked.js
CHANGED
package/src/loaders/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const baseLoader = require("./baseLoader")
|
|
2
2
|
const computeCollectionLoader = require("./computeCollectionLoader")
|
|
3
3
|
const jsLoader = require("./jsLoader")
|
|
4
|
+
const jsonLoader = require("./jsonLoader")
|
|
4
5
|
const markdownLoader = require("./markdownLoader")
|
|
5
6
|
const staticLoader = require("./staticLoader")
|
|
6
7
|
const textLoader = require("./textLoader")
|
|
@@ -9,6 +10,7 @@ module.exports = {
|
|
|
9
10
|
baseLoader,
|
|
10
11
|
computeCollectionLoader,
|
|
11
12
|
jsLoader,
|
|
13
|
+
jsonLoader,
|
|
12
14
|
markdownLoader,
|
|
13
15
|
staticLoader,
|
|
14
16
|
textLoader,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { parseISO } = require("date-fns")
|
|
2
|
+
const { readJsonSync } = require("fs-extra")
|
|
3
|
+
|
|
4
|
+
const jsonLoader = (path, options, page, pages, config) => {
|
|
5
|
+
let fileData = readJsonSync(path)
|
|
6
|
+
const published = fileData[config.defaults.pagePublishedAttribute]
|
|
7
|
+
const updated = fileData[config.defaults.pageUpdatedAttribute]
|
|
8
|
+
if (published && typeof published === "string") {
|
|
9
|
+
fileData[config.defaults.pagePublishedAttribut] = parseISO(published)
|
|
10
|
+
}
|
|
11
|
+
if (updated && typeof updated === "string") {
|
|
12
|
+
fileData[config.defaults.pageUpdatedAttribute] = parseISO(updated)
|
|
13
|
+
}
|
|
14
|
+
return { ...page, ...fileData }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = jsonLoader
|
package/clean.sh
DELETED