WIP / requesting feedback: Node 10 support. #62
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sitting on #59, so look at that first.
This code should work, but I'd like some feedback on the changes first. In particular, how the
utils.associateExeForFile()
test should work without mocks (switch to registering inHKCU\Classes
?), and any preferences on how errors should work / look.TODO:
ffi-napi
hasref-napi
andref-struct-di
as deps, so probably should also switch to those, although it seems to work currently?associateExeForFile()
without mocks / restoreTEST_MOCKS_ON
.Buffer
pre-node 5.10?keyError()
- currently pretty weak formatting.Running on node 10 has a couple of problems:
ffi
package fails to build against recent version of node, with several errors like<snip>\ffi.cc(111): error C2039: 'ForceSet': is not a member of 'v8::Object'
- it doesn't seem to be maintained. Simply replace withffi-napi
, which forks it and uses NAPI to preserve compat.new Buffer()
is finally deprecated, and will now print warnings like(node:5056) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
. Replaced all instances withBuffer.alloc(size, fill?)
orBuffer.from(content, encoding?)
added in node 5.10.While getting tests running ran into ACCESS_DENIED errors, so I threw in some fixes for tests:
TEST_MOCKS_ON
), asutils.associateExeForFile()
will die without it, as it writes to HKCU.throw new Error(message)
, a very placeholderkeyError(message, result, ...args)
that will create these, and updated lots of error messages that were claiming "Failed to open key" when they were doing no such thing.npm i -g grunt-cli
in 2018, so I added it as a local dep, which works fine!