Skip to content
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

Merged
merged 17 commits into from
Feb 19, 2019
Merged

Conversation

felixrieseberg
Copy link
Member

@felixrieseberg felixrieseberg commented Feb 14, 2019

This PR does five six things:

  1. Cuts mksnapshot and the already broken snapshot functionality
  2. Updates all dependencies and the required Node version to v8
  3. Uses the latest standard
  4. Replaces the deprecated new Buffer with Buffer.alloc
  5. Replaces the deprecated assert.equal with assert.strictEqual
  6. Promisifies the API, dropping the callback-style async API. (Users who prefer that style can use nodeify.)

Fixes #163
Fixes #156

Copy link
Member

@MarshallOfSound MarshallOfSound left a 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 👍

malept
malept previously requested changes Feb 14, 2019
Copy link
Member

@malept malept left a 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).

package.json Outdated Show resolved Hide resolved
@felixrieseberg
Copy link
Member Author

@malept: Sure! Do you want to just push to this branch?

@malept
Copy link
Member

malept commented Feb 14, 2019

Sure! Do you want to just push to this branch?

Works for me.

@malept malept dismissed their stale review February 19, 2019 06:18

I made the changes that I asked for

Copy link
Member

@malept malept left a 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'))
Copy link
Member

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'))
Copy link
Member

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.

@malept malept changed the title v1: Cut mksnapshot, update dependencies v1: Cut mksnapshot, update dependencies, promisify Feb 19, 2019
}
}
return false
return unpackDirs.some(unpackDir => dirPath.startsWith(unpackDir))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

lib/asar.js Outdated Show resolved Hide resolved
@felixrieseberg
Copy link
Member Author

felixrieseberg commented Feb 19, 2019

Reviewed all the commits piece by piece and I can't say I disagree with anything. LGTM!

@malept malept merged commit 2ec15c1 into master Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants