From 6926407c8ba3e3e036d4328d8fff9a53c50aec65 Mon Sep 17 00:00:00 2001 From: Mohammed Keyvanzadeh Date: Sun, 26 Feb 2023 20:16:22 +0330 Subject: [PATCH] chore(deps): update deps and dev deps (#669) - Update the dependencies and developer dependencies to their latest versions. - Remove the `rimraf` dependency in favor of the built-in `fs.rmSync()` method. - Remove deprecated `eslint-plugin-standard` developer dependency as it's no longer needed. --- lib/auth.js | 8 +++---- lib/session.js | 8 +++---- package.json | 40 +++++++++++++++----------------- test/common.js | 4 +--- test/fixtures/run-auth-github.js | 3 ++- test/unit/auth.test.js | 12 ++++++---- 6 files changed, 35 insertions(+), 40 deletions(-) diff --git a/lib/auth.js b/lib/auth.js index 481d5b8f..c13ef196 100644 --- a/lib/auth.js +++ b/lib/auth.js @@ -1,13 +1,10 @@ import fs from 'node:fs'; import { ClientRequest } from 'node:http'; -import util from 'node:util'; -import ghauthBase from 'ghauth'; +import ghauth from 'ghauth'; import { getMergedConfig, getNcurcPath } from './config.js'; -const ghauth = util.promisify(ghauthBase); - export default lazy(auth); function errorExit(message) { @@ -50,7 +47,8 @@ async function tryCreateGitHubToken(githubAuth) { credentials = await githubAuth({ noSave: true, scopes: ['user:email', 'read:org'], - note: 'node-core-utils CLI tools' + note: 'node-core-utils CLI tools', + noDeviceFlow: true }); } catch (e) { errorExit(`Could not get token: ${e.message}`); diff --git a/lib/session.js b/lib/session.js index 18256c56..9b120f39 100644 --- a/lib/session.js +++ b/lib/session.js @@ -1,8 +1,6 @@ import path from 'node:path'; import fs from 'node:fs'; -import rimraf from 'rimraf'; - import { getMergedConfig, getNcuDir } from './config.js'; import { readJson, writeJson, readFile, writeFile } from './file.js'; import { @@ -148,13 +146,13 @@ export default class Session { try { sess = this.session; } catch (err) { - return rimraf.sync(this.sessionPath); + return fs.rmSync(this.sessionPath, { recursive: true, force: true }); } if (sess.prid && sess.prid === this.prid) { - rimraf.sync(this.pullDir); + fs.rmSync(this.pullDir, { recursive: true, force: true }); } - rimraf.sync(this.sessionPath); + fs.rmSync(this.sessionPath, { recursive: true, force: true }); } get statusPath() { diff --git a/package.json b/package.json index b419bd43..e468b575 100644 --- a/package.json +++ b/package.json @@ -34,38 +34,36 @@ ], "license": "MIT", "dependencies": { - "branch-diff": "^1.10.5", - "chalk": "^5.0.1", - "changelog-maker": "^2.8.0", + "branch-diff": "^2.1.0", + "chalk": "^5.2.0", + "changelog-maker": "^3.2.1", "cheerio": "^1.0.0-rc.10", "clipboardy": "^3.0.0", - "core-validate-commit": "^3.16.0", + "core-validate-commit": "^3.18.0", "enquirer": "^2.3.6", - "execa": "^6.1.0", - "figures": "^4.0.1", + "execa": "^7.0.0", + "figures": "^5.0.0", "form-data": "^4.0.0", - "ghauth": "^4.0.0", - "inquirer": "^8.2.4", - "listr2": "^4.0.5", + "ghauth": "^5.0.1", + "inquirer": "^9.1.4", + "listr2": "^5.0.7", "lodash": "^4.17.21", "log-symbols": "^5.1.0", - "ora": "^6.1.0", + "ora": "^6.1.2", "proxy-agent": "^5.0.0", - "replace-in-file": "^6.3.2", - "rimraf": "^3.0.2", + "replace-in-file": "^6.3.5", "undici": "^5.20.0", - "which": "^2.0.2", - "yargs": "^17.5.0" + "which": "^3.0.0", + "yargs": "^17.7.1" }, "devDependencies": { - "c8": "^7.11.2", - "eslint": "^8.15.0", + "c8": "^7.13.0", + "eslint": "^8.35.0", "eslint-config-standard": "^17.0.0", - "eslint-plugin-import": "^2.26.0", + "eslint-plugin-import": "^2.27.5", "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^6.0.0", - "eslint-plugin-standard": "^4.1.0", - "mocha": "^10.0.0", - "sinon": "^14.0.0" + "eslint-plugin-promise": "^6.1.1", + "mocha": "^10.2.0", + "sinon": "^15.0.1" } } diff --git a/test/common.js b/test/common.js index 464883b8..bf07a2b1 100644 --- a/test/common.js +++ b/test/common.js @@ -2,8 +2,6 @@ import path from 'node:path'; import fs from 'node:fs'; import { fileURLToPath } from 'node:url'; -import rimraf from 'rimraf'; - const tmpdirPath = fileURLToPath(new URL('tmp', import.meta.url)); export const tmpdir = { @@ -11,7 +9,7 @@ export const tmpdir = { return tmpdirPath; }, refresh() { - rimraf.sync(this.path); + fs.rmSync(this.path, { recursive: true, force: true }); fs.mkdirSync(this.path, { recursive: true }); } }; diff --git a/test/fixtures/run-auth-github.js b/test/fixtures/run-auth-github.js index 25cd4bb2..d7151ea6 100644 --- a/test/fixtures/run-auth-github.js +++ b/test/fixtures/run-auth-github.js @@ -4,7 +4,8 @@ async function mockCredentials(options) { assert.deepStrictEqual(options, { noSave: true, scopes: ['user:email', 'read:org'], - note: 'node-core-utils CLI tools' + note: 'node-core-utils CLI tools', + noDeviceFlow: true }); return { user: 'nyancat', diff --git a/test/unit/auth.test.js b/test/unit/auth.test.js index d933d4ca..6e13b9dc 100644 --- a/test/unit/auth.test.js +++ b/test/unit/auth.test.js @@ -4,8 +4,6 @@ import fs from 'node:fs'; import { fileURLToPath } from 'node:url'; import assert from 'node:assert'; -import rimraf from 'rimraf'; - let testCounter = 0; // for tmp directories const FIRST_TIME_MSG = @@ -136,7 +134,7 @@ function runAuthScript( if (ncurc[envVar] === undefined) continue; newEnv[envVar] = fileURLToPath(new URL(`tmp-${testCounter++}`, import.meta.url)); - rimraf.sync(newEnv[envVar]); + fs.rmSync(newEnv[envVar], { recursive: true, force: true }); fs.mkdirSync(newEnv[envVar], { recursive: true }); const ncurcPath = path.resolve(newEnv[envVar], @@ -169,8 +167,12 @@ function runAuthScript( try { assert.strictEqual(stderr, error); assert.strictEqual(expect.length, 0); - if (newEnv.HOME) rimraf.sync(newEnv.HOME); - if (newEnv.XDG_CONFIG_HOME) rimraf.sync(newEnv.XDG_CONFIG_HOME); + if (newEnv.HOME) { + fs.rmSync(newEnv.HOME, { recursive: true, force: true }); + } + if (newEnv.XDG_CONFIG_HOME) { + fs.rmSync(newEnv.XDG_CONFIG_HOME, { recursive: true, force: true }); + } } catch (err) { reject(err); }