Skip to content

Commit

Permalink
Packaging pre-built binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
cognitivim committed Dec 18, 2018
1 parent 3f6a5a5 commit 2f31c51
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 7 deletions.
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)"
}
]
}
]
}
20 changes: 15 additions & 5 deletions packages/node-firebird-native-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
"gypfile": true,
"main": "dist/lib/index.js",
"scripts": {
"_preinstall": "npm install node-pre-gyp",
"_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:clean": "rimraf 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"
"lint": "tslint --project .",
"pre-gyp:pack": "rimraf build-pre-gyp && node-pre-gyp rebuild && node-pre-gyp package"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -56,9 +59,16 @@
"@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"
},
"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/[email protected]"
}
}
8 changes: 7 additions & 1 deletion packages/node-firebird-native-api/src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { Master } from './cloop-gen';

import * as os from 'os';

// @ts-ignore
import binary from 'node-pre-gyp';
// @ts-ignore
import path from 'path';

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

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

const native = require('bindings')('addon');
const native = require(bindingPath)('addon');

export const getMaster: (library: string) => Master = native.getMaster;
export const disposeMaster: (master: Master) => boolean = native.disposeMaster;
Expand Down
27 changes: 26 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3139,6 +3139,15 @@ needle@^2.2.0:
iconv-lite "^0.4.4"
sax "^1.2.4"

needle@^2.2.1:
version "2.2.4"
resolved "https://registry.yarnpkg.com/needle/-/needle-2.2.4.tgz#51931bff82533b1928b7d1d69e01f1b00ffd2a4e"
integrity sha512-HyoqEb4wr/rsoaIDfTH2aVL9nWtQqba2/HvMv+++m8u0dz808MaagKILxtfeSN7QU7nvbQ79zk3vYOJp9zsNEA==
dependencies:
debug "^2.1.2"
iconv-lite "^0.4.4"
sax "^1.2.4"

[email protected]:
version "0.0.1-beta.2"
resolved "https://registry.yarnpkg.com/node-cloop-gen/-/node-cloop-gen-0.0.1-beta.2.tgz#1afc7db86c3a729f030967df55dcb7dc8ea46559"
Expand Down Expand Up @@ -3190,6 +3199,22 @@ node-pre-gyp@^0.10.0:
semver "^5.3.0"
tar "^4"

node-pre-gyp@^0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz#39ba4bb1439da030295f899e3b520b7785766149"
integrity sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==
dependencies:
detect-libc "^1.0.2"
mkdirp "^0.5.1"
needle "^2.2.1"
nopt "^4.0.1"
npm-packlist "^1.1.6"
npmlog "^4.0.2"
rc "^1.2.7"
rimraf "^2.6.1"
semver "^5.3.0"
tar "^4"

"nopt@2 || 3":
version "3.0.6"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9"
Expand Down Expand Up @@ -3574,7 +3599,7 @@ randomatic@^3.0.0:
kind-of "^6.0.0"
math-random "^1.0.1"

rc@^1.0.1, rc@^1.1.6, rc@^1.1.7:
rc@^1.0.1, rc@^1.1.6, rc@^1.1.7, rc@^1.2.7:
version "1.2.8"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
dependencies:
Expand Down

0 comments on commit 2f31c51

Please sign in to comment.