@solcreek/cli 0.4.27 → 0.4.28

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.
@@ -45,6 +45,22 @@ export declare function readAdapterCompat(cwd: string): {
45
45
  * the Creek adapter handles middleware via typed AdapterOutputs.
46
46
  */
47
47
  export declare function patchBundledWorker(bundleDir: string, openNextDir: string): void;
48
+ /**
49
+ * Ensure @prisma/adapter-d1 is resolvable at build time for the zero-change
50
+ * Prisma-on-D1 swap. adapter-creek aliases `@prisma/adapter-better-sqlite3` to
51
+ * a PrismaD1-backed shim that imports `@prisma/adapter-d1`; that package is an
52
+ * OPTIONAL peer of the adapter (not shipped to non-Prisma projects), so it is
53
+ * lazily installed into .creek only when the project actually uses the
54
+ * better-sqlite3 Prisma adapter. Installed matching the project's Prisma
55
+ * version — the adapter packages release in lockstep with @prisma/client, so a
56
+ * matching driver-adapter interface avoids subtle version skew.
57
+ *
58
+ * No-op unless @prisma/adapter-better-sqlite3 is present, or if adapter-d1 is
59
+ * already resolvable (project dep or a prior .creek install).
60
+ *
61
+ * Exported for tests.
62
+ */
63
+ export declare function ensurePrismaD1(cwd: string): void;
48
64
  /**
49
65
  * Fix the standalone output path for monorepo builds.
50
66
  *
@@ -128,6 +128,7 @@ export function buildNextjs(cwd, isMonorepo, projectName) {
128
128
  if (version && semverGte(version, "16.2.3")) {
129
129
  const adapterPath = ensureAdapter(cwd);
130
130
  if (adapterPath) {
131
+ ensurePrismaD1(cwd);
131
132
  buildWithAdapter(cwd, adapterPath);
132
133
  return;
133
134
  }
@@ -205,6 +206,10 @@ const OPENNEXT_PKG = "@opennextjs/cloudflare";
205
206
  const OPENNEXT_VERSION = "^1.18.0";
206
207
  const ADAPTER_PKG = "@solcreek/adapter-creek";
207
208
  const ADAPTER_VERSION = "^0.2.2";
209
+ // Zero-change Prisma-on-D1: the adapter's build-time swap targets this
210
+ // adapter and imports @prisma/adapter-d1 (an optional peer it doesn't ship).
211
+ const PRISMA_BSQLITE_PKG = "@prisma/adapter-better-sqlite3";
212
+ const PRISMA_D1_PKG = "@prisma/adapter-d1";
208
213
  // Adapter < 0.2.2 resolves its dependencies against paths that don't exist
209
214
  // under the .creek lazy install (0.2.0: the cache handler; 0.2.1: the
210
215
  // wrangler bin) — npm hoists them to the top of the tree, so the adapter's
@@ -283,6 +288,56 @@ function ensureAdapter(cwd) {
283
288
  consola.success(` ${ADAPTER_PKG} installed`);
284
289
  return resolved;
285
290
  }
291
+ /**
292
+ * Ensure @prisma/adapter-d1 is resolvable at build time for the zero-change
293
+ * Prisma-on-D1 swap. adapter-creek aliases `@prisma/adapter-better-sqlite3` to
294
+ * a PrismaD1-backed shim that imports `@prisma/adapter-d1`; that package is an
295
+ * OPTIONAL peer of the adapter (not shipped to non-Prisma projects), so it is
296
+ * lazily installed into .creek only when the project actually uses the
297
+ * better-sqlite3 Prisma adapter. Installed matching the project's Prisma
298
+ * version — the adapter packages release in lockstep with @prisma/client, so a
299
+ * matching driver-adapter interface avoids subtle version skew.
300
+ *
301
+ * No-op unless @prisma/adapter-better-sqlite3 is present, or if adapter-d1 is
302
+ * already resolvable (project dep or a prior .creek install).
303
+ *
304
+ * Exported for tests.
305
+ */
306
+ export function ensurePrismaD1(cwd) {
307
+ const projectRequire = createRequire(join(cwd, "noop.js"));
308
+ try {
309
+ projectRequire.resolve(PRISMA_BSQLITE_PKG);
310
+ }
311
+ catch {
312
+ return; // Not a Prisma-on-D1 (better-sqlite3 adapter) project.
313
+ }
314
+ // createRequire from .creek walks up into the project's node_modules too, so
315
+ // this single check covers both a prior .creek install and a project dep.
316
+ const creekDir = join(cwd, CREEK_DIR);
317
+ try {
318
+ createRequire(join(creekDir, "noop.js")).resolve(PRISMA_D1_PKG);
319
+ return; // Already available.
320
+ }
321
+ catch {
322
+ // Fall through to install.
323
+ }
324
+ let version = "latest";
325
+ try {
326
+ const clientPkg = JSON.parse(readFileSync(projectRequire.resolve("@prisma/client/package.json"), "utf-8"));
327
+ if (clientPkg.version)
328
+ version = clientPkg.version;
329
+ }
330
+ catch {
331
+ // No @prisma/client version readable — fall back to latest.
332
+ }
333
+ consola.start(` Installing ${PRISMA_D1_PKG}@${version} (Prisma on D1)...`);
334
+ if (installCreekDep(creekDir, PRISMA_D1_PKG, version)) {
335
+ consola.success(` ${PRISMA_D1_PKG} installed`);
336
+ }
337
+ else {
338
+ consola.warn(` Could not install ${PRISMA_D1_PKG} — Prisma build may fail`);
339
+ }
340
+ }
286
341
  /**
287
342
  * Ensure @opennextjs/cloudflare is available in .creek/node_modules.
288
343
  * Returns the path to the opennextjs-cloudflare CLI binary.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solcreek/cli",
3
- "version": "0.4.27",
3
+ "version": "0.4.28",
4
4
  "description": "CLI for the Creek deployment platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -44,6 +44,7 @@
44
44
  "hono": "^4.7.4",
45
45
  "jsdom": "^29.0.1",
46
46
  "miniflare": "^4.20260317.3",
47
+ "msw": "^2.12.14",
47
48
  "react": "^19.2.4",
48
49
  "react-dom": "^19.2.4",
49
50
  "typescript": "^5.8.2",