@nera-static/core 4.15.1 → 4.16.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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # @nera-static/core – the Nera engine
2
2
 
3
3
  [![Test](https://github.com/seebaermichi/nera/actions/workflows/test.yml/badge.svg)](https://github.com/seebaermichi/nera/actions/workflows/test.yml)
4
+ [![npm version](https://img.shields.io/npm/v/@nera-static/core)](https://www.npmjs.com/package/@nera-static/core)
4
5
 
5
6
  **`@nera-static/core`** is the engine behind [Nera](https://github.com/seebaermichi/nera-cli): the four-stage build pipeline that turns Markdown + [Pug](https://pugjs.org/) into static HTML, plus the layered theme/view resolver. It is an **importable library**, consumed by the [`@nera-static/nera`](https://www.npmjs.com/package/@nera-static/nera) CLI, by [`@nera-static/validate`](https://www.npmjs.com/package/@nera-static/validate), and by other tooling.
6
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nera-static/core",
3
- "version": "4.15.1",
3
+ "version": "4.16.0",
4
4
  "description": "The Nera static site generator engine — the build pipeline and the layered theme/view resolver, importable by the Nera CLI, @nera-static/validate and tooling",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
package/src/core.js CHANGED
@@ -96,11 +96,16 @@ export const computeFolders = (
96
96
  }
97
97
 
98
98
  const themeFolderExists = fs.existsSync(path.join(cwd, 'theme'))
99
+ // A site that names a theme package but has no presentation of its own —
100
+ // neither `theme/` nor a legacy root `views/` — takes the theme layout too:
101
+ // the theme supplies every view, and a later override lands in `theme/`.
102
+ const themeOnly =
103
+ Boolean(appConfig.theme) && !fs.existsSync(path.join(cwd, 'views'))
99
104
  const usesDefault = (key) =>
100
105
  folders[key] === defaultSettings.folders[key] &&
101
106
  appConfig.folders?.[key] === undefined
102
107
 
103
- if (themeFolderExists) {
108
+ if (themeFolderExists || themeOnly) {
104
109
  if (usesDefault('views')) folders.views = './theme/views'
105
110
  if (usesDefault('assets')) folders.assets = './theme/assets'
106
111
  } else if (warn && usesDefault('views')) {
package/src/render.js CHANGED
@@ -449,7 +449,9 @@ export const createHtmlFiles = async (
449
449
  publicFolder,
450
450
  theme = null
451
451
  ) => {
452
- if (fssync.existsSync(viewsFolder)) {
452
+ // With a theme the site's own views folder is optional: the theme supplies
453
+ // every layout, and the resolver falls through a missing site root.
454
+ if (theme || fssync.existsSync(viewsFolder)) {
453
455
  // No theme → single root, no resolve hook: byte-identical to before.
454
456
  const roots = theme ? [viewsFolder, theme.viewsRoot] : [viewsFolder]
455
457
  const resolver = theme ? makeLayeredResolver(roots) : null