-
Notifications
You must be signed in to change notification settings - Fork 12.8k
add emitAtomic option (emit to tmp, delete old and rename) #38690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
How would a bulk rename occur atomically? Are there clear APIs in Node to do this? |
@DanielRosenwasser I proposed a per-file atomic rename by just writting to the |
I don't think this is in scope for us. The file writing is already as atomic as a non-rename write can be (we build up an entire string, then write that string to disk in a single operation from our side through |
I think is in scope, because it can only be done by modifying |
@RyanCavanaugh I've just implemented a work-around for this topic using the following pipeline for a monorepo with large number of cross-dependent packages:
Rsync is run via I mean, this feature (emitAtomic or emitAlmostAtomic) is very missing here. And rsync guys implemented a special option to have it covered in their usecases. |
It will be nice to add an
emitAtomic
option, sotsc
when emitting will first generate a temporary file (x.js.tmp
), then remove thex.js
from a previous build (if exists), and then atomically rename thex.js.tmp
file tox.js
.This is needed for some workflows were
tsc --watch
is running emitting*.js
files, and another process B is watching the build directory to hot reload these files when changed. Currently process B is seeing and trying to load*.js
files partially written. I think defaultingemitAtomic
totrue
is a sane option.My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: