fossbook 0.2.14 → 0.2.15

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 CHANGED
@@ -85,10 +85,17 @@ This also creates `index.ko.md` and `index.ja.md` in the same post directory. Ru
85
85
  fossbook build
86
86
  ```
87
87
 
88
+ Posts with `draft: true` in their front matter are excluded from generated
89
+ post pages, home pages, archives, and tags. To include them in a local build:
90
+
91
+ ```bash
92
+ fossbook build --include-drafts
93
+ ```
94
+
88
95
  ### Preview locally
89
96
 
90
97
  ```bash
91
- fossbook serve
98
+ fossbook serve --include-drafts
92
99
  ```
93
100
 
94
101
  Open http://localhost:3000 to view your site.
@@ -204,11 +211,16 @@ date: 2026-02-17
204
211
  description: "A brief summary of the post"
205
212
  image: "feature.png"
206
213
  tags: "JavaScript, Node.js, Static Site"
214
+ draft: false
207
215
  ---
208
216
 
209
217
  Your Markdown content here...
210
218
  ```
211
219
 
220
+ Set `draft: true` while a post is in progress. Normal builds and deployments
221
+ exclude it. Use `fossbook serve --include-drafts` to preview drafts locally,
222
+ then remove the field or set it to `false` before publishing.
223
+
212
224
  ### Directory structure
213
225
 
214
226
  ```
package/bin/fossbook.js CHANGED
@@ -24,6 +24,7 @@ Options:
24
24
  --clean Remove output directory before build (default: true)
25
25
  --github (init) Also create a GitHub repo and push
26
26
  --lang (new) Comma-separated translation languages, e.g. ko,ja
27
+ --include-drafts (build, serve) Include posts with draft: true
27
28
  -m, --message (deploy) Custom commit message
28
29
  --no-wait (deploy) Push without waiting for CI status
29
30
  --draft (deploy) Commit locally without pushing
@@ -64,6 +65,7 @@ switch (command) {
64
65
  const config = loadConfig(configPath);
65
66
  const outputOverride = getOption("-o", "--output");
66
67
  if (outputOverride) config.dev.outdir = outputOverride;
68
+ config.includeDrafts = hasFlag("--include-drafts");
67
69
 
68
70
  const { build } = require("../lib/index");
69
71
  build(config);
@@ -74,6 +76,7 @@ switch (command) {
74
76
  const config = loadConfig(configPath);
75
77
  const outputOverride = getOption("-o", "--output");
76
78
  if (outputOverride) config.dev.outdir = outputOverride;
79
+ config.includeDrafts = hasFlag("--include-drafts");
77
80
  const port = getOption("-p", "--port") || 3000;
78
81
 
79
82
  const { build } = require("../lib/index");
package/lib/deploy.js CHANGED
@@ -14,6 +14,7 @@ async function deploy(config, options = {}) {
14
14
 
15
15
  // 1. Build the site
16
16
  console.log("Building site...");
17
+ config.includeDrafts = false;
17
18
  build(config);
18
19
  console.log("Build complete.\n");
19
20
 
package/lib/index.js CHANGED
@@ -38,7 +38,12 @@ function createPostTranslationIndex(languageConfigs) {
38
38
  const sourceFile = config.language === config.defaultLanguage
39
39
  ? "index.md"
40
40
  : `index.${config.language}.md`;
41
- if (!fs.existsSync(path.join(postsDir, entry.name, sourceFile))) continue;
41
+ const sourcePath = path.join(postsDir, entry.name, sourceFile);
42
+ if (!fs.existsSync(sourcePath)) continue;
43
+
44
+ const post = new Page(config);
45
+ post.readSource(sourcePath, entry.name);
46
+ if (post.draft && !config.includeDrafts) continue;
42
47
 
43
48
  const prefix = config.postsPath ? `${config.postsPath}/` : "";
44
49
  translations.push({
@@ -163,6 +168,9 @@ function build(config) {
163
168
  fs.mkdirSync(config.dev.outdir, { recursive: true });
164
169
 
165
170
  const languageConfigs = config.languageConfigs || [config];
171
+ languageConfigs.forEach((languageConfig) => {
172
+ languageConfig.includeDrafts = config.includeDrafts === true;
173
+ });
166
174
  const postTranslationIndex = createPostTranslationIndex(languageConfigs);
167
175
  const aboutTranslations = createAboutTranslations(languageConfigs);
168
176
  const homeTranslations = createHomeTranslations(languageConfigs);
package/lib/mod/page.js CHANGED
@@ -39,6 +39,7 @@ module.exports = class Page extends PageBase {
39
39
  this.url = `${this.config.blogsite}/${this.path}/`;
40
40
  this.image = content.attributes.image;
41
41
  this.description = content.attributes.description;
42
+ this.draft = content.attributes.draft === true;
42
43
  // default image if no imageURL is specified
43
44
  this.imageURL = this.config.image;
44
45
 
package/lib/posts.js CHANGED
@@ -26,6 +26,7 @@ module.exports = class Posts {
26
26
  }
27
27
  const post = new Page(this.config);
28
28
  post.readSource(indexPath, postPath);
29
+ if (post.draft && !this.config.includeDrafts) return;
29
30
  // Optionally nest posts under a URL prefix (e.g. "posts" -> /posts/<slug>/).
30
31
  // post.slug stays the source folder name so image lookups remain correct.
31
32
  const prefix = this.config.postsPath ? `${this.config.postsPath}/` : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fossbook",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "description": "A Markdown-based authoring and web-publishing tool for comics, illustrated stories, and articles",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {