Skip to content
Merged
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
22 changes: 4 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,17 @@
"dependencies": {
"@mapbox/node-pre-gyp": "^2.0.3",
"lodash.camelcase": "4.3.0",
"lodash.isequal": "4.5.0",
"lodash.snakecase": "^4.1.1",
"nan": "^2.27.0",
"node-gyp": "^11.2.0",
"remove-trailing-spaces": "^1.0.7",
"unindent": "^2.0.0"
"node-gyp": "^11.2.0"
},
"devDependencies": {
"assert": "^1.5.0",
"aws-sdk": "^2.1692.0",
"chalk": "^2.4.2",
"mocha": "^11.7.0",
"nid-parser": "0.0.5"
"nid-parser": "0.0.5",
"remove-trailing-spaces": "^1.0.7"
},
"overrides": {
"nid-parser": {
Expand Down
30 changes: 30 additions & 0 deletions scripts/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,38 @@ if [[ ${COMMIT_MESSAGE} =~ "[skip tests]" ]]; then
fi;


# The Linux Release build embeds full DWARF debug info (binding.gyp passes -g so
# a local `npm run build` stays debuggable), which balloons the addon from
# ~0.5MB to ~5MB. Strip the packaged copy — and only that copy, right before
# `node-pre-gyp package` archives it — so every user's download shrinks ~90%
# while local builds keep their symbols.
function strip_binaries() {
echo "### Stripping prebuilt ###"
local os
os=$(uname -s)
for f in lib/binding/*/node_gtk.node; do
[[ -e "$f" ]] || continue
local before after
before=$(wc -c < "$f")
if [[ $os == 'Darwin' ]]; then
strip -x "$f";
else
strip --strip-unneeded "$f";
fi
after=$(wc -c < "$f")
echo " $f: ${before} -> ${after} bytes"
done

# Stripping runs after the test job, so a strip that produced an unloadable
# addon would otherwise ship unnoticed. Smoke-test the stripped binary here;
# `set -e` aborts the publish if it can no longer be loaded.
node -e "require('./lib/index.js').require('GLib', '2.0')"
echo " stripped addon loads OK"
}

function publish() {
echo "### Publish ###"
strip_binaries
if [[ $PUBLISH_BINARIES == true ]]; then
npx node-pre-gyp package testpackage;
npx node-pre-gyp publish;
Expand Down
4 changes: 2 additions & 2 deletions tests/__common__.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

const chalk = require('chalk')
const isEqual = require('lodash.isequal')
const { isDeepStrictEqual } = require('node:util')

module.exports = {
assert,
Expand Down Expand Up @@ -38,7 +38,7 @@ function isntUndefined(value, message) {
}

function expect(value, expected) {
assert(isEqual(value, expected),
assert(isDeepStrictEqual(value, expected),
`Expected: "${expected}", got: "${value}"`)
return value
}
Expand Down
Loading