@tanagram/lore 0.1.67 → 0.1.69

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": "@tanagram/lore",
3
- "version": "0.1.67",
3
+ "version": "0.1.69",
4
4
  "description": "Lore CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,11 +9,15 @@
9
9
  "files": [
10
10
  "dist",
11
11
  "skills",
12
+ "scripts/nodeVersionGuard.mjs",
12
13
  "scripts/runPostinstallCommand.mjs"
13
14
  ],
14
15
  "publishConfig": {
15
16
  "access": "public"
16
17
  },
18
+ "engines": {
19
+ "node": ">=20"
20
+ },
17
21
  "devDependencies": {
18
22
  "@biomejs/biome": "^1.9.4",
19
23
  "@sentry/esbuild-plugin": "^5.2.1",
@@ -24,8 +28,8 @@
24
28
  "ink-testing-library": "^4.0.0",
25
29
  "tsx": "^4.20.6",
26
30
  "typescript": "^5.9.3",
27
- "@lore/transcripts": "0.1.0",
28
- "@lore/contracts": "0.1.0"
31
+ "@lore/contracts": "0.1.0",
32
+ "@lore/transcripts": "0.1.0"
29
33
  },
30
34
  "dependencies": {
31
35
  "@sentry/node": "^10.47.0",
@@ -0,0 +1,27 @@
1
+ // Shared by the runtime CLI guard (src/lib/requireNode20.ts) and the
2
+ // postinstall shim (scripts/runPostinstallCommand.mjs). Kept as `.mjs`
3
+ // so the postinstall script — which runs plain Node, no bundler — can
4
+ // import it directly; esbuild bundles it into the CLI for the runtime
5
+ // guard.
6
+ //
7
+ // The minimum is driven by Ink 6 and its transitive deps (notably
8
+ // string-width 8), which use the RegExp `v` (unicodeSets) flag at
9
+ // module init. That flag requires Node >= 20; on Node 18 the module
10
+ // crashes with `SyntaxError: Invalid flags supplied to RegExp
11
+ // constructor 'v'` before any of our code runs.
12
+ export const MIN_NODE_MAJOR = 20;
13
+
14
+ export function checkNodeVersion(version = process.versions.node) {
15
+ const major = Number.parseInt(version.split('.')[0] ?? '', 10);
16
+ if (!Number.isFinite(major) || major <= 0) {
17
+ return { ok: true, currentVersion: version, message: null };
18
+ }
19
+ if (major < MIN_NODE_MAJOR) {
20
+ return {
21
+ ok: false,
22
+ currentVersion: version,
23
+ message: `requires Node.js >= ${MIN_NODE_MAJOR}.0.0 (found ${version})`,
24
+ };
25
+ }
26
+ return { ok: true, currentVersion: version, message: null };
27
+ }
@@ -4,6 +4,17 @@ import { existsSync } from 'node:fs';
4
4
  import path from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
 
7
+ import { checkNodeVersion } from './nodeVersionGuard.mjs';
8
+
9
+ // Skip postinstall (rather than crashing it) on unsupported Node so
10
+ // `npm install` finishes and the user only sees the engines warning.
11
+ // The CLI's runtime guard reports the same constraint on next run.
12
+ const nodeVersion = checkNodeVersion();
13
+ if (!nodeVersion.ok) {
14
+ console.warn(`lore: skipping postinstall — ${nodeVersion.message}.`);
15
+ process.exit(0);
16
+ }
17
+
7
18
  const allowedCommands = new Set([
8
19
  'postinstall:install-skills',
9
20
  'postinstall:refresh-background-binary',