@changke/staticnext-build 0.4.7 → 0.5.0

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/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 0.5.0
8
+ 2024-01-31
9
+ ### Added
10
+ - Output MD file content separately for generating full-text RSS
11
+ ### Changed
12
+ - Updated `esbuild` to v0.20.0
13
+
14
+ ## 0.4.8
15
+ 2024-01-27
16
+ ### Changed
17
+ - Updated `esbuild` to v0.19.12
18
+
7
19
  ## 0.4.7
8
20
  2023-12-30
9
21
  ### Changed
@@ -55,7 +55,7 @@ const markdown = (mdSourcePathRoot, njkPaths, njkGlobals, mdTargetPath) => {
55
55
  for (const [k, v] of Object.entries(njkGlobals)) {
56
56
  njkEnv.addGlobal(k, v);
57
57
  }
58
- docs.forEach(async (doc) => {
58
+ return Promise.all(docs.map(async (doc) => {
59
59
  const mdContent = await readFile(doc, {encoding: 'utf8'});
60
60
  const html = marked.parse(mdContent);
61
61
  const pageTitle = getPageTitle(mdContent);
@@ -71,7 +71,17 @@ const markdown = (mdSourcePathRoot, njkPaths, njkGlobals, mdTargetPath) => {
71
71
  'html'
72
72
  );
73
73
  await createAndWriteToFile(target, res);
74
- });
74
+ // create a content-only file for RSS generating
75
+ const feedRes = njkEnv.renderString(html);
76
+ const feedTarget = getTargetPathString(
77
+ doc,
78
+ mdSourcePathRoot,
79
+ mdTargetPath,
80
+ 'md',
81
+ 'txt'
82
+ );
83
+ await createAndWriteToFile(feedTarget, feedRes);
84
+ }));
75
85
  });
76
86
  };
77
87
 
@@ -22,7 +22,7 @@ const prototype = (prototypeSourcePathRoot, njkPaths, njkGlobals, prototypeTarge
22
22
  for (const [k, v] of Object.entries(njkGlobals)) {
23
23
  njkEnv.addGlobal(k, v);
24
24
  }
25
- pages.forEach(async (page) => {
25
+ return Promise.all(pages.map(async (page) => {
26
26
  const pageContent = await readFile(page, {encoding: 'utf8'});
27
27
  const res = njkEnv.renderString(pageContent);
28
28
  const targetFile = getTargetPathString(
@@ -33,7 +33,7 @@ const prototype = (prototypeSourcePathRoot, njkPaths, njkGlobals, prototypeTarge
33
33
  page.endsWith('rss/index.njk') ? 'xml' : 'html' // special case for RSS
34
34
  );
35
35
  await createAndWriteToFile(targetFile, res);
36
- });
36
+ }));
37
37
  });
38
38
  };
39
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@changke/staticnext-build",
3
- "version": "0.4.7",
3
+ "version": "0.5.0",
4
4
  "description": "Build scripts extracted from StaticNext seed project",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,10 +25,10 @@
25
25
  "dependencies": {
26
26
  "cpy": "^11.0.0",
27
27
  "del": "^7.1.0",
28
- "esbuild": "^0.19.11",
28
+ "esbuild": "^0.20.0",
29
29
  "globby": "^14.0.0",
30
30
  "highlight.js": "^11.9.0",
31
- "marked": "^11.1.0",
31
+ "marked": "^11.2.0",
32
32
  "marked-highlight": "^2.1.0",
33
33
  "marked-xhtml": "^1.0.8",
34
34
  "nunjucks": "^3.2.4"