WIP / requesting feedback: Node 10 support.#62
WIP / requesting feedback: Node 10 support.#62simonbuchan wants to merge 2 commits intoCatalystCode:masterfrom simonbuchan:node-10
Conversation
- Open keys in HKCR as read-only, not all access - Create a new key HKCU\Software\windows-registry-node for read/write tests. Note that this key is not cleaned up on test completion, in case the delete function deletes something it shouldn't! The file association test still attempts to write to HKCR and will fail.
|
As you've probably discovered the CI is configured for node 4 in appveyor.yml, which means the new Buffer forms won't work. I think it's worth updating that to something newer - hopefully one of the maintainers can comment on that, i.e. what version of node we should support for the future? Node.JS 4.x was EOL-ed back in April, so we have a reasonable case for an upgrade: https://github.com/nodejs/Release#end-of-life-releases (I'm also not sure exactly what version of Windows - or Wine? - the CI server is running, since it passes the unit tests without access errors.) The unreleased ffi master branch did work for me on node 9 at least; ffi-napi may well be the way to go anyway but I don't know enough to comment. Ditto thanks for fixing the throws: I didn't know enough Node.js to do that properly myself. |
|
@ritazh any plans on merging this? |
|
If you're looking for any registry package, I ended up writing my own from scratch: https://github.com/simonbuchan/native-reg |
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-napihasref-napiandref-struct-dias deps, so probably should also switch to those, although it seems to work currently?associateExeForFile()without mocks / restoreTEST_MOCKS_ON.Bufferpre-node 5.10?keyError()- currently pretty weak formatting.Running on node 10 has a couple of problems:
ffipackage 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-cliin 2018, so I added it as a local dep, which works fine!