I want tsc to compile all the .ts files to .js files, then put them somewhere else.
My tsconfig has the option "outDir": "./dist",
.
I ran a command targeted at my core file tsc ./src/server.ts
.
How do I make tsc not create a bunch of js files all over the place and put them in the dist instead?
EDIT: I figured out what I was doing wrong. Is there any way to tell typescript (perhaps on a global scale) to never, ever, ever make a bunch of in place js files? It's a real hassle to accidentally do that then have to clean it up.
Don't direct tsc to any file.
Just run tsc
without the ./src/server.ts
As far as I can tell, there is no way to globally disable tsc from shooting out .js files everywhere if you happen to mess up the command. The safest bet is to create a script in package.json
and only ever call that.
If you need to quickly delete a bunch of js files, you can do so like this (https://unix.stackexchange.com/a/116390/132794):
MAKE SURE TO HAVE THE RIGHT DIRECTORY
find /path/to/directory -type f -name '*.js' -exec rm {} +
If you keep your src in root level directory next to node_modules, you'll have to do some extra to not delete your modules. Or just delete the whole node_modules folder, then run npm i
again. If anything breaks, you were going to have to fix that anyways.