Skip to content

bun template create wrong db file on Windows #370

@jonaspm

Description

@jonaspm

Bun template has this config:

import { type BunBkndConfig, serve } from "bknd/adapter/bun";

// Actually, all it takes is the following line:
// serve();

// this is optional, if omitted, it uses an in-memory database
const config: BunBkndConfig = {
   connection: {
      url: "file:data.db",
   },
   config: {
      media: {
         enabled: true,
         adapter: {
            type: "local",
            config: { path: "./uploads" },
         },
      },
   },
};

serve(config);

where the file:data.db on Windows produce a file file:

Image

The fix is to remove the file: prefix but ideally templates should "just work" and not require patching after initialization.

I see two paths forward:

  1. Remove file: prefix entirely
  2. Handle the prefix based on the operating system

Steps to reproduce

  1. Run bunx bknd create & select bun runtime template
  2. cd into the newly created project folder
  3. Run bun run dev
  4. See the file get created (if not existed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions