#is it possible to --watch for non zig file changes?

1 messages · Page 1 of 1 (latest)

lyric atlas
#

i'm using zig (version 0.14.0-dev.591+1c35e73b6) for a web assembly project with typescript and i'd like to run tsc whenever any .ts file changes in src/web. is this possible?

i have a bundle_step which builds wasm and installs some files to static/. it also calls npm run build which converts my .ts files to .js and installs them to static/ too.

so i thought maybe i needed to call bundle_step.addWatchInput() in build.zig with each of my .ts files. but doing that and editing a .ts file doesn't trigger a rebuild with zig build --watch

languid drum
#

are the inputs of your steps properly setup? I assumed this was meant to work automatically, e.g. no manual addWatchInput

lyric atlas
#

oh i guess not. so you're saying i need to do something like b.addInstallFile() for each of the .ts files?

languid drum
#

no I meant like run_step.addFileArg rather than hard coding the argument tho I realized that the npm command doesn't take in the files like that

#

I can't remember if the build system can model input files without passing them as arguments

lyric atlas
#

so if i have

const build_web_cmd = b.addSystemCommand(&.{ "npm", "run", "build" });

maybe i need to build_web_cmd.addFileInput() with each of the .ts files ?

languid drum
#

normally but when you do that it appends the file path to the command which I assume wouldn't work

lyric atlas
#

hmm i tried that and it doesn't seem to fail the npm build. but also doesn't trigger a rebuild

#

i may have been editing a .js file instead of .ts file before. 🤦. but that doesn't change anything. the rebuild still not happening.

languid drum
#

I'm not sure then, I only used --watch extremely briefly with a pure zig project

lyric atlas
#

ok thanks for the feedback!

#

not sure though as this one is specific to a 'configure phase'

languid drum
#

your build.zig is the configure phase