@nera-static/nera 1.14.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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nera-static/nera",
3
- "version": "1.14.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
  }