This adds the `FileSystem` and `FileSystemSync` classes to replace the
VFS class. These classes handle file system operations using `fs-extra`
for most tasks, except where the `atomically` package can be used to
improve reads and writes. The goal is to ensure that file operations are
as safe as possible while still providing a comfortable API. File
operation atomicity is focused on single files, as there's no trivial,
strict way to ensure atomicity for directory operations.
## Changes
- Adds `FileSystem` class for asynchronous file operations
- Adds `FileSystemSync` class for synchronous file operations
- Updates `atomically` to `2.0.3`
- Updates build script to transpiles ESM modules
- Resolves `AbstractWinstonLogger` bug that could cause a log file to be
overwritten
- Removes `VFS` class
- Removes `AsyncQueue` class
- Removes `proper-lockfile` package
## TODO
- Test anything that touches a file.
I'm leaving this in a draft state until I can test this further. Help is
more than welcome at this point. The classes are pretty solid, but
ensuring that they're being used properly throughout the existing code
still needs work.
---------
Co-authored-by: Chomp <dev@dev.sp-tarkov.com>
This updates the debug command to type check before executing the run
entry. If the check fails the debug will not continue.
This unfortunately breaks the TSX `watch` function and the debugger now
has to be manually restarted when code is changed. I've been unable to
find a solution to this.
While not ideal, an alternative is to only type-check on build and leave
debug using TSX directly, like we were. Let me know if you'd rather go
that way and get your `watch` back.
----------------
Also includes possible fixes (bbf56f7d23f729bcb12899b82f760d02abf60832)
for the two type errors that are currently holding back debug builds.
I say possible because
- I've only solved the issues with the current types and have no idea if
the types are actually correct
- Have only resolved the type errors within the IDE/TSC and have not
actually tested in game
They need to be reviewed.
These are possible fixes for the two type errors that are currently holding back type checking this branch. I say possible because it's not tested in game and I've only solved the issues with the current types and have no idea if the types are actually correct.
Needs a review.
- Done some slight refactoring to `DatabaseImporter` to get rid of the
old loading methods that have been sitting unused for sometime, as well
as slightly refactoring `loadAsync` for better readability and using
map's wherever possible, this should also yield a slight performance
improvement?
- Updated VFS to use node:fs/promises rather than our own promisfying of
those methods.
- Got rid of commands on VFS, I don't see why these are necessary
anymore? If there's a good reason to still leave these I can revert
this.
- Changed loadImages to loadImagesAsync
---------
Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>
See 0d1e1ba3591458bb195812232d3b8c3345abbeaa for actual changes. The
rest is from running the `style:fix` script.
- Consolidated ignores
- Enabled for `ModCompilerService.ts`
- Added a format ignore line to `ModCompilerService.ts` to prevent
mappings from being affected
- Enabled for `jsonc` file types
---------
Co-authored-by: Chomp <27521899+chompDev@users.noreply.github.com>