Skip to content

Commit f284dd0

Browse files
fiskerkeithamus
authored andcommittedDec 28, 2019
feat: support binary field for node-pre-gyp (#109)
1 parent 2108c5a commit f284dd0

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed
 

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ npx sort-package-json
113113
- [jest](https://jestjs.io/)
114114
- [Istanbul](https://istanbul.js.org/)
115115
- [Mocha](https://mochajs.org/)
116+
- [node-pre-gyp](https://github.com/mapbox/node-pre-gyp/)
116117
- [xo](https://github.com/xojs/xo)
117118
- [prettier](https://prettier.io/)
118119

‎index.js

+11
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ const fields = [
9393
{ key: 'man', over: sortObject },
9494
{ key: 'directories', over: sortDirectories },
9595
{ key: 'workspaces' },
96+
// node-pre-gyp https://www.npmjs.com/package/node-pre-gyp#1-add-new-entries-to-your-packagejson
97+
{
98+
key: 'binary',
99+
over: sortObjectBy([
100+
'module_name',
101+
'module_path',
102+
'remote_path',
103+
'package_name',
104+
'host',
105+
]),
106+
},
96107
{ key: 'scripts', over: sortScripts },
97108
{ key: 'betterScripts', over: sortScripts },
98109
{ key: 'husky' },

‎test.js

+23
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,29 @@ for (const field of [
230230
])
231231
}
232232

233+
testField('binary', [
234+
{
235+
value: {
236+
[UNKNOWN]: UNKNOWN,
237+
module_name: 'node_addon_example',
238+
module_path:
239+
'./lib/binding/{configuration}/{node_abi}-{platform}-{arch}/',
240+
remote_path: './{module_name}/v{version}/{configuration}/',
241+
package_name:
242+
'{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz',
243+
host: 'https://node-pre-gyp-tests.s3-us-west-1.amazonaws.com',
244+
},
245+
expect: [
246+
'module_name',
247+
'module_path',
248+
'remote_path',
249+
'package_name',
250+
'host',
251+
UNKNOWN,
252+
],
253+
},
254+
])
255+
233256
testField('keywords', [
234257
{
235258
value: ['foo', 'foo'],

0 commit comments

Comments
 (0)
Please sign in to comment.