Skip to content

Commit

Permalink
Move native code, gypfile to subdir to fix #23.
Browse files Browse the repository at this point in the history
electron-rebuild will blindly run any top-level binding.gyp, which will fail due to the missing dep, but also is a waste of time as this is N-API and Windows only, so there's no reason to ever rebuild it. Save such users by moving the binding.gyp the only way that works AFAIK, by providing a --cwd to prebuildify.
  • Loading branch information
simonbuchan committed Jul 29, 2021
1 parent eb1b4d0 commit dc65547
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.*/
!/.idea/
/.idea/workspace.xml
/build/
/binding/build/
/binding/prebuilds/
/lib/
/prebuilds/
node_modules/
yarn-error.log*
*.tgz
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/.idea/
/.vs/
/build/
/binding/build/
/examples/
*.log
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- [#23](https://github.com/simonbuchan/native-reg/issues/23) Don't break electron-rebuild by avoiding a top-level
binding.gyp.

## [v0.3.5] - 2021-03-18

### Added
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"lib",
"src",
"test",
"prebuilds",
"binding.gyp",
"binding/prebuilds",
"binding/binding.gyp",
"*.cc"
],
"scripts": {
Expand All @@ -29,8 +29,8 @@
"clean": "rimraf build lib prebuilds",
"build": "yarn build:js && yarn build:ia32 && yarn build:x64",
"build:js": "tsc -p src",
"build:ia32": "prebuildify --napi --target [email protected] --arch ia32",
"build:x64": "prebuildify --napi --target [email protected] --arch x64",
"build:ia32": "prebuildify --napi --target [email protected] --cwd binding --arch ia32",
"build:x64": "prebuildify --napi --target [email protected] --cwd binding --arch x64",
"test": "mocha --ui tdd"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const types = require('util').types || {
};

const isWindows = process.platform === 'win32';
const native = isWindows && require('node-gyp-build')(__dirname + '/..');
const native = isWindows && require('node-gyp-build')(__dirname + '/../binding');

// from winreg.h
export enum HKEY {
Expand Down

0 comments on commit dc65547

Please sign in to comment.