Skip to content

Commit

Permalink
copy pjsua2.js to build dir before node-gyp copies it, revert name ch…
Browse files Browse the repository at this point in the history
…ange
  • Loading branch information
jim-page committed May 12, 2024
1 parent 5c00c69 commit 55caa84
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,12 @@ jobs:
- run: swig -version
# build x86_64 version, test, pack, package and native module
- run: npm i --ignore-scripts
- run: npm publish --dry-run
# see https://github.com/bchr02/node-pre-gyp-github/pull/46
- name: Hack node-pre-gyp-github source
run: sed -i 's/cmd, //g' node_modules/node-pre-gyp-github/bin/node-pre-gyp-github.js
- run: npm publish --dry-run
- run: ./node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp rebuild package
- run: npm publish --dry-run
- run: npm run test
- run: npm publish --dry-run
- run: NODE_PRE_GYP_GITHUB_TOKEN=$NODE_AUTH_TOKEN ./node_modules/node-pre-gyp-github/bin/node-pre-gyp-github.js publish --release
- run: npm publish --dry-run
- run: rm dist/pjsua2.node
- run: npm publish

Expand Down
4 changes: 2 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@
'copies': [{
'destination': 'dist',
'files': [
'build/swig/pjsua2.d.ts',
'src/pjsua2.js',
'build/swig/binding.d.ts',
'build/binding/binding.js',
'build/Release/pjsua2.node'
]
}]
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "@semiconscious/pjsua2.js",
"description": "Native node module for pjsua2 library",
"version": "0.0.5",
"main": "dist/pjsua2.js",
"types": "dist/pjsua2.d.ts",
"main": "dist/binding.js",
"types": "dist/binding.d.ts",
"scripts": {
"pretest": "tsc",
"test": "node --napi-modules ./test/test_binding.js",
Expand Down Expand Up @@ -45,4 +45,4 @@
"host": "https://github.com/SemiConscious/pjsua2.js/releases/download/",
"remote_path": "{version}"
}
}
}
2 changes: 1 addition & 1 deletion src/pjsua2.js → src/binding.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"use strict";
const addon = require('./pjsua2');
const addon = require('./binding');
module.exports = addon;
8 changes: 8 additions & 0 deletions src/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ cd ../../pjproject

mkdir -p ../swig
swig -I../usr/include -javascript -napi -typescript -c++ -o ../swig/pjsua2_wrap.cpp pjsip-apps/src/swig/pjsua2.i
mv ../swig/pjsua2.d.ts ../swig/binding.d.ts

# work around issue where using node-gyp to copy files seems to turn the original into a symlink, which
# breaks npm package!

cd ../..
mkdir -p build/binding
cp src/binding.js build/binding

0 comments on commit 55caa84

Please sign in to comment.