Limits of Bower install --save: No automatic rollback on interruption
0 reputation · 22 Dec 2022, 20:21 UTC
Goal
Make changes to bower.json by bower install --save atomic so that a partial write caused by an interruption is automatically reverted, keeping the manifest either fully updated or unchanged.
Constraints and uncertainty
The current implementation updates bower.json in place without a backup or transaction log, as documented. If the process is killed or fails mid‑write, the file may contain invalid JSON, breaking later installs. It is unclear whether introducing a temporary‑file swap or a lightweight journal would preserve existing workflows, what performance impact it would have, and at which stable version it could be released while maintaining backward compatibility.
Open questions
- Should Bower write to a temporary file and replace bower.json only after a successful write?
- Can a lightweight journal be used to restore the original content on failure without breaking current scripts?
- What version would be appropriate to introduce this change, and how would backward compatibility be maintained?