riverbankcms 0.39.0 → 0.40.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.
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { In as sdkEntrySlotBlocksInputSchema, a as classifySdkEventSchedule, i as sdkEventUpsertOptionalFieldSchemas, n as sdkCourseBookingSettingsSchema, o as classifySdkEventBookingOffer } from "./sdk-event-upsert-CJBftm7i.mjs";
3
- import { w as EVENT_PRESET_VALUES } from "./src-CnUjAAn9.mjs";
2
+ import { In as sdkEntrySlotBlocksInputSchema, a as classifySdkEventSchedule, i as sdkEventUpsertOptionalFieldSchemas, n as sdkCourseBookingSettingsSchema, o as classifySdkEventBookingOffer } from "./sdk-event-upsert-Ch_VUpkB.mjs";
3
+ import { w as EVENT_PRESET_VALUES } from "./src-C5150tVc.mjs";
4
4
  import { z } from "zod";
5
-
6
- //#region src/commands/eventUpsertInputSchema.ts
5
+ // src/commands/eventUpsertInputSchema.ts
7
6
  const eventScheduleInputSchema = z.object({
8
7
  recurrenceRule: z.string().nullable().optional(),
9
8
  startDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).nullable().optional(),
@@ -21,18 +20,14 @@ const eventScheduleInputSchema = z.object({
21
20
  }));
22
21
  return z.NEVER;
23
22
  }
24
- if (result.kind === "start-end") {
25
- return {
26
- startsAt: result.startsAtIso,
27
- endsAt: result.endsAtIso
28
- };
29
- }
30
- if (result.kind === "start-duration") {
31
- return {
32
- startsAt: result.startsAtIso,
33
- durationMinutes: (Date.parse(result.endsAtIso) - Date.parse(result.startsAtIso)) / 6e4
34
- };
35
- }
23
+ if (result.kind === "start-end") return {
24
+ startsAt: result.startsAtIso,
25
+ endsAt: result.endsAtIso
26
+ };
27
+ if (result.kind === "start-duration") return {
28
+ startsAt: result.startsAtIso,
29
+ durationMinutes: (Date.parse(result.endsAtIso) - Date.parse(result.startsAtIso)) / 6e4
30
+ };
36
31
  return result.canonical;
37
32
  });
38
33
  function classifiedSchema(classify) {
@@ -104,6 +99,4 @@ const eventUpsertInputSchema = z.object({
104
99
  message: "all occurrences must use the same timeZone"
105
100
  });
106
101
  }));
107
-
108
- //#endregion
109
- export { eventUpsertInputSchema as t };
102
+ export { eventUpsertInputSchema as t };
@@ -5,105 +5,17 @@ import { dirname as dirname$1, join, parse } from "node:path";
5
5
  import { createJiti } from "jiti";
6
6
  import { existsSync as existsSync$1 } from "fs";
7
7
  import { fileURLToPath } from "url";
8
-
9
- //#region package.json
10
- var version = "0.39.0";
11
8
  var peerDependencies = { "@riverbankcms/sdk": ">=0.157.0 <1.0.0" };
12
- var package_default = {
13
- name: "riverbankcms",
14
- version,
15
- description: "Riverbank CMS command-line tools for SDK site developers",
16
- bin: { "riverbankcms": "dist/cli/index.mjs" },
17
- exports: {
18
- "./scaffold": {
19
- "@riverbankcms/source": "./src/scaffold/index.ts",
20
- "default": "./dist/scaffold/index.mjs"
21
- },
22
- "./testing": {
23
- "@riverbankcms/source": "./src/testing.ts",
24
- "default": "./dist/testing.mjs"
25
- },
26
- "./acceptance/matrix": {
27
- "@riverbankcms/source": "./src/acceptance/matrix.ts",
28
- "default": "./dist/acceptance/matrix.mjs"
29
- },
30
- "./package.json": "./package.json"
31
- },
32
- files: ["dist", "README.md"],
33
- engines: { "node": ">=18" },
34
- scripts: {
35
- "clean:dist": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
36
- "build": "node scripts/build.mjs",
37
- "dev": "node scripts/build.mjs --watch",
38
- "typecheck": "cd ../.. && bash scripts/run-package-typecheck.sh packages/cli",
39
- "lint": "node ../../scripts/run-package-lint.mjs src",
40
- "lint:baseline:update": "pnpm --filter @riverbankcms/eslint-plugin build && cd ../.. && node scripts/run-cli-riverbank-lint.mjs --update-baseline",
41
- "test": "node scripts/run-tests.mjs",
42
- "test:bun": "node scripts/run-bun-tests.mjs",
43
- "test:bun:check": "node scripts/run-bun-tests.mjs --check",
44
- "test:bun:list": "node scripts/run-bun-tests.mjs --list",
45
- "check:packed-exports": "node scripts/check-packed-exports.mjs",
46
- "check:consumer-contract": "node scripts/check-packed-consumer-contract.mjs",
47
- "check:packed-account-smoke": "node scripts/check-packed-account-smoke.mjs",
48
- "cli": "pnpm --filter @riverbankcms/sdk build && pnpm build && node dist/cli/index.mjs",
49
- "prepack": "node ../../scripts/package-boundaries/pack-published.mjs refuse"
50
- },
51
- dependencies: {
52
- "commander": "^12.1.0",
53
- "dotenv": "^16.4.5",
54
- "fast-deep-equal": "^3.1.3",
55
- "jiti": "^2.7.0",
56
- "prompts": "^2.4.2",
57
- "simple-git": "^3.36.0",
58
- "zod": "^4.3.6"
59
- },
60
- peerDependencies,
61
- optionalDependencies: { "@napi-rs/keyring": "1.3.0" },
62
- devDependencies: {
63
- "@riverbankcms/api": "workspace:*",
64
- "@riverbankcms/blocks": "workspace:*",
65
- "@riverbankcms/content-model": "workspace:*",
66
- "@riverbankcms/core": "workspace:*",
67
- "@riverbankcms/management-client": "workspace:*",
68
- "@riverbankcms/media-core": "workspace:*",
69
- "@riverbankcms/sdk": "workspace:*",
70
- "@riverbankcms/site-commands": "workspace:*",
71
- "@riverbankcms/test-support": "workspace:*",
72
- "@riverbankcms/theme-core": "workspace:*",
73
- "@types/node": "^22.18.5",
74
- "@types/prompts": "^2.4.9",
75
- "tsdown": "^0.16.5",
76
- "tsx": "^4.23.15",
77
- "typescript": "^6.0.3"
78
- },
79
- repository: {
80
- "type": "git",
81
- "url": "git+https://github.com/riverbankcms/riverbankcms.git",
82
- "directory": "packages/cli"
83
- },
84
- keywords: [
85
- "headless-cms",
86
- "riverbankcms",
87
- "cms",
88
- "cli"
89
- ],
90
- license: "MIT",
91
- "private": false
92
- };
93
-
94
- //#endregion
95
- //#region src/version.ts
9
+ // src/version.ts
96
10
  /** The package manifest is the source-run fallback; builds inject this value. */
97
- const CLI_VERSION = typeof "0.39.0" === "string" ? "0.39.0" : version;
11
+ const CLI_VERSION = "0.40.0";
98
12
  /**
99
13
  * The CLI's SDK peer range is bundled from the CLI manifest alongside its
100
14
  * version. Runtime config loading uses this value as the single compatibility
101
15
  * contract for the SDK installed by the site.
102
16
  */
103
17
  const CLI_SDK_PEER_RANGE = peerDependencies["@riverbankcms/sdk"];
104
-
105
- //#endregion
106
- //#region src/sdk-peer.ts
18
+ // src/sdk-peer.ts
107
19
  const SDK_PACKAGE_NAME = "@riverbankcms/sdk";
108
20
  const SDK_INSTALL_COMMAND = (range) => `pnpm add ${SDK_PACKAGE_NAME}@'${range}'`;
109
21
  /**
@@ -116,7 +28,7 @@ var CliSdkPeerError = class extends Error {
116
28
  const { status, requiredRange, installedVersion } = options;
117
29
  const detail = status === "missing" ? `No ${SDK_PACKAGE_NAME} package was found in this site.` : `This site has ${SDK_PACKAGE_NAME}@${installedVersion ?? "an invalid version"}.`;
118
30
  const installCommand = SDK_INSTALL_COMMAND(requiredRange);
119
- super(`${detail} The Riverbank CLI requires ${SDK_PACKAGE_NAME}@${requiredRange}. ` + `Install a compatible SDK with: ${installCommand}`);
31
+ super(`${detail} The Riverbank CLI requires ${SDK_PACKAGE_NAME}@${requiredRange}. Install a compatible SDK with: ${installCommand}`);
120
32
  this.code = "sdk:incompatible-sdk";
121
33
  this.name = "CliSdkPeerError";
122
34
  this.status = status;
@@ -127,7 +39,7 @@ var CliSdkPeerError = class extends Error {
127
39
  };
128
40
  function parseStableVersion(value) {
129
41
  const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(value.trim());
130
- if (!match) return undefined;
42
+ if (!match) return void 0;
131
43
  const major = Number(match[1]);
132
44
  const minor = Number(match[2]);
133
45
  const patch = Number(match[3]);
@@ -135,7 +47,7 @@ function parseStableVersion(value) {
135
47
  major,
136
48
  minor,
137
49
  patch
138
- ].every(Number.isSafeInteger)) return undefined;
50
+ ].every(Number.isSafeInteger)) return void 0;
139
51
  return [
140
52
  major,
141
53
  minor,
@@ -146,7 +58,7 @@ function compareVersions(left, right) {
146
58
  for (let index = 0; index < left.length; index += 1) {
147
59
  const leftPart = left[index];
148
60
  const rightPart = right[index];
149
- if (leftPart === undefined || rightPart === undefined) continue;
61
+ if (leftPart === void 0 || rightPart === void 0) continue;
150
62
  if (leftPart < rightPart) return -1;
151
63
  if (leftPart > rightPart) return 1;
152
64
  }
@@ -154,21 +66,19 @@ function compareVersions(left, right) {
154
66
  }
155
67
  function parsePeerRange(value) {
156
68
  const match = /^\s*>=\s*(\d+\.\d+\.\d+)\s+<\s*(\d+\.\d+\.\d+)\s*$/.exec(value);
157
- if (!match) return undefined;
69
+ if (!match) return void 0;
158
70
  const floor = parseStableVersion(match[1] ?? "");
159
71
  const ceiling = parseStableVersion(match[2] ?? "");
160
- if (!floor || !ceiling || compareVersions(floor, ceiling) >= 0) return undefined;
72
+ if (!floor || !ceiling || compareVersions(floor, ceiling) >= 0) return void 0;
161
73
  return {
162
74
  floor,
163
75
  ceiling
164
76
  };
165
77
  }
166
78
  const parsedCliSdkPeerRange = parsePeerRange(CLI_SDK_PEER_RANGE);
167
- if (!parsedCliSdkPeerRange) {
168
- throw new Error(`CLI package contains an unsupported SDK peer range: ${CLI_SDK_PEER_RANGE}`);
169
- }
170
- function isVersionInPeerRange(version$1, range) {
171
- const parsedVersion = parseStableVersion(version$1);
79
+ if (!parsedCliSdkPeerRange) throw new Error(`CLI package contains an unsupported SDK peer range: ${CLI_SDK_PEER_RANGE}`);
80
+ function isVersionInPeerRange(version, range) {
81
+ const parsedVersion = parseStableVersion(version);
172
82
  if (!parsedVersion) return false;
173
83
  return compareVersions(parsedVersion, range.floor) >= 0 && compareVersions(parsedVersion, range.ceiling) < 0;
174
84
  }
@@ -185,9 +95,7 @@ function resolveSdkMetadataPath(fromPath) {
185
95
  }
186
96
  function readSdkMetadata(metadataPath) {
187
97
  const manifest = JSON.parse(readFileSync(metadataPath, "utf8"));
188
- if (manifest.name !== SDK_PACKAGE_NAME || typeof manifest.version !== "string") {
189
- throw new Error(`Invalid ${SDK_PACKAGE_NAME} package metadata.`);
190
- }
98
+ if (manifest.name !== SDK_PACKAGE_NAME || typeof manifest.version !== "string") throw new Error(`Invalid ${SDK_PACKAGE_NAME} package metadata.`);
191
99
  return {
192
100
  name: SDK_PACKAGE_NAME,
193
101
  version: manifest.version
@@ -221,18 +129,14 @@ function assertCompatibleSdkPeer(fromPath, options = {}) {
221
129
  requiredRange
222
130
  });
223
131
  }
224
- if (!parsedRequiredRange || !isVersionInPeerRange(metadata.version, parsedRequiredRange)) {
225
- throw new CliSdkPeerError({
226
- status: "incompatible",
227
- requiredRange,
228
- installedVersion: metadata.version
229
- });
230
- }
132
+ if (!parsedRequiredRange || !isVersionInPeerRange(metadata.version, parsedRequiredRange)) throw new CliSdkPeerError({
133
+ status: "incompatible",
134
+ requiredRange,
135
+ installedVersion: metadata.version
136
+ });
231
137
  return metadata;
232
138
  }
233
-
234
- //#endregion
235
- //#region src/load-config.ts
139
+ // src/load-config.ts
236
140
  /**
237
141
  * Config file loader for riverbank.config.ts
238
142
  *
@@ -250,45 +154,31 @@ const currentDir = dirname(fileURLToPath(import.meta.url));
250
154
  */
251
155
  async function loadConfigFile(configPath) {
252
156
  const resolvedPath = resolveConfigPath(configPath);
253
- if (!existsSync$1(resolvedPath)) {
254
- throw new Error(`Config file not found: ${resolvedPath}\n` + `Create a riverbank.config.ts file or specify a path with --config`);
255
- }
157
+ if (!existsSync$1(resolvedPath)) throw new Error(`Config file not found: ${resolvedPath}\nCreate a riverbank.config.ts file or specify a path with --config`);
256
158
  assertCompatibleSdkPeer(resolvedPath);
257
159
  process.stderr.write(`Loading config from ${resolvedPath}...\n`);
258
160
  const alias = {};
259
161
  const sourceConfigPath = resolve(currentDir, "..", "config", "index.ts");
260
162
  const sourceIndexPath = resolve(currentDir, "..", "index.ts");
261
- if (existsSync$1(sourceConfigPath)) {
262
- alias["@riverbankcms/sdk/config"] = sourceConfigPath;
263
- }
264
- if (existsSync$1(sourceIndexPath)) {
265
- alias["@riverbankcms/sdk"] = sourceIndexPath;
266
- }
163
+ if (existsSync$1(sourceConfigPath)) alias["@riverbankcms/sdk/config"] = sourceConfigPath;
164
+ if (existsSync$1(sourceIndexPath)) alias["@riverbankcms/sdk"] = sourceIndexPath;
267
165
  const blocksDir = resolve(currentDir, "../../../blocks/src");
268
- if (existsSync$1(blocksDir)) {
269
- alias["@riverbankcms/blocks"] = blocksDir;
270
- }
166
+ if (existsSync$1(blocksDir)) alias["@riverbankcms/blocks"] = blocksDir;
271
167
  const mediaCorePath = resolve(currentDir, "../../../media-core/src/index.ts");
272
- if (existsSync$1(mediaCorePath)) {
273
- alias["@riverbankcms/media-core"] = mediaCorePath;
274
- }
168
+ if (existsSync$1(mediaCorePath)) alias["@riverbankcms/media-core"] = mediaCorePath;
275
169
  const jiti = createJiti(import.meta.url, {
276
170
  fsCache: false,
277
171
  moduleCache: false,
278
- alias: Object.keys(alias).length > 0 ? alias : undefined,
172
+ alias: Object.keys(alias).length > 0 ? alias : void 0,
279
173
  jsx: Object.keys(alias).length > 0
280
174
  });
281
175
  try {
282
176
  const configModule = await jiti.import(resolvedPath);
283
177
  const config = configModule.default ?? configModule.config ?? configModule;
284
- if (!config || typeof config !== "object") {
285
- throw new Error("Config file must export a configuration object");
286
- }
178
+ if (!config || typeof config !== "object") throw new Error("Config file must export a configuration object");
287
179
  return config;
288
180
  } catch (error) {
289
- if (error instanceof Error) {
290
- throw new Error(`Failed to load config: ${error.message}`);
291
- }
181
+ if (error instanceof Error) throw new Error(`Failed to load config: ${error.message}`);
292
182
  throw error;
293
183
  }
294
184
  }
@@ -300,15 +190,9 @@ async function loadConfigFile(configPath) {
300
190
  * If path is a file, uses it directly.
301
191
  */
302
192
  function resolveConfigPath(configPath) {
303
- if (!configPath) {
304
- return resolve(process.cwd(), DEFAULT_CONFIG_FILENAME);
305
- }
193
+ if (!configPath) return resolve(process.cwd(), DEFAULT_CONFIG_FILENAME);
306
194
  const resolved = resolve(configPath);
307
- if (existsSync$1(resolved) && !resolved.endsWith(".ts") && !resolved.endsWith(".js")) {
308
- return resolve(resolved, DEFAULT_CONFIG_FILENAME);
309
- }
195
+ if (existsSync$1(resolved) && !resolved.endsWith(".ts") && !resolved.endsWith(".js")) return resolve(resolved, DEFAULT_CONFIG_FILENAME);
310
196
  return resolved;
311
197
  }
312
-
313
- //#endregion
314
- export { CliSdkPeerError as n, CLI_VERSION as r, loadConfigFile as t };
198
+ export { CliSdkPeerError as n, CLI_VERSION as r, loadConfigFile as t };
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export { t as loadConfigFile } from "./load-config-BHD3Ugbc.mjs";