Answers worth citing
Short facts, same as the README, written so search engines and answer engines can quote them. Package: npmjs.com/package/sync-directory.
What is sync-directory?
A Node.js package (CLI syncdir plus a JS API) that mirrors a source directory to a target directory using copy or hardlink, with optional chokidar watch, exclude, and forceSync.
Is copy or hardlink the default?
Copy is the default. Hardlink is faster but some file watchers will not fire for the target files.
Does skipInitialSync skip watching too?
No. Combined with watch: true it skips the first full sync and only applies later add/change/unlink events. Useful when the target is already populated.
What does deleteOrphaned remove?
Target files that do not exist in source anymore, and (via the API) files that match exclude. It is off by default so a mirror will not silently delete.
Can I exclude node_modules but keep one package?
Yes. exclude node_modules and set forceSync to that package path. forceSync always wins.
CommonJS or ESM?
Both. require('sync-directory') for CommonJS. import from 'sync-directory/index.mjs' for ESM.
What does nodeep do?
It only walks the first level of the source folder, so huge trees do not get a deep scan.