Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/node-firebird-native-api/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ node_modules/
npm-debug.log

build
build-pre-gyp

.vscode
11 changes: 11 additions & 0 deletions packages/node-firebird-native-api/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@
}
]
]
},
{
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "<(module_name)" ],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
"destination": "<(module_path)"
}
]
}
]
}
33 changes: 25 additions & 8 deletions packages/node-firebird-native-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@
"gypfile": true,
"main": "dist/lib/index.js",
"scripts": {
"install": "node-pre-gyp install --fallback-to-build",
"prepublishOnly": "yarn run build && yarn run gyp:clean && yarn run gyp:configure && yarn run gyp:build && yarn test",
"test": "jest",
"build": "yarn run clean && yarn run lint && tsc",
"build:w": "yarn run clean && tsc -w",
"clean": "rimraf dist",
"lint": "tslint --project .",
"generate": "node dist/generate-files",
"gyp:clean": "rimraf build",
"gyp:build": "node-gyp build",
"gyp:configure": "node-gyp configure",
"prepublishOnly": "yarn run build && yarn run gyp:clean && yarn run gyp:configure && yarn run gyp:build && yarn test",
"test": "jest"
"gyp:build": "node-pre-gyp build",
"gyp:clean": "rimraf build build-pre-gyp",
"gyp:configure": "node-pre-gyp configure",
"lint": "tslint --project .",
"pre-gyp:prebuild": "yarn run gyp:clean && node-pre-gyp configure",
"pre-gyp:publish": "yarn run pre-gyp:publish-darwin && yarn run pre-gyp:publish-linux && yarn run pre-gyp:publish-linux-ia32 && yarn run pre-gyp:publish-win32 && yarn run pre-gyp:publish-win32-ia32",
"pre-gyp:publish-darwin": "yarn run pre-gyp:prebuild && node-pre-gyp rebuild package --target_platform=darwin && node-pre-gyp-github publish --release",
"pre-gyp:publish-linux": "yarn run pre-gyp:prebuild && node-pre-gyp rebuild package --target_platform=linux --target_arch=x64 && node-pre-gyp-github publish --release",
"pre-gyp:publish-linux-ia32": "yarn run pre-gyp:prebuild && node-pre-gyp rebuild package --target_platform=linux --target_arch=ia32 && node-pre-gyp-github publish --release",
"pre-gyp:publish-win32": "yarn run pre-gyp:prebuild && node-pre-gyp rebuild package --target_platform=win32 --target_arch=x64 && node-pre-gyp-github publish --release",
"pre-gyp:publish-win32-ia32": "yarn run pre-gyp:prebuild && node-pre-gyp rebuild package --target_platform=win32 --target_arch=ia32 && node-pre-gyp-github publish --release"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -56,9 +64,18 @@
"@types/node": "^8.10.19",
"bindings": "^1.2.1",
"nan": "^2.6.2",
"node-gyp": "^3.6.2"
"node-gyp": "^3.6.2",
"node-pre-gyp": "^0.12.0"
},
"devDependencies": {
"node-cloop-gen": "0.0.1-beta.2"
"node-cloop-gen": "0.0.1-beta.2",
"node-pre-gyp-github": "^1.4.3"
},
"binary": {
"module_name": "addon",
"module_path": "./build-pre-gyp/{node_abi}-{platform}-{arch}",
"package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz",
"host": "https://github.com/asfernandes/node-firebird-drivers/releases/download/",
"remote_path": "node-firebird-native-api@{version}"
}
}
6 changes: 4 additions & 2 deletions packages/node-firebird-native-api/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Master } from './cloop-gen';

import * as os from 'os';

import * as binary from 'node-pre-gyp';
import * as path from 'path';

/** Gets the default platform Firebird client library filename. */
export function getDefaultLibraryFilename(): string {
Expand All @@ -15,7 +16,8 @@ export function getDefaultLibraryFilename(): string {
}
}

const native = require('bindings')('addon');
const bindingPath = binary.find(path.resolve(path.join(__dirname, '../../package.json')));
const native = require(bindingPath); // require('bindings')('addon')

export const getMaster: (library: string) => Master = native.getMaster;
export const disposeMaster: (master: Master) => boolean = native.disposeMaster;
Expand Down
3 changes: 3 additions & 0 deletions packages/node-firebird-native-api/src/lib/node-pre-gyp.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'node-pre-gyp' {
export function find(path: string): string;
}
3 changes: 2 additions & 1 deletion packages/node-firebird-native-api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"exclude": [
"node_modules",
"dist",
"build"
"build",
"build-pre-gyp"
]
}
Loading