-
Notifications
You must be signed in to change notification settings - Fork 250
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
v1: Cut mksnapshot, update dependencies, promisify #165
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed each commit in isolation, overall seems 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙇♂️
If we're doing a v1 with breaking changes... I'd like to promisify this module. I can do the work if you want (in this PR or a separate one).
@malept: Sure! Do you want to just push to this branch? |
Works for me. |
BREAKING CHANGE: removes callback-based API. Use the `nodeify` module if you need this functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felixrieseberg @MarshallOfSound somehow I managed to refactor the entire module to Promises ... on the third try. Streams are kind of tricky when you're not using helper modules.
const stat = fs.lstatSync(filename) | ||
const pify = require('pify') | ||
|
||
const fs = pify(process.versions.electron ? require('original-fs') : require('fs')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd much rather use fs-extra
but I don't think you can override the fs
module that's used, from what I could tell. I'd be happy if someone could prove me wrong, because I'd get rid of rimraf
, mkdirp
, and a homebrewed copyFile
(which we can probably get rid of anyway, when we move to Node 8).
const pify = require('pify') | ||
|
||
const fs = pify(process.versions.electron ? require('original-fs') : require('fs')) | ||
const glob = pify(require('glob')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not using glob-promise
because I was trying to minimize the dependencies I added, and glob-promise
doesn't add much for what we're doing.
} | ||
} | ||
return false | ||
return unpackDirs.some(unpackDir => dirPath.startsWith(unpackDir)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Reviewed all the commits piece by piece and I can't say I disagree with anything. LGTM! |
This PR does
fivesix things:mksnapshot
and the already brokensnapshot
functionalitystandard
new Buffer
withBuffer.alloc
assert.equal
withassert.strictEqual
nodeify
.)Fixes #163
Fixes #156