@nera-static/nera 1.13.0 → 1.14.1

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
@@ -36,12 +36,16 @@ package is named after the folder (`My Bakery` → `my-bakery`).
36
36
  | `nera check` | Check the built `public/` for accessibility, privacy and legal-notice problems (see below). Build first. `--json` for machine-readable output. |
37
37
 
38
38
  A scaffolded site is a thin project — no vendored engine, no clone. It lists one
39
- dependency and its scripts call the CLI:
39
+ dependency, a caret range starting at the version of the CLI that created it,
40
+ and its scripts call the CLI:
40
41
 
41
42
  ```jsonc
42
43
  {
43
- "scripts": { "dev": "nera dev", "build": "nera build", "serve": "nera serve" },
44
- "dependencies": { "@nera-static/nera": "^1.0.0" }
44
+ "scripts": {
45
+ "dev": "nera dev", "build": "nera build", "serve": "nera serve",
46
+ "validate": "nera validate", "check": "nera build --check"
47
+ },
48
+ "dependencies": { "@nera-static/nera": "^1.14.1" }
45
49
  }
46
50
  ```
47
51
 
@@ -130,7 +134,7 @@ depends on still updates through npm).
130
134
  `--starter` takes:
131
135
 
132
136
  - a starter name: `blank` → `@nera-static/starter-blank`, `blog` →
133
- `@nera-static/starter-blog`;
137
+ `@nera-static/starter-blog`, `business` → `@nera-static/starter-business`;
134
138
  - a package name: `@acme/starter-shop`, or unscoped `nera-starter-shop`;
135
139
  - a GitHub URL: `https://github.com/owner/repo` (optionally `.git`, `#ref`),
136
140
  or `github:owner/repo#ref`;
@@ -162,8 +166,11 @@ default. Every question has a flag (`--starter`, `--name`, `--lang`); with
162
166
  `nera new` scaffolds the base template.
163
167
 
164
168
  The official starters: `blank` (`@nera-static/starter-blank`, one accessible
165
- layout, no theme) and `blog` (`@nera-static/starter-blog`, a blog on
166
- `@nera-static/theme-blog` with tags, an archive, an Atom feed and a sitemap).
169
+ layout, no theme), `blog` (`@nera-static/starter-blog`, a blog on
170
+ `@nera-static/theme-blog` with tags, an archive, an Atom feed and a sitemap)
171
+ and `business` (`@nera-static/starter-business`, a small-business site on
172
+ `@nera-static/theme-business` with services, opening hours and a contact
173
+ form).
167
174
 
168
175
  ## Checking the built site
169
176
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nera-static/nera",
3
- "version": "1.13.0",
3
+ "version": "1.14.1",
4
4
  "description": "The Nera CLI — scaffold, build, preview and update a Nera static site with one command over the @nera-static/core engine",
5
5
  "type": "module",
6
6
  "bin": {
@@ -3,7 +3,7 @@ import fs from 'fs/promises'
3
3
  import fssync from 'fs'
4
4
  import path from 'path'
5
5
  import { syncAgentFiles, SITE_NOTES_MARKER } from '../agent-files.js'
6
- import { templateDir as packageTemplateDir } from '../scaffold.js'
6
+ import { ownRange, templateDir as packageTemplateDir } from '../scaffold.js'
7
7
  import { installedSkillDir, skillSourceDir, syncSkill } from '../skill.js'
8
8
 
9
9
  const defaultRunNpm = (npmArgs, cwd) =>
@@ -107,7 +107,7 @@ async function migrateLegacy(cwd, pkg, runNpm, templateDir, skillDir) {
107
107
 
108
108
  pkg.dependencies = {
109
109
  ...pkg.dependencies,
110
- '@nera-static/nera': '^1.0.0',
110
+ '@nera-static/nera': ownRange(),
111
111
  }
112
112
 
113
113
  pkg.scripts = {
package/src/scaffold.js CHANGED
@@ -138,6 +138,14 @@ const isStarterTemplate = async (file) =>
138
138
  export const templateDir = () =>
139
139
  path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'template')
140
140
 
141
+ // The range a new or migrated site depends on: this CLI's own version, so the
142
+ // site never claims to work with an older one that lacks what set it up
143
+ // (starters, `nera check`, the `validate`/`check` scripts).
144
+ export const ownRange = () => {
145
+ const pkgPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'package.json')
146
+ return `^${JSON.parse(fssync.readFileSync(pkgPath, 'utf-8')).version}`
147
+ }
148
+
141
149
  async function copyDir(src, dest, { skipStarters = false } = {}) {
142
150
  await fs.mkdir(dest, { recursive: true })
143
151
  for (const entry of await fs.readdir(src, { withFileTypes: true })) {
@@ -165,6 +173,7 @@ async function personalize(targetDir, projectName) {
165
173
  const pkgPath = path.join(targetDir, 'package.json')
166
174
  const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf-8'))
167
175
  pkg.name = projectName
176
+ pkg.dependencies = { ...pkg.dependencies, '@nera-static/nera': ownRange() }
168
177
  await fs.writeFile(pkgPath, `${JSON.stringify(pkg, null, 4)}\n`)
169
178
  console.log(` ✓ Configured project as "${projectName}"`)
170
179
  }
package/src/starters.js CHANGED
@@ -15,4 +15,10 @@ export const BUNDLED_STARTERS = [
15
15
  label: 'Blog',
16
16
  description: 'A ready-to-edit Nera blog on @nera-static/theme-blog: three sample posts, tags, an archive by year, prev/next, an Atom feed, a sitemap, code blocks, navigation, responsive images, social links and imprint and privacy placeholders. No JavaScript.',
17
17
  },
18
+ {
19
+ name: 'business',
20
+ package: '@nera-static/starter-business',
21
+ label: 'Business',
22
+ description: 'A ready-to-edit Nera site for a small business on @nera-static/theme-business: home, about, services, opening hours, a contact form, navigation, responsive images, social links, a sitemap and imprint and privacy placeholders. One small script for the contact form.',
23
+ },
18
24
  ]