#Watch all `.ts` files, run just one?

1 messages · Page 1 of 1 (latest)

untold aspen
#

I want to watch all .ts files in my project or namely a few and after changes occurred, run a separate build.ts file

foggy hornet
untold aspen
#

here is what I am currently doing to make --watch work

import * as tstl from 'typescript-to-lua'
import './src/mcm'

const scriptsDir = process.cwd() + '/gamedata/scripts/'

export function transpile() {
  tstl.transpileFiles(['./src/mcm.ts'], { extension: '.script', outDir: scriptsDir })
}

index.ts (bun run --watch index.ts)

import { transpile } from './ts-to-lua'

transpile()
#

the mcm.ts is what I need to trigger the reload upon changing

#

and it somehow works

foggy hornet
#

you should be able to use the node watch api then right?

untold aspen
#

node watch api?

foggy hornet
#

i believe bun should support