diff --git a/index.js b/index.js index ca9829a..732e835 100644 --- a/index.js +++ b/index.js @@ -131,7 +131,9 @@ function encodeName (name) { function prebuildName (target, opts) { var tags = [encodeName(opts.name || target.runtime)] - if (!opts.napi) { + if (opts.napi) { + tags.push('napi') + } else { tags.push('abi' + abi.getAbi(target.target, target.runtime)) } diff --git a/test/api.js b/test/api.js index bd6731c..a8e378d 100644 --- a/test/api.js +++ b/test/api.js @@ -20,6 +20,29 @@ test('build with current node version', function (t) { }) }) +test('runtime napi flags', function (t) { + prebuildify({ + cwd: path.join(__dirname, 'package'), + targets: [{ runtime: 'node', target: process.version }], + napi: true, + tagLibc: true // Should be glibc (unless you run these tests on Alpine) + }, function (err) { + t.ifError(err) + t.doesNotThrow(function () { + var folder = os.platform() + '-' + os.arch() + var name = [ + 'addon', + 'napi', + 'glibc', + 'node' + ].join('.') + var addon = require(path.join(__dirname, 'package', 'prebuilds', folder, name)) + t.equal(addon.check(), 'prebuildify') + }) + t.end() + }) +}) + test('uv, armv and libc tags', function (t) { prebuildify({ cwd: path.join(__dirname, 'package'),