Skip to content

Commit

Permalink
chore(deps): update deps and dev deps (#669)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
VoltrexKeyva authored Feb 26, 2023
1 parent 01d10df commit 6926407
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 40 deletions.
8 changes: 3 additions & 5 deletions lib/auth.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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}`);
Expand Down
8 changes: 3 additions & 5 deletions lib/session.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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() {
Expand Down
40 changes: 19 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
4 changes: 1 addition & 3 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ 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 = {
get path() {
return tmpdirPath;
},
refresh() {
rimraf.sync(this.path);
fs.rmSync(this.path, { recursive: true, force: true });
fs.mkdirSync(this.path, { recursive: true });
}
};
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/run-auth-github.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
12 changes: 7 additions & 5 deletions test/unit/auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 6926407

Please sign in to comment.