Skip to content

Conversation

@devjume
Copy link

@devjume devjume commented Jul 2, 2024

This PR will add prestart and postart as adapter options and pass them them to generated package.json

Example use cases:

  • When using bun:sqlite I want to save sqlite database on it's own folder. With prestart script I can run mkdir ./database/ automatically.
  • with prestart user can run migration scripts before starting production version of sveltekit app.

npm Docs - prestart & poststart

Example how to use:

// svelte.config.js

import adapter from "svelte-adapter-bun";
const config = {
  kit: {
    adapter: adapter({
      prestart: "mkdir ./database",
      poststart: "echo 'poststart'",
    })
  }
};
// generated package.json in build folder

"scripts": {
  "prestart": "mkdir ./database",
  "poststart": "echo 'poststart'",
  "start": "bun ./index.js"
},

@devjume devjume changed the title Add prestart and poststart as adapter options feat!: add prestart and poststart as adapter options Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant