diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index c0c6349..8d3bf6c 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -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 diff --git a/binding.gyp b/binding.gyp index f6c3f64..e667eef 100644 --- a/binding.gyp +++ b/binding.gyp @@ -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' ] }] diff --git a/package.json b/package.json index cbf7335..9566cb2 100644 --- a/package.json +++ b/package.json @@ -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", @@ -45,4 +45,4 @@ "host": "https://github.com/SemiConscious/pjsua2.js/releases/download/", "remote_path": "{version}" } -} +} \ No newline at end of file diff --git a/src/pjsua2.js b/src/binding.js similarity index 51% rename from src/pjsua2.js rename to src/binding.js index 335601f..d6f7e51 100644 --- a/src/pjsua2.js +++ b/src/binding.js @@ -1,3 +1,3 @@ "use strict"; -const addon = require('./pjsua2'); +const addon = require('./binding'); module.exports = addon; diff --git a/src/build.sh b/src/build.sh index 40870f0..f38cfd2 100755 --- a/src/build.sh +++ b/src/build.sh @@ -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