From df65616a23f9c984f2cfbf44fc48800b85dc0fe2 Mon Sep 17 00:00:00 2001 From: Jozef Izso Date: Sun, 29 Dec 2024 19:56:34 +0100 Subject: [PATCH] Remove the `user-home` package in favor of built-in `os.homedir()` (#65) The `os.homedir()` works on Node.js v12 and newer --- lib/rules/bowerrc-home.js | 4 ++-- lib/rules/global-config.js | 4 ++-- lib/rules/yo-rc-home.js | 4 ++-- package.json | 3 +-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/rules/bowerrc-home.js b/lib/rules/bowerrc-home.js index 0d3ca4b..9bdb7b2 100644 --- a/lib/rules/bowerrc-home.js +++ b/lib/rules/bowerrc-home.js @@ -1,7 +1,7 @@ 'use strict'; const fs = require('fs'); const path = require('path'); -const userHome = require('user-home'); +const os = require('os'); const message = require('../message'); exports.description = 'No .bowerrc file in home directory'; @@ -17,7 +17,7 @@ const errors = { }; exports.errors = errors; -exports.bowerrcPath = path.join(userHome, '.bowerrc'); +exports.bowerrcPath = path.join(os.homedir(), '.bowerrc'); exports.verify = async () => { const exists = fs.existsSync(this.bowerrcPath); diff --git a/lib/rules/global-config.js b/lib/rules/global-config.js index 19e625e..62f11bb 100644 --- a/lib/rules/global-config.js +++ b/lib/rules/global-config.js @@ -1,7 +1,7 @@ 'use strict'; const path = require('path'); const fs = require('fs'); -const userHome = require('user-home'); +const os = require('os'); const message = require('../message'); exports.description = 'Global configuration file is valid'; @@ -22,7 +22,7 @@ const errors = { }; exports.errors = errors; -exports.configPath = path.join(userHome, '.yo-rc-global.json'); +exports.configPath = path.join(os.homedir(), '.yo-rc-global.json'); exports.verify = async () => { if (!fs.existsSync(this.configPath)) { diff --git a/lib/rules/yo-rc-home.js b/lib/rules/yo-rc-home.js index ca33a26..1af8e14 100644 --- a/lib/rules/yo-rc-home.js +++ b/lib/rules/yo-rc-home.js @@ -1,7 +1,7 @@ 'use strict'; const fs = require('fs'); const path = require('path'); -const userHome = require('user-home'); +const os = require('os'); const message = require('../message'); exports.description = 'No .yo-rc.json file in home directory'; @@ -17,7 +17,7 @@ const errors = { }; exports.errors = errors; -exports.yorcPath = path.join(userHome, '.yo-rc.json'); +exports.yorcPath = path.join(os.homedir(), '.yo-rc.json'); exports.verify = async () => { const exists = fs.existsSync(this.yorcPath); diff --git a/package.json b/package.json index a940b71..0fd4fac 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,7 @@ "latest-version": "^3.1.0", "log-symbols": "^2.1.0", "semver": "^5.0.3", - "twig": "^1.10.5", - "user-home": "^2.0.0" + "twig": "^1.10.5" }, "devDependencies": { "mocha": "^4.1.0",