Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): drop fs-extras and mkdirp dependencies #3230

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 24 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,10 @@
"decamelize": "6.0.0",
"es6-error": "4.1.1",
"firefox-profile": "4.6.0",
"fs-extra": "11.2.0",
"fx-runner": "1.4.0",
"https-proxy-agent": "^7.0.0",
"jose": "5.6.3",
"jszip": "3.10.1",
"mkdirp": "3.0.1",
"multimatch": "6.0.0",
"node-fetch": "3.3.2",
"node-notifier": "10.0.1",
Expand Down Expand Up @@ -109,6 +107,7 @@
"eslint": "8.57.0",
"eslint-plugin-async-await": "0.0.0",
"eslint-plugin-import": "2.29.1",
"fs-extra": "11.2.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still used in tests, I didn't want to rewrite all of them. It's fine as a dev dependency

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's fair, it seems to be used only in the test.chromium.js unit test, but it is not a big deal if we keep it as a dev dependency in the meantime. Let's keep that test as is 👍

"git-rev-sync": "3.0.2",
"html-entities": "2.5.2",
"mocha": "10.7.0",
Expand Down
10 changes: 5 additions & 5 deletions src/extension-runners/chromium.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
* in a Chromium-based browser instance.
*/

import fs from 'fs/promises';
import path from 'path';

import fs from 'fs-extra';
import { mkdirp as asyncMkdirp } from 'mkdirp';
import {
Launcher as ChromeLauncher,
launch as defaultChromiumLaunch,
Expand Down Expand Up @@ -179,12 +178,13 @@ export class ChromiumExtensionRunner {

if (userDataDir && profileDirName) {
// copy profile dir to this temp user data dir.
await fs.copy(
await fs.cp(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to Node 16.7 exactly 3 years ago

https://nodejs.org/api/fs.html#fspromisescpsrc-dest-options

path.join(userDataDir, profileDirName),
path.join(tmpDirPath, profileDirName),
{ recursive: true },
);
} else if (userDataDir) {
await fs.copy(userDataDir, tmpDirPath);
await fs.cp(userDataDir, tmpDirPath, { recursive: true });
}
userDataDir = tmpDirPath;
}
Expand Down Expand Up @@ -273,7 +273,7 @@ export class ChromiumExtensionRunner {

log.debug(`Creating reload-manager-extension in ${extPath}`);

await asyncMkdirp(extPath);
await fs.mkdir(extPath, { recursive: true });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


await fs.writeFile(
path.join(extPath, 'manifest.json'),
Expand Down
4 changes: 1 addition & 3 deletions src/util/artifacts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import fs from 'fs/promises';

import { mkdirp as defaultAsyncMkdirp } from 'mkdirp';

import { UsageError, isErrorWithCode } from '../errors.js';
import { createLogger } from './logger.js';

Expand All @@ -12,7 +10,7 @@ const defaultAsyncFsAccess = fs.access.bind(fs);
export async function prepareArtifactsDir(
artifactsDir,
{
asyncMkdirp = defaultAsyncMkdirp,
asyncMkdirp = (dirPath) => fs.mkdir(dirPath, { recursive: true }),
asyncFsAccess = defaultAsyncFsAccess,
} = {},
) {
Expand Down