Skip to content

Commit

Permalink
Remove the user-home package in favor of built-in os.homedir() (#65)
Browse files Browse the repository at this point in the history
The `os.homedir()` works on Node.js v12 and newer
  • Loading branch information
jozefizso authored Dec 29, 2024
1 parent 98c4fcb commit df65616
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/rules/bowerrc-home.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/global-config.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/yo-rc-home.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit df65616

Please sign in to comment.