Skip to content

Commit

Permalink
Publishing pre-built binaries to GitHub releases
Browse files Browse the repository at this point in the history
  • Loading branch information
cognitivim committed Dec 19, 2018
1 parent 2f31c51 commit 3e0a0b8
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 24 deletions.
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
23 changes: 15 additions & 8 deletions packages/node-firebird-native-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@
"gypfile": true,
"main": "dist/lib/index.js",
"scripts": {
"_preinstall": "npm install node-pre-gyp",
"_install": "node-pre-gyp install --fallback-to-build",
"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",
"generate": "node dist/generate-files",
"gyp:build": "node-gyp build",
"gyp:clean": "rimraf build",
"gyp:configure": "node-gyp configure",
"gyp:build": "node-pre-gyp build",
"gyp:clean": "rimraf build build-pre-gyp",
"gyp:configure": "node-pre-gyp configure",
"lint": "tslint --project .",
"pre-gyp:pack": "rimraf build-pre-gyp && node-pre-gyp rebuild && node-pre-gyp package"
"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 --target_platform=darwin && node-pre-gyp package --target_platform=darwin && node-pre-gyp-github publish --release",
"pre-gyp:publish-linux": "yarn run pre-gyp:prebuild && node-pre-gyp rebuild --target_platform=linux --target_arch=x64 && node-pre-gyp 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 --target_platform=linux --target_arch=ia32 && node-pre-gyp 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 --target_platform=win32 --target_arch=x64 && node-pre-gyp 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 --target_platform=win32 --target_arch=ia32 && node-pre-gyp package --target_platform=win32 --target_arch=ia32 && node-pre-gyp-github publish --release"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -63,12 +68,14 @@
"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/node-firebird-native-api@0.1.0"
"host": "https://github.com/asfernandes/node-firebird-drivers/releases/download/",
"remote_path": "node-firebird-native-api@{version}"
}
}
12 changes: 4 additions & 8 deletions packages/node-firebird-native-api/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
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')));
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 @@ -21,7 +16,8 @@ export function getDefaultLibraryFilename(): string {
}
}

const native = require(bindingPath)('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

0 comments on commit 3e0a0b8

Please sign in to comment.