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

[core] Remove outdated docsearch.js dependency #6242

Merged

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Sep 21, 2022

In the future, we should look into how we can have the docs-infra control it's own npm dependencies so mui/material-ui#34421 is enough.

@oliviertassinari oliviertassinari added the core Infrastructure work going on behind the scenes label Sep 21, 2022
@mui-bot
Copy link

mui-bot commented Sep 21, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 476.8 727.2 605.8 597.76 106.592
Sort 100k rows ms 516.9 919.3 777.7 743.4 137.277
Select 100k rows ms 157 265.1 214.7 217.26 37.517
Deselect 100k rows ms 110.6 206.4 159.7 161.26 30.793

Generated by 🚫 dangerJS against 079371b

@flaviendelangle
Copy link
Member

image

It seems like it has removed some used dependencies as a side effect

@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Sep 22, 2022
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Sep 22, 2022
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Sep 22, 2022

Wow, so strange, why would remove npm dependencies changes how webpack match aliases?

As far as I could push the exploration, the issue is that

const requireDocs = require.context('docsx/data', true, /js$/);

Gets converted by webpack alias. As far as I know https://github.com/tleunen/babel-plugin-module-resolver isn't reading require.context. So it turns into:

const requireDocs = require.context('./docs/data', true, /js$/);

Which is then turned by the second alias to:

const requireDocs = require.context('./node_modules/@mui/monorepo/docs/data', true, /js$/);

Where it fails. The fix I'm proposing is to have webpack also try to resolve with:

const requireDocs = require.context('./docs/data', true, /js$/);

@oliviertassinari oliviertassinari changed the title [core] Remove outdated dependency [core] Remove outdated docsearch.js dependency Oct 1, 2022
@github-actions
Copy link

github-actions bot commented Oct 6, 2022

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 6, 2022
@LukasTy
Copy link
Member

LukasTy commented Oct 7, 2022

It would be nice to push this PR forward as it will resolve a critical dependabot alert

@flaviendelangle
Copy link
Member

The webpack fail is indeed weird
I have no idea if the fix proposed risk to break something else. It seems weird to have an alias target to totally different folders, one being the target of another alias.
But if @oliviertassinari is confident enough.

@oliviertassinari oliviertassinari force-pushed the remove-dead-docsearch-dependency branch 2 times, most recently from f8509b3 to ea17607 Compare October 8, 2022 19:23
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 8, 2022
@oliviertassinari oliviertassinari force-pushed the remove-dead-docsearch-dependency branch 3 times, most recently from c6a1a76 to f6df5e7 Compare October 8, 2022 20:10
Comment on lines +52 to +53
// TODO: 'browserslist:modern'
target: 'web',
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy the mono repo

) => {...}

// Imperative subscription
) => {...}
Copy link
Member Author

Choose a reason for hiding this comment

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

Something I found by chance, it's not ideal to have these trailing spaces when you copy & paste https://next.mui.com/x/react-data-grid/events/#catalog-of-events in your IDE:

Screenshot 2022-10-08 at 22 08 42

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that we could enforce a rule in the CI with mui/material-ui#34686 (comment) to have the PRs fail if they have trailing spaces.

@@ -177,9 +179,7 @@
"**/@mui/monorepo"
]
},
"dependencies": {
"html-webpack-plugin": "^5.5.0"
Copy link
Member Author

Choose a reason for hiding this comment

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

Wrong location, this is a dev dependency.

@@ -149,6 +150,7 @@
"nyc": "^15.1.0",
"playwright": "^1.21.1",
"prettier": "^2.7.1",
"process": "^0.11.10",
Copy link
Member Author

Choose a reason for hiding this comment

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

Required as we were relying on it, with a transitive dependency of docsearch.js.

...webpackBaseConfig.resolve,
alias: {
...webpackBaseConfig.resolve.alias,
docs: false, // Disable this alias as it creates a circual resolution loop with the docsx alias
Copy link
Member Author

Choose a reason for hiding this comment

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

Since we are not supposed to import from the docs-infra or mono-repo docs in the visual regression tests, this works as well. It's more isolated than the first attempt:

-      docs: path.resolve(__dirname, './node_modules/@mui/monorepo/docs'),
+      docs: [
+        path.resolve(__dirname, './node_modules/@mui/monorepo/docs'),
+        path.resolve(__dirname, './docs'),
+      ],

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I might not have needed to fix this, I see that it's already all broken on HEAD, e.g. https://app.circleci.com/pipelines/github/mui/mui-x/25566/workflows/5b4b75f8-3d75-4d0f-8c6e-90812dd0563a/jobs/147039

Screenshot 2022-10-09 at 02 35 11

@oliviertassinari
Copy link
Member Author

I have updated the approach, see if you are happy with it.

Comment on lines +77 to +82
// TODO: Why does webpack include a key for the absolute and relative path?
// We just want the relative path
if (!path.startsWith('./')) {
return res;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

I have copied mui/material-ui#28248.

...webpackBaseConfig.resolve,
alias: {
...webpackBaseConfig.resolve.alias,
docs: false, // Disable this alias as it creates a circual resolution loop with the docsx alias
Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I might not have needed to fix this, I see that it's already all broken on HEAD, e.g. https://app.circleci.com/pipelines/github/mui/mui-x/25566/workflows/5b4b75f8-3d75-4d0f-8c6e-90812dd0563a/jobs/147039

Screenshot 2022-10-09 at 02 35 11

@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 10, 2022
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 14, 2022
@oliviertassinari oliviertassinari enabled auto-merge (squash) October 14, 2022 21:39
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Oct 14, 2022

The impact of the fix is now a lot more scoped than in the first attempt, I have made the configuration closer to the one used in https://github.com/mui/material-ui/. Since it's not really important to get peer feedback on this, and it has been pending for a week or two, I'm moving forward 😁

@oliviertassinari oliviertassinari merged commit 1a60a91 into mui:next Oct 14, 2022
@oliviertassinari oliviertassinari deleted the remove-dead-docsearch-dependency branch October 14, 2022 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants