How to add one-off scripts to a T3 app
I started my project with create-t3-app a long time ago. i see that they've added the new t3 env-next module for managing environment variables in a typesafe way and i decided to switch to it. However, this seems to have broken my scripts directory which can no longer run one-off db scripts because its now importing a .mjs module. What is the recommended way to run one-off typescript scripts in a ct3a project?
4 Replies
it was .mjs before
you can import .mjs module from typescript
if i have a folder at the root level named
/scripts
what do i need to do to get those scripts to run? I guess the big things are:
1) what do i need in terms of tsconfig?
2) what do i need in terms of package.json?
3) how should i import the .mjs file?just import it like this
use
tsx
to run it, it should just workill give it a shot
ty