Standalone CLI in t3 project
Hi! So I wrote a question a while ago about making a little script for interacting with my db through prisma (https://discordapp.com/channels/966627436387266600/1024739607553786011)
I was recommended ts-node to run the file, but that doesn't work at all. I think it has something to do with es6 imports/exports but it's really cryptic and I can't find much information about it. The error message looks like this:
And the file is simply
Has anyone else ran in to problems like this? Any help, pointers or other recommendations for how I could run a .ts file in my t3 project without running the whole web app would be greatly appreciated
15 Replies
im not super familiar but I have created ts scripts and ran them with https://github.com/egoist/tsno before
im pretty noob when it comes to this so someone probably has a better solution
GitHub
GitHub - egoist/tsno:
node
with typescript support, importing fro...node
with typescript support, importing from URL, etc. - GitHub - egoist/tsno: node
with typescript support, importing from URL, etc.Dude thank you so much. That library just worked right of the bat
no worries
No config, no error, just worked exactly as expected
egoist and antfu are god developers so if you see options from them they get it
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
For sure! I just skimmed through their github page and their stuff looks really useful
holy crap i didnt realise tsup took off like it did
we actually use tsup in create-t3-app
it is so nice
thats good to hear, seems like we secretly love Vue devs here without knowing it 😂
well egoist is doing everything these days
i usually use https://github.com/esbuild-kit/tsx
GitHub
GitHub - esbuild-kit/tsx: ⚡️ TypeScript Execute (tsx): Node.js enha...
⚡️ TypeScript Execute (tsx): Node.js enhanced with esbuild to run TypeScript & ESM - GitHub - esbuild-kit/tsx: ⚡️ TypeScript Execute (tsx): Node.js enhanced with esbuild to run TypeScript &...
but tbh i dont know the difference between the various options
i think tsx is antfu's version that got put into an org
also great tools
i love vue devs
one thing i miss in react from Vue is computed properties, they just seem awful in react