Skip to content

Commit

Permalink
deps: replace osenv dependency with native os
Browse files Browse the repository at this point in the history
Breaking change: needs Node.js version 6 or higher

#1570
Reviewed-By: Refael Ackermann <refack@gmail.com>
  • Loading branch information
Siilwyn authored and rvagg committed Apr 24, 2019
1 parent 92e8b52 commit 8098ebd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bin/node-gyp.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ process.title = 'node-gyp'

var gyp = require('../')
var log = require('npmlog')
var osenv = require('osenv')
var os = require('os')
var path = require('path')

/**
Expand All @@ -16,7 +16,7 @@ var completed = false
prog.parseArgv(process.argv)
prog.devDir = prog.opts.devdir

var homeDir = osenv.home()
var homeDir = os.homedir()
if (prog.devDir) {
prog.devDir = prog.devDir.replace(/^~/, homeDir)
} else if (homeDir) {
Expand Down
4 changes: 2 additions & 2 deletions lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports.test = {
var fs = require('graceful-fs')
, path = require('path')
, log = require('npmlog')
, osenv = require('osenv')
, os = require('os')
, which = require('which')
, semver = require('semver')
, mkdirp = require('mkdirp')
Expand Down Expand Up @@ -46,7 +46,7 @@ function configure (gyp, argv, callback) {

if (gyp.opts.nodedir) {
// --nodedir was specified. use that for the dev files
nodeDir = gyp.opts.nodedir.replace(/^~/, osenv.home())
nodeDir = gyp.opts.nodedir.replace(/^~/, os.homedir())

log.verbose('get node dir', 'compiling against specified --nodedir dev files: %s', nodeDir)
createBuildDir()
Expand Down
6 changes: 3 additions & 3 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports.test = {
exports.usage = 'Install node development files for the specified node version.'

var fs = require('graceful-fs')
, osenv = require('osenv')
, os = require('os')
, tar = require('tar')
, path = require('path')
, crypto = require('crypto')
Expand Down Expand Up @@ -400,9 +400,9 @@ function install (fs, gyp, argv, callback) {
function eaccesFallback (err) {
var noretry = '--node_gyp_internal_noretry'
if (-1 !== argv.indexOf(noretry)) return cb(err)
var tmpdir = osenv.tmpdir()
var tmpdir = os.tmpdir()
gyp.devDir = path.resolve(tmpdir, '.node-gyp')
log.warn('EACCES', 'user "%s" does not have permission to access the dev dir "%s"', osenv.user(), devDir)
log.warn('EACCES', 'user "%s" does not have permission to access the dev dir "%s"', os.userInfo().username, devDir)
log.warn('EACCES', 'attempting to reinstall using temporary dev dir "%s"', gyp.devDir)
if (process.cwd() == tmpdir) {
log.verbose('tmpdir == cwd', 'automatically will remove dev files after to save disk space')
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@
"mkdirp": "^0.5.0",
"nopt": "2 || 3",
"npmlog": "0 || 1 || 2 || 3 || 4",
"osenv": "0",
"request": "^2.87.0",
"rimraf": "2",
"semver": "~5.3.0",
"tar": "^4.4.8",
"which": "1"
},
"engines": {
"node": ">= 4.0.0"
"node": ">= 6.0.0"
},
"devDependencies": {
"babel-eslint": "^8.2.5",
Expand Down

0 comments on commit 8098ebd

Please sign in to comment.