getLocks exposes internal details of locked files
alanshaw opened this issue · 2 comments
Just a suggestion, but getLocks
is only used in this project for testing (but maybe other people are using it for other reasons) - consider removing it? Why would you need access to this internal data? It's easily corrupted if people assign to the lock objects and I can't think of a reason why you'd need access to any information other than the paths of the files that are locked (but arguably an application would be keeping track of these anyway).
Should just return a list of file paths that are locked? Or perhaps better - remove it, and have a test helper that keeps track of your locks so it can unlock them all easily.
@alanshaw I don't think we are exposing it, see: https://github.com/moxystudio/node-proper-lockfile/blob/master/index.js#L34
While getLocks
is exposed in lib/lockfile
, it's not exposed in index.js
which is this module main file. Users would have to do const { getLocks } = require('proper-lockfile/lib/lockfile')
to actually access them, which is private and not documented anywhere.
Ah, you're right!