From 5bfadcb168624949b8c6c254f301682c3917e288 Mon Sep 17 00:00:00 2001 From: Prabhu Subramanian Date: Mon, 9 Mar 2026 23:33:14 +0100 Subject: [PATCH] Switch to prebuildify Signed-off-by: Prabhu Subramanian Perf improvements Signed-off-by: Prabhu Subramanian --- .github/workflows/ci.yml | 78 +++++++---- deps/common-sqlite.gypi | 4 +- deps/sqlite3.gyp | 10 +- lib/bindings.js | 228 --------------------------------- lib/sqlite3-binding.js | 14 +- lib/sqlite3.js | 104 ++++++--------- lib/trace.js | 43 +++---- package.json | 39 ++---- tools/BinaryBuilder.Dockerfile | 16 ++- 9 files changed, 151 insertions(+), 385 deletions(-) delete mode 100644 lib/bindings.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd70d4c..c8a5cf7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,6 @@ concurrency: jobs: build: runs-on: ${{ matrix.os }} - permissions: - contents: write - packages: write - id-token: write strategy: fail-fast: false matrix: @@ -61,7 +57,7 @@ jobs: name: ${{ matrix.os }} (host=${{ matrix.host }}, target=${{ matrix.target }}) steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} @@ -102,41 +98,29 @@ jobs: echo "CXXFLAGS=${CXXFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV - name: Build binaries - run: yarn prebuild -a ${{ env.TARGET }} + run: yarn prebuild --arch ${{ env.TARGET }} --tag-libc - name: Print binary info if: contains(matrix.os, 'ubuntu') run: | - ldd build/**/node_sqlite3.node + ldd prebuilds/*/*.node echo "---" - nm build/**/node_sqlite3.node | grep "GLIBC_" | c++filt || true + nm prebuilds/*/*.node | grep "GLIBC_" | c++filt || true echo "---" - file build/**/node_sqlite3.node + file prebuilds/*/*.node - name: Run tests run: yarn test - - name: Upload binaries to commit artifacts + - name: Upload prebuilds to artifacts uses: actions/upload-artifact@v4 - if: matrix.node == 24 && matrix.os == 'ubuntu-22.04' with: - name: prebuilt-binaries - path: prebuilds/* + name: prebuilds-${{ matrix.os }}-${{ matrix.host }}-${{ matrix.target }}-${{ matrix.node }} + path: prebuilds/ retention-days: 7 - - name: Upload binaries to GitHub Release - run: yarn upload --upload-all ${{ github.token }} - if: startsWith(github.ref, 'refs/tags/') - - name: Publish - run: | - npm publish --provenance --access=public - if: matrix.node == 24 && matrix.os == 'ubuntu-22.04' && startsWith(github.ref, 'refs/tags/') build-qemu: runs-on: ubuntu-24.04-arm - permissions: - contents: write - packages: write - id-token: write strategy: fail-fast: false matrix: @@ -159,7 +143,7 @@ jobs: node: 22 name: ${{ matrix.variant }} (node=${{ matrix.node }}, target=${{ matrix.target }}) steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + - uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -180,7 +164,47 @@ jobs: . CONTAINER_ID=$(docker create -it sqlite-builder) docker cp $CONTAINER_ID:/usr/src/build/prebuilds/ ./prebuilds + - name: Sanitize target name for Artifact + run: | + SAFE_TARGET=$(echo "${{ matrix.target }}" | tr '/' '-') + echo "SAFE_TARGET=$SAFE_TARGET" >> $GITHUB_ENV + - name: Upload QEMU prebuilds to artifacts + uses: actions/upload-artifact@v4 + with: + name: prebuilds-qemu-${{ matrix.variant }}-${{ env.SAFE_TARGET }}-${{ matrix.node }} + path: prebuilds/ + retention-days: 7 + + publish: + needs: [build, build-qemu] + runs-on: ubuntu-22.04 + permissions: + contents: write + packages: write + id-token: write + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + scope: '@appthreat' + + - name: Download and merge all prebuilds + uses: actions/download-artifact@v4 + with: + pattern: prebuilds-* + path: prebuilds/ + merge-multiple: true + + - name: Add yarn + run: npm install -g yarn + + - name: Install dependencies + run: | + yarn install --ignore-scripts + npm publish --dry-run - - name: Upload binaries to GitHub Release - run: yarn install --ignore-scripts && yarn upload --upload-all ${{ github.token }} + - name: Publish to npm + run: npm publish --provenance --access=public if: startsWith(github.ref, 'refs/tags/') diff --git a/deps/common-sqlite.gypi b/deps/common-sqlite.gypi index 36d53c7..75250db 100644 --- a/deps/common-sqlite.gypi +++ b/deps/common-sqlite.gypi @@ -45,6 +45,8 @@ '-O2' ], 'GCC_OPTIMIZATION_LEVEL': '3', + 'LLVM_LTO': 'YES', + 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO', 'DEAD_CODE_STRIPPING': 'YES', 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES' @@ -57,4 +59,4 @@ } } } -} +} \ No newline at end of file diff --git a/deps/sqlite3.gyp b/deps/sqlite3.gyp index aee972b..758ec70 100755 --- a/deps/sqlite3.gyp +++ b/deps/sqlite3.gyp @@ -8,12 +8,12 @@ 'target_defaults': { 'default_configuration': 'Release', "cflags": [ - '-O3', '-flto', '-pipe', '-ffunction-sections', '-fdata-sections' + '-O3', '-flto', '-pipe', '-ffunction-sections', '-fdata-sections', '-fvisibility=hidden' ], 'cxxflags':[ - '-O3', '-flto', '-pipe', '-ffunction-sections', '-fdata-sections' + '-O3', '-flto', '-pipe', '-ffunction-sections', '-fdata-sections', '-fvisibility=hidden' ], - 'ldflags': [ '-flto', '-Wl,--gc-sections','-s' ], + 'ldflags': [ '-flto', '-Wl,--gc-sections', '-s' ], 'configurations': { 'Debug': { 'defines': [ 'DEBUG', '_DEBUG' ], @@ -35,6 +35,8 @@ 'msvs_settings': { 'VCCLCompilerTool': { 'Optimization': 2, # /O2 + 'FavorSizeOrSpeed': 1, # /Ot (Favor fast code) + 'StringPooling': 'true', # /GF 'EnableFunctionLevelLinking': 'true', # /Gy 'EnableIntrinsicFunctions': 'true', }, @@ -103,4 +105,4 @@ ], } ] -} +} \ No newline at end of file diff --git a/lib/bindings.js b/lib/bindings.js deleted file mode 100644 index 3143feb..0000000 --- a/lib/bindings.js +++ /dev/null @@ -1,228 +0,0 @@ -/** - * Module dependencies. - */ - -import fs from 'fs'; -import path from 'path'; -import { fileURLToPath } from 'url'; -import { createRequire } from 'module'; - -const require = createRequire(import.meta.url); - -const join = path.join; -const dirname = path.dirname; -const exists = - (fs.accessSync && - function(path) { - try { - fs.accessSync(path); - } catch (e) { - return false; - } - return true; - }) || - fs.existsSync || - path.existsSync; - -const defaults = { - arrow: process.env.NODE_BINDINGS_ARROW || ' → ', - compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled', - platform: process.platform, - arch: process.arch, - nodePreGyp: - 'node-v' + - process.versions.modules + - '-' + - process.platform + - '-' + - process.arch, - version: process.versions.node, - bindings: 'bindings.node', - try: [ - // node-gyp's linked version in the "build" dir - ['module_root', 'build', 'bindings'], - // node-waf and gyp_addon (a.k.a node-gyp) - ['module_root', 'build', 'Debug', 'bindings'], - ['module_root', 'build', 'Release', 'bindings'], - // Debug files, for development (legacy behavior, remove for node v0.9) - ['module_root', 'out', 'Debug', 'bindings'], - ['module_root', 'Debug', 'bindings'], - // Release files, but manually compiled (legacy behavior, remove for node v0.9) - ['module_root', 'out', 'Release', 'bindings'], - ['module_root', 'Release', 'bindings'], - // Legacy from node-waf, node <= 0.4.x - ['module_root', 'build', 'default', 'bindings'], - // Production "Release" buildtype binary (meh...) - ['module_root', 'compiled', 'version', 'platform', 'arch', 'bindings'], - // node-qbs builds - ['module_root', 'addon-build', 'release', 'install-root', 'bindings'], - ['module_root', 'addon-build', 'debug', 'install-root', 'bindings'], - ['module_root', 'addon-build', 'default', 'install-root', 'bindings'], - // node-pre-gyp path ./lib/binding/{node_abi}-{platform}-{arch} - ['module_root', 'lib', 'binding', 'nodePreGyp', 'bindings'] - ] -}; - -/** - * The main `bindings()` function loads the compiled bindings for a given module. - * It uses V8's Error API to determine the parent filename that this function is - * being invoked from, which is then used to find the root directory. - */ - -function bindings(opts) { - // Argument surgery - if (typeof opts == 'string') { - opts = { bindings: opts }; - } else if (!opts) { - opts = {}; - } - - // maps `defaults` onto `opts` object - Object.keys(defaults).map(function(i) { - if (!(i in opts)) opts[i] = defaults[i]; - }); - - // Get the module root - if (!opts.module_root) { - opts.module_root = getRoot(getFileName()); - } - - // Ensure the given bindings name ends with .node - if (path.extname(opts.bindings) != '.node') { - opts.bindings += '.node'; - } - - // https://github.com/webpack/webpack/issues/4175#issuecomment-342931035 - const requireFunc = - typeof __webpack_require__ === 'function' - ? __non_webpack_require__ - : require; - - const tries = []; - let i = 0; - const l = opts.try.length; - let n, b, err; - - for (; i < l; i++) { - n = join.apply( - null, - opts.try[i].map(function(p) { - return opts[p] || p; - }) - ); - tries.push(n); - try { - b = opts.path ? requireFunc.resolve(n) : requireFunc(n); - if (!opts.path) { - b.path = n; - } - return b; - } catch (e) { - if ( - e.code !== 'MODULE_NOT_FOUND' && - e.code !== 'QUALIFIED_PATH_RESOLUTION_FAILED' && - !/not find/i.test(e.message) - ) { - throw e; - } - } - } - - err = new Error( - 'Could not locate the bindings file. Tried:\n' + - tries - .map(function(a) { - return opts.arrow + a; - }) - .join('\n') - ); - err.tries = tries; - throw err; -} - -/** - * Gets the filename of the JavaScript file that invokes this function. - * Used to help find the root directory of a module. - * Optionally accepts an filename argument to skip when searching for the invoking filename - */ - -function getFileName(calling_file) { - const origPST = Error.prepareStackTrace; - const origSTL = Error.stackTraceLimit; - const dummy = {}; - let fileName; - - Error.stackTraceLimit = 10; - - Error.prepareStackTrace = function(e, st) { - for (let i = 0, l = st.length; i < l; i++) { - fileName = st[i].getFileName(); - if (fileName !== import.meta.url) { - if (calling_file) { - if (fileName !== calling_file) { - return; - } - } else { - return; - } - } - } - }; - - // run the 'prepareStackTrace' function above - Error.captureStackTrace(dummy); - dummy.stack; - - // cleanup - Error.prepareStackTrace = origPST; - Error.stackTraceLimit = origSTL; - - // handle filename that starts with "file://" - const fileSchema = 'file://'; - if (fileName && fileName.indexOf(fileSchema) === 0) { - fileName = fileURLToPath(fileName); - } - - return fileName; -} - -/** - * Gets the root directory of a module, given an arbitrary filename - * somewhere in the module tree. The "root directory" is the directory - * containing the `package.json` file. - * - * In: /home/nate/node-native-module/lib/index.js - * Out: /home/nate/node-native-module - */ - -function getRoot(file) { - let dir = dirname(file); - let prev; - while (true) { - if (dir === '.') { - // Avoids an infinite loop in rare cases, like the REPL - dir = process.cwd(); - } - if ( - exists(join(dir, 'package.json')) || - exists(join(dir, 'node_modules')) - ) { - // Found the 'package.json' file or 'node_modules' dir; we're done - return dir; - } - if (prev === dir) { - // Got to the top - throw new Error( - 'Could not find module root given file: "' + - file + - '". Do you have a `package.json` file? ' - ); - } - // Try the parent dir next - prev = dir; - dir = join(dir, '..'); - } -} - -export default bindings; -export { getFileName, getRoot }; \ No newline at end of file diff --git a/lib/sqlite3-binding.js b/lib/sqlite3-binding.js index a41876b..6186b46 100644 --- a/lib/sqlite3-binding.js +++ b/lib/sqlite3-binding.js @@ -1,2 +1,12 @@ -import bindings from './bindings.js'; -export default bindings('node_sqlite3.node'); \ No newline at end of file +import { fileURLToPath } from 'url'; +import { dirname, join } from 'path'; +import nodeGypBuild from 'node-gyp-build'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const rootDir = join(__dirname, '..'); + +const binding = nodeGypBuild(rootDir); + +export default binding; \ No newline at end of file diff --git a/lib/sqlite3.js b/lib/sqlite3.js index 0f9cce3..5cc4f38 100644 --- a/lib/sqlite3.js +++ b/lib/sqlite3.js @@ -4,26 +4,23 @@ import { EventEmitter } from 'events'; import { extendTrace } from "./trace.js"; function normalizeMethod(fn) { - return function(sql) { + return function(sql, ...args) { let errBack; - const args = Array.prototype.slice.call(arguments, 1); - if (typeof args[args.length - 1] === 'function') { + if (args.length > 0 && typeof args[args.length - 1] === 'function') { const callback = args[args.length - 1]; errBack = function(err) { - if (err) { - callback(err); - } + if (err) callback(err); }; } + const statement = new Statement(this, sql, errBack); return fn.call(this, statement, args); }; } function inherits(target, source) { - for (const k in source.prototype) - target.prototype[k] = source.prototype[k]; + Object.assign(target.prototype, source.prototype); } sqlite3.cached = { @@ -38,13 +35,12 @@ sqlite3.cached = { if (!sqlite3.cached.objects[file]) { db = sqlite3.cached.objects[file] = new Database(file, a, b); - } - else { + } else { // Make sure the callback is called. db = sqlite3.cached.objects[file]; const callback = (typeof a === 'number') ? b : a; if (typeof callback === 'function') { - function cb() { callback.call(db, null); } + const cb = () => callback.call(db, null); if (db.open) process.nextTick(cb); else db.once('open', cb); } @@ -55,9 +51,7 @@ sqlite3.cached = { objects: {} }; -const Database = sqlite3.Database; -const Statement = sqlite3.Statement; -const Backup = sqlite3.Backup; +const { Database, Statement, Backup } = sqlite3; inherits(Database, EventEmitter); inherits(Statement, EventEmitter); @@ -65,64 +59,58 @@ inherits(Backup, EventEmitter); // Database#prepare(sql, [bind1, bind2, ...], [callback]) Database.prototype.prepare = normalizeMethod(function(statement, params) { - return params.length - ? statement.bind.apply(statement, params) - : statement; + return params.length ? statement.bind(...params) : statement; }); // Database#run(sql, [bind1, bind2, ...], [callback]) Database.prototype.run = normalizeMethod(function(statement, params) { - statement.run.apply(statement, params).finalize(); + statement.run(...params).finalize(); return this; }); // Database#get(sql, [bind1, bind2, ...], [callback]) Database.prototype.get = normalizeMethod(function(statement, params) { - statement.get.apply(statement, params).finalize(); + statement.get(...params).finalize(); return this; }); // Database#all(sql, [bind1, bind2, ...], [callback]) Database.prototype.all = normalizeMethod(function(statement, params) { - statement.all.apply(statement, params).finalize(); + statement.all(...params).finalize(); return this; }); // Database#each(sql, [bind1, bind2, ...], [callback], [complete]) Database.prototype.each = normalizeMethod(function(statement, params) { - statement.each.apply(statement, params).finalize(); + statement.each(...params).finalize(); return this; }); Database.prototype.map = normalizeMethod(function(statement, params) { - statement.map.apply(statement, params).finalize(); + statement.map(...params).finalize(); return this; }); // Database#backup(filename, [callback]) // Database#backup(filename, destName, sourceName, filenameIsDest, [callback]) -Database.prototype.backup = function() { +Database.prototype.backup = function(...args) { let backup; - if (arguments.length <= 2) { - // By default, we write the main database out to the main database of the named file. - // This is the most likely use of the backup api. - backup = new Backup(this, arguments[0], 'main', 'main', true, arguments[1]); + if (args.length <= 2) { + backup = new Backup(this, args[0], 'main', 'main', true, args[1]); } else { - // Otherwise, give the user full control over the sqlite3_backup_init arguments. - backup = new Backup(this, arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]); + backup = new Backup(this, args[0], args[1], args[2], args[3], args[4]); } // Per the sqlite docs, exclude the following errors as non-fatal by default. backup.retryErrors = [sqlite3.BUSY, sqlite3.LOCKED]; return backup; }; -Statement.prototype.map = function() { - const params = Array.prototype.slice.call(arguments); +Statement.prototype.map = function(...params) { const callback = params.pop(); - params.push(function(err, rows) { + params.push((err, rows) => { if (err) return callback(err); const result = {}; - if (rows.length) { + if (rows && rows.length) { const keys = Object.keys(rows[0]); const key = keys[0]; if (keys.length > 2) { @@ -140,32 +128,32 @@ Statement.prototype.map = function() { } callback(err, result); }); - return this.all.apply(this, params); + return this.all(...params); }; let isVerbose = false; -const supportedEvents = [ 'trace', 'profile', 'change' ]; +const supportedEvents = new Set(['trace', 'profile', 'change']); -Database.prototype.addListener = Database.prototype.on = function(type) { - const val = EventEmitter.prototype.addListener.apply(this, arguments); - if (supportedEvents.indexOf(type) >= 0) { +Database.prototype.addListener = Database.prototype.on = function(type, ...args) { + const val = EventEmitter.prototype.addListener.call(this, type, ...args); + if (supportedEvents.has(type)) { this.configure(type, true); } return val; }; -Database.prototype.removeListener = function(type) { - const val = EventEmitter.prototype.removeListener.apply(this, arguments); - if (supportedEvents.indexOf(type) >= 0 && !this._events[type]) { +Database.prototype.removeListener = function(type, ...args) { + const val = EventEmitter.prototype.removeListener.call(this, type, ...args); + if (supportedEvents.has(type) && !this.listenerCount(type)) { this.configure(type, false); } return val; }; -Database.prototype.removeAllListeners = function(type) { - const val = EventEmitter.prototype.removeAllListeners.apply(this, arguments); - if (supportedEvents.indexOf(type) >= 0) { +Database.prototype.removeAllListeners = function(type, ...args) { + const val = EventEmitter.prototype.removeAllListeners.call(this, type, ...args); + if (supportedEvents.has(type)) { this.configure(type, false); } return val; @@ -175,29 +163,13 @@ Database.prototype.removeAllListeners = function(type) { sqlite3.verbose = function() { if (!isVerbose) { [ - 'prepare', - 'get', - 'run', - 'all', - 'each', - 'map', - 'close', - 'exec' - ].forEach(function (name) { - extendTrace(Database.prototype, name); - }); + 'prepare', 'get', 'run', 'all', 'each', 'map', 'close', 'exec' + ].forEach((name) => extendTrace(Database.prototype, name)); + [ - 'bind', - 'get', - 'run', - 'all', - 'each', - 'map', - 'reset', - 'finalize', - ].forEach(function (name) { - extendTrace(Statement.prototype, name); - }); + 'bind', 'get', 'run', 'all', 'each', 'map', 'reset', 'finalize' + ].forEach((name) => extendTrace(Statement.prototype, name)); + isVerbose = true; } return sqlite3; diff --git a/lib/trace.js b/lib/trace.js index c1a5994..0ecdb21 100644 --- a/lib/trace.js +++ b/lib/trace.js @@ -4,38 +4,37 @@ import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); -function extendTrace(object, property, pos) { +function extendTrace(object, property, pos = -1) { const old = object[property]; - object[property] = function() { - const error = new Error(); - const name = 'Database#run(' + - Array.prototype.slice.call(arguments).map(function(el) { - return util.inspect(el, false, 0); - }).join(', ') + ')'; - if (typeof pos === 'undefined') pos = -1; - if (pos < 0) pos += arguments.length; - const cb = arguments[pos]; - if (typeof arguments[pos] === 'function') { - arguments[pos] = function replacement() { - const err = arguments[0]; + object[property] = function(...args) { + const traceObj = {}; + Error.captureStackTrace(traceObj, object[property]); + let cbPos = pos < 0 ? args.length + pos : pos; + const cb = args[cbPos]; + + if (typeof cb === 'function') { + args[cbPos] = function replacement(err, ...cbArgs) { if (err && err.stack && !err.__augmented) { - err.stack = filter(err).join('\n'); - err.stack += '\n--> in ' + name; - err.stack += '\n' + filter(error).slice(1).join('\n'); + const name = 'Database#' + property + '(' + + args.map(el => util.inspect(el, false, 0)).join(', ') + + ')'; + + err.stack = filter(err.stack).join('\n') + + '\n--> in ' + name + + '\n' + filter(traceObj.stack).slice(1).join('\n'); err.__augmented = true; } - return cb.apply(this, arguments); + return cb.call(this, err, ...cbArgs); }; } - return old.apply(this, arguments); + return old.apply(this, args); }; } -function filter(error) { - return error.stack.split('\n').filter(function(line) { - return line.indexOf(__filename) < 0; - }); +function filter(stackStr) { + if (!stackStr) return []; + return stackStr.split('\n').filter(line => !line.includes(__filename)); } export { extendTrace, filter }; \ No newline at end of file diff --git a/package.json b/package.json index dc90582..6a3fee9 100644 --- a/package.json +++ b/package.json @@ -1,50 +1,32 @@ { "name": "@appthreat/sqlite3", - "description": "Asynchronous, non-blocking SQLite3 bindings. Forked from TryGhost/node-sqlite3", - "version": "7.0.4", + "description": "Asynchronous, non-blocking SQLite3 bindings. Modern rewrite of TryGhost/node-sqlite3", + "version": "8.0.0", "homepage": "https://github.com/AppThreat/node-sqlite3", "author": "Team AppThreat ", "binary": { "napi_versions": [9, 10] }, - "contributors": [ - "Daniel Lockyer ", - "Konstantin Käfer ", - "Dane Springmeyer ", - "Will White ", - "Orlando Vazquez ", - "Artem Kustikov ", - "Eric Fredricksen ", - "John Wright ", - "Ryan Dahl ", - "Tom MacWright ", - "Carter Thaxton ", - "Audrius Kažukauskas ", - "Johannes Schauer ", - "Nathan Rajlich ", - "AJ ONeal ", - "Mithgol", - "Ben Noordhuis " - ], "files": [ "binding.gyp", "deps/", "lib/*.js", "lib/*.d.ts", - "src/" + "src/", + "prebuilds/" ], "repository": { "type": "git", "url": "git+https://github.com/AppThreat/node-sqlite3.git" }, "dependencies": { - "node-addon-api": "^8.5.0", - "prebuild-install": "^7.1.3" + "node-addon-api": "^8.6.0", + "node-gyp-build": "^4.8.0" }, "devDependencies": { "eslint": "9.39.2", "mocha": "11.7.5", - "prebuild": "^13.0.1" + "prebuildify": "^6.0.1" }, "peerDependencies": { "node-gyp": "12.x" @@ -61,10 +43,9 @@ "node": ">=20" }, "scripts": { - "install": "prebuild-install -r napi || node-gyp rebuild", - "prebuild": "prebuild --runtime napi --all --verbose", + "install": "node-gyp-build", + "prebuild": "prebuildify --napi --strip", "rebuild": "node-gyp rebuild", - "upload": "prebuild --verbose --prerelease", "test": "node test/support/createdb.js && mocha -R spec --timeout 480000" }, "license": "BSD-3-Clause", @@ -77,4 +58,4 @@ "type": "module", "main": "./lib/sqlite3.js", "types": "./lib/sqlite3.d.ts" -} +} \ No newline at end of file diff --git a/tools/BinaryBuilder.Dockerfile b/tools/BinaryBuilder.Dockerfile index b90b1b5..73b13ba 100644 --- a/tools/BinaryBuilder.Dockerfile +++ b/tools/BinaryBuilder.Dockerfile @@ -12,12 +12,16 @@ WORKDIR /usr/src/build COPY . . RUN npm install --ignore-scripts -ENV CFLAGS="${CFLAGS:-} -include ../src/gcc-preinclude.h" -ENV CXXFLAGS="${CXXFLAGS:-} -include ../src/gcc-preinclude.h" -RUN npm run prebuild +RUN if case $VARIANT in "alpine"*) true;; *) false;; esac; then \ + npm run prebuild -- --tag-libc; \ + else \ + CFLAGS="${CFLAGS:-} -include ../src/gcc-preinclude.h" \ + CXXFLAGS="${CXXFLAGS:-} -include ../src/gcc-preinclude.h" \ + npm run prebuild -- --tag-libc; \ + fi -RUN if case $VARIANT in "alpine"*) false;; *) true;; esac; then ldd build/**/node_sqlite3.node; nm build/**/node_sqlite3.node | grep \"GLIBC_\" | c++filt || true ; fi +RUN if case $VARIANT in "alpine"*) false;; *) true;; esac; then ldd prebuilds/*/*.node; nm prebuilds/*/*.node | grep \"GLIBC_\" | c++filt || true ; fi -RUN npm run test +RUN npm run test && ls -l prebuilds -CMD ["sh"] +CMD ["sh"] \ No newline at end of file