mothwing 0.0.1 → 0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mothwing",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A small static site builder for pages as light as a moth's wing",
5
5
  "keywords": [
6
6
  "static-site-generator",
package/src/site.js CHANGED
@@ -28,13 +28,15 @@ function lastModified(site, cache, files) {
28
28
  }
29
29
 
30
30
  /**
31
- * Writes CNAME, the sitemaps and robots.txt.
31
+ * Writes the CNAME, sitemaps and robots.txt, those the config turned on.
32
32
  * @param {import("./config.js").Site} site
33
33
  * @param {import("./routes.js").Route[]} routes
34
34
  * @param {boolean} [dated] Add each page's lastmod, from git, which takes a moment
35
35
  */
36
36
  export async function writeSiteFiles(site, routes, dated = true) {
37
- log("SITE", "Writing CNAME, the sitemaps and robots.txt")
37
+ const files = [site.cname && "CNAME", site.sitemap && "the sitemaps", site.robots && "robots.txt"].filter(Boolean)
38
+ if (!files.length) return
39
+ log("SITE", `Writing ${files.length > 1 ? `${files.slice(0, -1).join(", ")} and ${files.at(-1)}` : files[0]}`)
38
40
 
39
41
  // Every GitHub Pages deploy wipes the branch, so the custom domain has to be written each time
40
42
  if (site.cname) fs.writeFileSync(path.join(site.out, "CNAME"), site.domain + "\n")
@@ -92,5 +94,5 @@ export async function writeSiteFiles(site, routes, dated = true) {
92
94
  ].join("\n"))
93
95
  }
94
96
 
95
- log("SITE", `Done, ${[...sitemaps.values()].flat().length} pages in the sitemap`)
97
+ log("SITE", site.sitemap ? `Done, ${[...sitemaps.values()].flat().length} pages in the sitemap` : "Done")
96
98
  }
package/types/site.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Writes CNAME, the sitemaps and robots.txt.
2
+ * Writes the CNAME, sitemaps and robots.txt, those the config turned on.
3
3
  * @param {import("./config.js").Site} site
4
4
  * @param {import("./routes.js").Route[]} routes
5
5
  * @param {boolean} [dated] Add each page's lastmod, from git, which takes a moment