Skip to content
This repository was archived by the owner on Feb 19, 2026. It is now read-only.

Commit 734ae27

Browse files
committed
Bump standard devDependency
1 parent 477f347 commit 734ae27

16 files changed

Lines changed: 266 additions & 265 deletions

asset.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
var get = require('simple-get')
2-
var util = require('./util')
3-
var proxy = require('./proxy')
1+
const get = require('simple-get')
2+
const util = require('./util')
3+
const proxy = require('./proxy')
44

55
function findAssetId (opts, cb) {
6-
var downloadUrl = util.getDownloadUrl(opts)
7-
var apiUrl = util.getApiUrl(opts)
8-
var log = opts.log || util.noopLogger
6+
const downloadUrl = util.getDownloadUrl(opts)
7+
const apiUrl = util.getApiUrl(opts)
8+
const log = opts.log || util.noopLogger
99

1010
log.http('request', 'GET ' + apiUrl)
11-
var reqOpts = proxy({
11+
const reqOpts = proxy({
1212
url: apiUrl,
1313
json: true,
1414
headers: {
@@ -17,15 +17,15 @@ function findAssetId (opts, cb) {
1717
}
1818
}, opts)
1919

20-
var req = get.concat(reqOpts, function (err, res, data) {
20+
const req = get.concat(reqOpts, function (err, res, data) {
2121
if (err) return cb(err)
2222
log.http(res.statusCode, apiUrl)
2323
if (res.statusCode !== 200) return cb(err)
2424

2525
// Find asset id in release
26-
for (var release of data) {
26+
for (const release of data) {
2727
if (release.tag_name === opts['tag-prefix'] + opts.pkg.version) {
28-
for (var asset of release.assets) {
28+
for (const asset of release.assets) {
2929
if (asset.browser_download_url === downloadUrl) {
3030
return cb(null, asset.id)
3131
}

bin.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#!/usr/bin/env node
22

3-
var path = require('path')
4-
var fs = require('fs')
5-
var napi = require('napi-build-utils')
3+
const path = require('path')
4+
const fs = require('fs')
5+
const napi = require('napi-build-utils')
66

7-
var pkg = require(path.resolve('package.json'))
8-
var rc = require('./rc')(pkg)
9-
var log = require('./log')(rc, process.env)
10-
var download = require('./download')
11-
var asset = require('./asset')
12-
var util = require('./util')
7+
const pkg = require(path.resolve('package.json'))
8+
const rc = require('./rc')(pkg)
9+
const log = require('./log')(rc, process.env)
10+
const download = require('./download')
11+
const asset = require('./asset')
12+
const util = require('./util')
1313

14-
var prebuildClientVersion = require('./package.json').version
14+
const prebuildClientVersion = require('./package.json').version
1515
if (rc.version) {
1616
console.log(prebuildClientVersion)
1717
process.exit(0)
@@ -37,11 +37,11 @@ if (rc.help) {
3737

3838
log.info('begin', 'Prebuild-install version', prebuildClientVersion)
3939

40-
var opts = Object.assign({}, rc, { pkg: pkg, log: log })
40+
const opts = Object.assign({}, rc, { pkg: pkg, log: log })
4141

4242
if (napi.isNapiRuntime(rc.runtime)) napi.logUnsupportedVersion(rc.target, log)
4343

44-
var origin = util.packageOrigin(process.env, pkg)
44+
const origin = util.packageOrigin(process.env, pkg)
4545

4646
if (opts.force) {
4747
log.warn('install', 'prebuilt binaries enforced with --force!')
@@ -54,7 +54,7 @@ if (opts.force) {
5454
process.exit(1)
5555
}
5656

57-
var startDownload = function (downloadUrl) {
57+
const startDownload = function (downloadUrl) {
5858
download(downloadUrl, opts, function (err) {
5959
if (err) {
6060
log.warn('install', err.message)

download.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
var path = require('path')
2-
var fs = require('fs')
3-
var get = require('simple-get')
4-
var pump = require('pump')
5-
var tfs = require('tar-fs')
6-
var zlib = require('zlib')
7-
var util = require('./util')
8-
var error = require('./error')
9-
var proxy = require('./proxy')
10-
var mkdirp = require('mkdirp-classic')
1+
const path = require('path')
2+
const fs = require('fs')
3+
const get = require('simple-get')
4+
const pump = require('pump')
5+
const tfs = require('tar-fs')
6+
const zlib = require('zlib')
7+
const util = require('./util')
8+
const error = require('./error')
9+
const proxy = require('./proxy')
10+
const mkdirp = require('mkdirp-classic')
1111

1212
function downloadPrebuild (downloadUrl, opts, cb) {
13-
var cachedPrebuild = util.cachedPrebuild(downloadUrl)
14-
var localPrebuild = util.localPrebuild(downloadUrl, opts)
15-
var tempFile = util.tempFile(cachedPrebuild)
16-
var log = opts.log || util.noopLogger
13+
let cachedPrebuild = util.cachedPrebuild(downloadUrl)
14+
const localPrebuild = util.localPrebuild(downloadUrl, opts)
15+
const tempFile = util.tempFile(cachedPrebuild)
16+
const log = opts.log || util.noopLogger
1717

1818
if (opts.nolocal) return download()
1919

@@ -40,7 +40,7 @@ function downloadPrebuild (downloadUrl, opts, cb) {
4040
}
4141

4242
log.http('request', 'GET ' + downloadUrl)
43-
var reqOpts = proxy({ url: downloadUrl }, opts)
43+
const reqOpts = proxy({ url: downloadUrl }, opts)
4444

4545
if (opts.token) {
4646
reqOpts.headers = {
@@ -50,7 +50,7 @@ function downloadPrebuild (downloadUrl, opts, cb) {
5050
}
5151
}
5252

53-
var req = get(reqOpts, function (err, res) {
53+
const req = get(reqOpts, function (err, res) {
5454
if (err) return onerror(err)
5555
log.http(res.statusCode, downloadUrl)
5656
if (res.statusCode !== 200) return onerror()
@@ -81,26 +81,26 @@ function downloadPrebuild (downloadUrl, opts, cb) {
8181
}
8282

8383
function unpack () {
84-
var binaryName
84+
let binaryName
8585

86-
var updateName = opts.updateName || function (entry) {
86+
const updateName = opts.updateName || function (entry) {
8787
if (/\.node$/i.test(entry.name)) binaryName = entry.name
8888
}
8989

9090
log.info('unpacking @', cachedPrebuild)
9191

92-
var options = {
92+
const options = {
9393
readable: true,
9494
writable: true,
9595
hardlinkAsFilesFallback: true
9696
}
97-
var extract = tfs.extract(opts.path, options).on('entry', updateName)
97+
const extract = tfs.extract(opts.path, options).on('entry', updateName)
9898

9999
pump(fs.createReadStream(cachedPrebuild), zlib.createGunzip(), extract,
100100
function (err) {
101101
if (err) return cb(err)
102102

103-
var resolved
103+
let resolved
104104
if (binaryName) {
105105
try {
106106
resolved = path.resolve(opts.path || '.', binaryName)
@@ -124,7 +124,7 @@ function downloadPrebuild (downloadUrl, opts, cb) {
124124
}
125125

126126
function ensureNpmCacheDir (cb) {
127-
var cacheFolder = util.npmCache()
127+
const cacheFolder = util.npmCache()
128128
fs.access(cacheFolder, fs.R_OK | fs.W_OK, function (err) {
129129
if (err && err.code === 'ENOENT') {
130130
return makeNpmCacheDir()

log.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
var log = require('npmlog')
2-
var fs = require('fs')
3-
var path = require('path')
1+
const log = require('npmlog')
2+
const fs = require('fs')
3+
const path = require('path')
44

55
module.exports = function (rc, env) {
66
log.heading = 'prebuild-install'
@@ -13,7 +13,7 @@ module.exports = function (rc, env) {
1313

1414
// Temporary workaround for npm 7 which swallows our output
1515
if (process.env.npm_config_prebuild_install_logfile) {
16-
var fp = path.resolve(process.env.npm_config_prebuild_install_logfile)
16+
const fp = path.resolve(process.env.npm_config_prebuild_install_logfile)
1717

1818
log.on('log', function (msg) {
1919
// Only for tests, don't care about performance

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
"version": "6.1.4",
44
"description": "A command line tool to easily install prebuilt binaries for multiple version of node/iojs on a specific platform",
55
"scripts": {
6-
"test": "tape test/*-test.js && npm run lint",
7-
"lint": "standard && hallmark",
6+
"test": "standard && hallmark && tape test/*-test.js",
87
"hallmark": "hallmark --fix"
98
},
109
"keywords": [
@@ -39,7 +38,7 @@
3938
"hallmark": "^3.0.0",
4039
"nock": "^10.0.6",
4140
"rimraf": "^2.5.2",
42-
"standard": "^13.0.2",
41+
"standard": "^16.0.4",
4342
"tape": "^4.5.1",
4443
"tempy": "0.2.1"
4544
},

proxy.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
var url = require('url')
2-
var tunnel = require('tunnel-agent')
3-
var util = require('./util')
1+
const url = require('url')
2+
const tunnel = require('tunnel-agent')
3+
const util = require('./util')
44

55
function applyProxy (reqOpts, opts) {
6-
var log = opts.log || util.noopLogger
6+
const log = opts.log || util.noopLogger
77

8-
var proxy = opts['https-proxy'] || opts.proxy
8+
const proxy = opts['https-proxy'] || opts.proxy
99

1010
if (proxy) {
1111
// eslint-disable-next-line node/no-deprecated-api
12-
var parsedDownloadUrl = url.parse(reqOpts.url)
12+
const parsedDownloadUrl = url.parse(reqOpts.url)
1313
// eslint-disable-next-line node/no-deprecated-api
14-
var parsedProxy = url.parse(proxy)
15-
var uriProtocol = (parsedDownloadUrl.protocol === 'https:' ? 'https' : 'http')
16-
var proxyProtocol = (parsedProxy.protocol === 'https:' ? 'Https' : 'Http')
17-
var tunnelFnName = [uriProtocol, proxyProtocol].join('Over')
14+
const parsedProxy = url.parse(proxy)
15+
const uriProtocol = (parsedDownloadUrl.protocol === 'https:' ? 'https' : 'http')
16+
const proxyProtocol = (parsedProxy.protocol === 'https:' ? 'Https' : 'Http')
17+
const tunnelFnName = [uriProtocol, proxyProtocol].join('Over')
1818
reqOpts.agent = tunnel[tunnelFnName]({
1919
proxy: {
2020
host: parsedProxy.hostname,

rc.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
var path = require('path')
2-
var minimist = require('minimist')
3-
var getAbi = require('node-abi').getAbi
4-
var detectLibc = require('detect-libc')
5-
var napi = require('napi-build-utils')
1+
const path = require('path')
2+
const minimist = require('minimist')
3+
const getAbi = require('node-abi').getAbi
4+
const detectLibc = require('detect-libc')
5+
const napi = require('napi-build-utils')
66

7-
var env = process.env
8-
var libc = env.LIBC || (detectLibc.isNonGlibcLinux && detectLibc.family) || ''
7+
const env = process.env
8+
const libc = env.LIBC || (detectLibc.isNonGlibcLinux && detectLibc.family) || ''
99

1010
// Get the configuration
1111
module.exports = function (pkg) {
12-
var pkgConf = pkg.config || {}
13-
var buildFromSource = env.npm_config_build_from_source
12+
const pkgConf = pkg.config || {}
13+
const buildFromSource = env.npm_config_build_from_source
1414

15-
var rc = require('rc')('prebuild-install', {
15+
const rc = require('rc')('prebuild-install', {
1616
target: pkgConf.target || env.npm_config_target || process.versions.node,
1717
runtime: pkgConf.runtime || env.npm_config_runtime || 'node',
1818
arch: pkgConf.arch || env.npm_config_arch || process.arch,
@@ -23,8 +23,8 @@ module.exports = function (pkg) {
2323
verbose: env.npm_config_verbose === 'true',
2424
buildFromSource: buildFromSource === pkg.name || buildFromSource === 'true',
2525
path: '.',
26-
proxy: env.npm_config_proxy || env['http_proxy'] || env['HTTP_PROXY'],
27-
'https-proxy': env.npm_config_https_proxy || env['https_proxy'] || env['HTTPS_PROXY'],
26+
proxy: env.npm_config_proxy || env.http_proxy || env.HTTP_PROXY,
27+
'https-proxy': env.npm_config_https_proxy || env.https_proxy || env.HTTPS_PROXY,
2828
'local-address': env.npm_config_local_address,
2929
'local-prebuilds': 'prebuilds',
3030
'tag-prefix': 'v',

test/asset-test.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
var test = require('tape')
2-
var fs = require('fs')
3-
var rm = require('rimraf')
4-
var path = require('path')
5-
var https = require('https')
6-
var download = require('../download')
7-
var util = require('../util')
8-
var asset = require('../asset')
9-
var nock = require('nock')
10-
var releases = require('./releases.json')
11-
12-
var build = path.join(__dirname, 'build')
13-
var unpacked = path.join(build, 'Release/leveldown.node')
1+
const test = require('tape')
2+
const fs = require('fs')
3+
const rm = require('rimraf')
4+
const path = require('path')
5+
const https = require('https')
6+
const download = require('../download')
7+
const util = require('../util')
8+
const asset = require('../asset')
9+
const nock = require('nock')
10+
const releases = require('./releases.json')
11+
12+
const build = path.join(__dirname, 'build')
13+
const unpacked = path.join(build, 'Release/leveldown.node')
1414

1515
// Release assets call
1616
nock('https://api.github.com:443', {
@@ -37,11 +37,11 @@ nock('https://api.github.com:443', {
3737
})
3838
.reply(302, undefined, {
3939
Location: function (req, res, body) {
40-
var assetId = req.path
40+
const assetId = req.path
4141
.replace('/repos/ralphtheninja/a-native-module/releases/assets/', '')
4242

43-
for (var release of releases) {
44-
for (var asset of release.assets) {
43+
for (const release of releases) {
44+
for (const asset of release.assets) {
4545
if (asset.id.toString() === assetId) {
4646
return asset.browser_download_url
4747
}
@@ -55,16 +55,16 @@ test('downloading from GitHub with token', function (t) {
5555
rm.sync(build)
5656
rm.sync(util.prebuildCache())
5757

58-
var opts = getOpts()
58+
const opts = getOpts()
5959
asset(opts, function (err, assetId) {
6060
t.error(err, 'no error')
6161

62-
var downloadUrl = util.getAssetUrl(opts, assetId)
63-
var cachedPrebuild = util.cachedPrebuild(downloadUrl)
64-
var tempFile
62+
const downloadUrl = util.getAssetUrl(opts, assetId)
63+
const cachedPrebuild = util.cachedPrebuild(downloadUrl)
64+
let tempFile
6565

66-
var writeStreamCount = 0
67-
var _createWriteStream = fs.createWriteStream
66+
let writeStreamCount = 0
67+
const _createWriteStream = fs.createWriteStream
6868
fs.createWriteStream = function (path) {
6969
if (writeStreamCount++ === 0) {
7070
tempFile = path
@@ -75,13 +75,13 @@ test('downloading from GitHub with token', function (t) {
7575
return _createWriteStream(path)
7676
}
7777

78-
var _createReadStream = fs.createReadStream
78+
const _createReadStream = fs.createReadStream
7979
fs.createReadStream = function (path) {
8080
t.equal(path, cachedPrebuild, 'createReadStream called for cachedPrebuild')
8181
return _createReadStream(path)
8282
}
8383

84-
var _request = https.request
84+
const _request = https.request
8585
https.request = function (req) {
8686
https.request = _request
8787
t.equal('https://' + req.hostname + req.path, downloadUrl, 'correct url')
@@ -107,14 +107,14 @@ test('non existing version should fail asset request', function (t) {
107107
rm.sync(build)
108108
rm.sync(util.prebuildCache())
109109

110-
var opts = getOpts()
110+
const opts = getOpts()
111111
opts.pkg = Object.assign({}, opts.pkg, { version: '0' })
112112
asset(opts, function (err, assetId) {
113113
t.ok(err, 'should error')
114114
t.equal(assetId, undefined)
115115

116-
var downloadUrl = util.getAssetUrl(opts, assetId)
117-
var cachedPrebuild = util.cachedPrebuild(downloadUrl)
116+
const downloadUrl = util.getAssetUrl(opts, assetId)
117+
const cachedPrebuild = util.cachedPrebuild(downloadUrl)
118118

119119
t.equal(fs.existsSync(cachedPrebuild), false, 'nothing cached')
120120
})

0 commit comments

Comments
 (0)