-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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): remove dependency on del #11020
Conversation
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Report too large to display inline |
⚡️ Lighthouse report for the deploy preview of this PR
|
Thanks for opening the discussion. I agree we can do some cleanup here.
From what I see, it's 8, not 27. And many of these transitive dependencies (like globby or p-map) are used in other places https://www.npmjs.com/package/del/v/6.1.1?activeTab=dependencies
We already use globby in other places, so I'd prefer not include a 2nd globbing tool In the future, we'll probably remove globby in favor of Node built-in globbing tool: https://nodejs.org/api/fs.html#fsglobpattern-options-callback
Not sure what you mean here. We copied that code from a legacy unmaintained lib that we historically use, and don't plan to "upgrade" or revert the forking: https://github.com/johnagan/clean-webpack-plugin It would actually be more useful to create our own // Remove/clean build folders before building bundles.
new CleanWebpackPlugin({verbose: false}), This is historical code, but I wonder if we really need a plugin and libs to delete the I didn't study in depth what this plugin does exactly, but I'd probably simply replace that whole plugin with That's even what the historical plugin recommends 😆 /**
* Initially remove files from output directory prior to build.
*
* Only happens once.
*
* Warning: It is recommended to initially clean your build directory outside
* of webpack to minimize unexpected behavior.
*/
handleInitial(): void { |
Regarding the 27 dependencies, I was including transitive dependencies as well: http://npmgraph.js.org/?q=del I think swapping out I wasn't referring
|
Ah I see thanks I'd prefer to stick to globby for v3, but we can consider changing the dependency for v4 globally if it's safe and doesn't cause weird side effects |
Sure. Would it be better to switch del to tinyglobby, switch globby to tinyglobby, and upgrade copy-webpack-plugin in a single PR or in separate PRs? |
I'm not sure what you mean. As explained above, the thing I'm willing to merge for v3 is to remove the copy-webpack-plugin entirely. You can already work on replacing globby globally with tinyglobby as a second PR, but I will only merge it later once we are ready to start merging breaking changes for v4. Globby is implicitly part of our public API surface, and I'll only consider merging it for v3 only if you can convince me it's a 100% safe retro-compatible replacement. |
I meant for v4. I'd be happy to put together a PR now to have it queued up, but didn't know if you'd prefer a single PR or separate PRs for the work to be done
I'm quite confused as to whether
|
Sorry, I meant we should remove What I propose is that I'll study if At the same time you can work on replacing globby with tinyglobby, and we'll see if the options are good enough and if this triggers and CI regression or roadblock. No need to handle Globby is part of our public API surface because we pass user/plugin inputs to it, but we are using it with a limited number of options, so let's see if the tinyglobby options are good enough, and more importantly, are they retrocompatible? I Don't see anywhere tinyglobby mentioning retro-compatibility with globby as a goal (even with removed options), so I'm afraid of possible side effects. If both projects shared the same test suite, that would be reassuring for me to consider it for v3, otherwise it can wait for v4. |
Superseded by #11037 From my investigation, we can safely remove the clean-webpack-plugin, and this has various benefits:
Thanks for opening the discussion, and happy to get rid of it. I'm going to close this PR as |
Thank you!! I took a look at replacing |
I see thanks So what I understand is the our export async function writeHeadingIds(
siteDirParam: string = '.',
files: string[] = [],
options: WriteHeadingIDOptions = {},
): Promise<void> {
const siteDir = await fs.realpath(siteDirParam);
const markdownFiles = await safeGlobby(
files ?? (await getPathsToWatch(siteDir)),
{
expandDirectories: ['**/*.{md,mdx}'],
},
);
// ...
} Using this lib under the hood: https://github.com/kevva/dir-glob To be honest I think we can just replace that with I'm not sure it's as efficient, but this is not really the most perf critical part of Docusaurus so it should be fine. |
Pre-flight checklist
Motivation
del
is a very heavy library for what it does with 27 dependencies.del
is still included in the repo after this change, but only as a dev dependencytinyglobby
has only 2 dependencies and will end up getting pulled in anyway bycopy-webpack-plugin
when it's updated to the latest versionTest Plan
using existing tests since no new code was introduced
Test links
Deploy preview: https://deploy-preview-_____--docusaurus-2.netlify.app/
Related issues/PRs