Commit graph

135 commits

Author SHA1 Message Date
Felix Rieseberg
3d8f0e509e fix: Handle promises stream 2024-10-07 11:45:14 -04:00
Luke Karrys
4e493d4fb2
chore: misc testing fixes (#2930)
* chore: misc test fixes

* Sort test runs by os first

* Use cross-env for test env var

* Try sorting matrix params

* Make FAST_TEST the default and rename to FULL_TEST

* Separate helper functions to not need to export test obj in files
2023-10-28 14:13:10 -07:00
Luke Karrys
355622f4aa feat: convert all internal functions to async/await
BREAKING CHANGE: All internal functions have been coverted to return
promises and no longer accept callbacks. This is not a breaking change
for users but may be breaking to consumers of `node-gyp` if you are
requiring internal functions directly.
2023-10-28 08:59:57 -07:00
Luke Karrys
192eec2aca
Sync deps and engines with npm (#2770)
* feat!: update `engines.node` to `^14.17.0 || ^16.13.0 || >=18.0.0`

* deps: nopt@^7.0.0

* feat: replace npmlog with proc-log

* deps: standard@17.0.0 and fix linting errors

* deps: which@3.0.0
- this also promiisifies the build command

* deps: glob@8.0.3

* feat: drop rimraf dependency

* fix: use fs/promises in favor of fs.promises
2023-06-20 15:44:18 +02:00
Stefan Stojanovic
7a3fe1c437
win,install: only download target_arch node.lib (#2857)
Instead of downloading node.lib for all architectures, just download the
one that will be needed. Install.js changed to enable downloading just
node.lib for node versions that already have tarball downloaded and
extracted. Not fetching lib now fails the installation. Increased
installVersion because of the changes.

Refs: https://github.com/nodejs/node-gyp/issues/2847
2023-06-09 17:38:42 +02:00
David Sanders
55048f8be5
fix: log statement is for devDir not nodedir (#2840)
Signed-off-by: David Sanders <dsanders11@ucsbalum.com>
2023-06-06 07:36:15 +02:00
David Sanders
aaa117c514
fix: extract tarball to temp directory on Windows (#2846)
* fix: check for errors while extracting downloaded tarball

Signed-off-by: David Sanders <dsanders11@ucsbalum.com>

* test: parallel installs

Signed-off-by: David Sanders <dsanders11@ucsbalum.com>

* fix: extract tarball to temp directory on Windows

Signed-off-by: David Sanders <dsanders11@ucsbalum.com>

---------

Signed-off-by: David Sanders <dsanders11@ucsbalum.com>
2023-05-25 17:24:07 +02:00
Matias Lopez
e81602ef55
lib: migrate requests to fetch (#2220)
PR-URL: https://github.com/nodejs/node-gyp/pull/2220
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
2021-03-18 09:30:04 +08:00
Rod Vagg
4937722cf5
deps: replace mkdirp with {recursive} mkdir
only supported on Node.js 10+

Closes: #2084
PR-URL: https://github.com/nodejs/node-gyp/pull/2123
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
2020-06-03 12:56:39 +10:00
Matias Lopez
3bcba2a01a
lib: noproxy support, match proxy detection to request
PR-URL: https://github.com/nodejs/node-gyp/pull/1978
Reviewed-By: Rod Vagg <rod@vagg.org>
2019-12-16 10:53:03 +11:00
Richard Lau
f0693413d9
src,win: allow 403 errors for arm64 node.lib
The servers hosting the header packages for Electron return 403
instead of 404 for the constructed URL for arm64 node.lib for
older releases that do not support arm64.

PR-URL: https://github.com/nodejs/node-gyp/pull/1934
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: João Reis <reis@janeasystems.com>
2019-10-28 10:35:09 +11:00
Sam Hughes
032db2a2d0
lib,install: always download SHA sums on Windows
PR-URL: https://github.com/nodejs/node-gyp/pull/1926
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-10-21 12:15:11 +11:00
Rod Vagg
ab2a4cc209
src: update to standard@14
PR-URL: https://github.com/nodejs/node-gyp/pull/1899
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-10-02 13:57:30 +10:00
Richard Townsend
2441932dc4 src,win: add support for fetching arm64 node.lib
Windows on Arm support is available in some versions of Node.js v12 and
Electron v6. This update allows node-gyp to fetch the appropriate
node.lib to build native modules. If an arm64 binary is not available
for the target node version, it's logged but ignored.

arm64 is not expected to work in very old node.lib distribution formats,
the test URLs in these cases are added to be consistent with x64.

PR-URL: https://github.com/nodejs/node-gyp/pull/1875
Reviewed-By: João Reis <reis@janeasystems.com>
2019-09-30 22:49:26 +01:00
Milad Farazmand
038468388c
lib: adding keep-alive header to download requests
PR-URL: https://github.com/nodejs/node-gyp/pull/1863
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-09-26 11:58:27 +10:00
Rod Vagg
c4002dee1a
lib: ignore non-critical os.userInfo() failures
Fixes: https://github.com/nodejs/node-gyp/issues/1834
PR-URL: https://github.com/nodejs/node-gyp/pull/1835
2019-09-26 11:57:57 +10:00
Rod Vagg
e40c99e283
src: implement standard.js linting
In addition:

* moved module.exports to the bottom
* no single-line if statements
* no if statements without a {
* const for requires
* array declarations get spaces inside [ ]
* 'use strict' in all .js files

PR-URL: https://github.com/nodejs/node-gyp/pull/1794
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: João Reis <reis@janeasystems.com>
2019-07-06 14:36:37 +10:00
Pavel Medvedev
03683f09d6
lib: code de-duplication
Modified the result of processRelease() to return uniform names `libUrl`,
`libPath` for Windows in objects named as target platforms (`ia32` and `x64`)

This allows to loop over the target platforms in downloadNodeLib() and to use
the universal names instead of two almost identical code parts with `libUrl32`,
`libPath32` and `libUrl64`, `libPath64` names.

PR-URL: https://github.com/nodejs/node-gyp/pull/965
Reviewed-By: Rod Vagg <rod@vagg.org>
2019-06-22 12:04:25 +10:00
Selwyn
8098ebdeb4
deps: replace osenv dependency with native os
Breaking change: needs Node.js version 6 or higher

https://github.com/nodejs/node-gyp/pull/1570
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-04-24 10:29:00 +10:00
Jon Moss
a5b7410497
Add ESLint no-unused-vars rule
- Uses `.eslintrc.yaml` for configuration
- `npm run lint` is part of `npm test`

PR-URL: https://github.com/nodejs/node-gyp/pull/1497
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
2019-04-24 10:27:29 +10:00
Jon Moss
9e46872ea3
bin,lib: remove extra comments/lines/spaces
- Removes "module dependencies" comments and things that, IMHO, don't add
too much value. Happy to add back if helps some people when reading
through `node-gyp`.
- DRY up `lib/process-release.js`.
- Removes a bunch of extra blank lines, as well as random spaces.

PR-URL: https://github.com/nodejs/node-gyp/pull/1508
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-04-24 10:27:29 +10:00
isaacs
374519e066
Upgrade to tar v3
Tar version 3 performs better and is more well tested than its
predecessor.  npm will be using this in the near future, so there is no
benefit in shipping a node-gyp that uses the slower and less reliable
fstream-based tar.

This drops support for node 0.x, and thus should be considered a
breaking semver-major change.

PR-URL: https://github.com/nodejs/node-gyp/pull/1212
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2019-04-24 10:11:45 +10:00
Brian Woodward
88fc6fa0ec Drop dependency on minimatch.
PR-URL: https://github.com/nodejs/node-gyp/pull/1158
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2018-06-08 17:09:27 +02:00
Ben Noordhuis
6f1286f5b2 Fix infinite install loop.
Retry the download+install dance only once after encountering an EACCES.

That only happens when both the devdir (usually: `$HOME/.node-gyp`) and
the current working directory aren't writable.  Users won't often hit
that except through `sudo npm install` because npm drops privileges
before executing node-gyp.

Fixes: https://github.com/nodejs/node-gyp/issues/1383
PR-URL: https://github.com/nodejs/node-gyp/pull/1384
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2018-06-08 17:09:27 +02:00
Ben Noordhuis
8c4b0ffa50 Add --cafile command line option.
Add an option for overriding the default CA chain that is used when
downloading the tarball.  This matches the npm option of the same
name and gets implicitly passed through the `npm_config_cafile`
environment variable.

Fixes: https://github.com/nodejs/node-gyp/issues/695
PR-URL: https://github.com/nodejs/node-gyp/pull/837
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-12-10 14:08:19 +01:00
Ben Noordhuis
b3ad43498e Make download() function testable.
Move the function around so it can be tested and add a regression test.

As a policy vs. mechanism thing, change the control flow to handle
exceptions at the call site, not inside the download function.

PR-URL: https://github.com/nodejs/node-gyp/pull/837
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-12-10 14:05:25 +01:00
Rod Vagg
938dd18d1c refactor for clarity, fix dist-url, add env var dist-url functionality
PR-URL: https://github.com/nodejs/node-gyp/pull/711
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-09-08 10:01:07 +10:00
Rod Vagg
9e9df66a06 use process.release, make aware of io.js & node v4 differences
PR-URL: https://github.com/nodejs/node-gyp/pull/711
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-09-08 09:59:31 +10:00
Ben Noordhuis
0fbc387b35 Update repository URLs.
The project was moved from https://github.com/TooTallNate/node-gyp to
https://github.com/nodejs/node-gyp.  Update a handful of links that
still pointed to the old location.

PR-URL: https://github.com/nodejs/node-gyp/pull/715
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2015-09-06 06:41:01 +02:00
Jakob Krigovsky
83574785f1 Use HTTPS for dist url 2015-07-05 14:11:10 +02:00
Tom X. Tobin
41d8025c6a Fix download error message spelling 2015-06-06 12:52:08 -04:00
Nathan Rajlich
06e6c4cea5 Merge pull request #379 from robertkowalski/better-error-message
Show better error message in case of bad network settings
2015-05-24 14:17:42 -07:00
Nathan Rajlich
df58477c50 Merge pull request #593 from chapel/master
Avoid downloading shasums if using tarPath
2015-05-24 14:14:49 -07:00
DC
8dfcf9187a Show URL when a download fails
This makes issues like #623 easier to debug
2015-05-12 04:37:14 -07:00
Jacob Chapel
b4bfb5161f Avoid downloading shasums if using tarPath 2015-03-17 17:06:04 -07:00
freewil
9791c11be3 use sha256 checksums starting with node v0.10.0 2014-06-15 21:47:27 -07:00
Nathan Rajlich
e2dc55290a install: minor cleanup 2014-03-04 14:15:01 -08:00
fengmk2
869baee047 Check download content shasums with SHASUMS.txt. fixed npm/npm#4541 2014-01-24 18:39:51 +08:00
Robert Kowalski
dbb68c5ee3 Show better error message in case of bad network settings
Instead of just showing Error: getaddrinfo ENOTFOUND
this will show an error message to the user
2014-01-02 21:41:28 +01:00
vinayr
0cc243e459 install: add --tarball option
Squashed commit of the following:

commit f6d0838f1ddbf09ad91633a7bafa06bbbe7e8365
Author: vinayr <vinay.rv@gmail.com>
Date:   Sun Oct 20 18:09:47 2013 +0900

    changed tarball-url to tarball

commit 080bf66fb27586033f79657d91463232976fde8a
Merge: a06f16f f28088a
Author: vin <vin@vin-VirtualBox.(none)>
Date:   Sun Oct 20 18:03:56 2013 +0900

    Merge remote-tracking branch 'upstream/master'

commit a06f16f645922bfae491cd1b6bb12ca55619bd5b
Author: vinayr <vinay.rv@gmail.com>
Date:   Wed Sep 4 15:08:53 2013 +0900

    set tarball url

commit 003ec4ade5803e3fca397acbf5b303fa7291056e
Author: vinayr <vinay.rv@gmail.com>
Date:   Wed Sep 4 14:17:19 2013 +0900

    set tarball url

Closes #321.
2013-10-20 11:28:11 -07:00
Nathan Rajlich
99ff180cdd install: send User-Agent header
For @tjfontaine
2013-09-06 14:25:28 -07:00
Nathan Rajlich
089fe4d352 install: remove "legacy" installation logic
Now that v0.8.x of node.js is the minimum supported version of node-gyp,
this legacy logic is no longer releavant.
2013-06-24 14:24:51 -07:00
Nathan Rajlich
fedca411d8 install: remove unused trim() function 2013-06-24 14:15:55 -07:00
isaacs
61c4f59264 update "semver" to 2.0.7 2013-06-20 13:42:20 -07:00
Cheng Zhao
afbcdea1ff Add disturl as alias for dist-url. 2013-02-22 15:34:17 +08:00
Maciej Małecki
fbb514defc install: support custom build tags
Needed because of joyent/node#4448.
Closes #176.
2012-12-21 12:15:38 -08:00
Nathan Rajlich
c75801f470 install: don't extract the "gyp" dir from the node tarball 2012-11-14 16:42:13 -08:00
Maciej Małecki
ab8e4b4291 install: allow for configuring dist url
Closes #141.
2012-10-01 17:28:45 -07:00
Nathan Rajlich
233b8070aa install: try to catch and handle "EACESS" errors a little earlier
Hopefully this fixes error reports like #132.
2012-09-24 18:06:08 -07:00
Nathan Rajlich
660cd323da Revert "install: only extract the common.gypi file from the tarball"
This reverts commit 1b85c397f0.
2012-08-13 10:20:15 -07:00