Running cli commands in the Sveltekit server context #13959
-
Hello, I need to write a couple of command-line scripts in order to do various maintenance tasks on my project (for example one-shot data migrations, commands launched by cron, etc.). But many of them would benefit from code already existing on my SK project (database connexion, ORM, items creation in the DB…) The first hurdle was to be able to run the script in the Vite context, but I found
which I completely understand in the usual context, but I would very much like to be able to bypass here, as I’m not in a client context. From the code at: I can see that somehow, setting
I’ve tried many ways to sets ssr to true from the command-line, but without any luck. Any idea if that seems possible at all? Any alternative? How do you all write management commands running on the server? Thanks in advance! EDIT: the note at the bottom of the page https://svelte.dev/docs/kit/server-only-modules saying
let me think that maybe there should be a second, similar escape hatch there, like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Beta Was this translation helpful? Give feedback.
#9807 (comment)