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

[code-infra] Use @mui/docs from npm #3301

Merged
merged 12 commits into from
Apr 11, 2024
Merged

[code-infra] Use @mui/docs from npm #3301

merged 12 commits into from
Apr 11, 2024

Conversation

michaldudak
Copy link
Member

To be updated once mui/material-ui#41206 is merged and published.

@michaldudak michaldudak added the scope: code-infra Specific to the core-infra product label Mar 18, 2024
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 21, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 27, 2024
@Janpot Janpot marked this pull request as ready for review March 27, 2024 13:29
@Janpot Janpot marked this pull request as draft March 27, 2024 13:30
@Janpot
Copy link
Member

Janpot commented Mar 27, 2024

Still needs publishing

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 28, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 4, 2024
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 7, 2024
@michaldudak michaldudak marked this pull request as ready for review April 10, 2024 18:22
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 10, 2024
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 10, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 11, 2024
@michaldudak michaldudak enabled auto-merge (squash) April 11, 2024 12:13
@michaldudak michaldudak merged commit 8de0ba4 into master Apr 11, 2024
12 checks passed
@michaldudak michaldudak deleted the mui-docs-from-npm branch April 11, 2024 12:22
@oliviertassinari
Copy link
Member

oliviertassinari commented Apr 14, 2024

This change broke all the links, they are missing their trailing slashes. It's critical we have a solution for this. Bug open #3401.

Before https://deploy-preview-3301--mui-toolpad-docs.netlify.app/toolpad/
After: https://deploy-preview-3301--mui-toolpad-docs.netlify.app/toolpad/

As far as I can debug it, it's an issue with https://github.com/vercel/next.js/blob/33e8334d35cb353c37b5d21fb4ca9d860d2e3f6a/packages/next/src/client/normalize-trailing-slash.ts#L14. process.env.__NEXT_TRAILING_SLASH is not true on the server-side, strange. I can only see two options possible:

As before:

diff --git a/docs/next.config.mjs b/docs/next.config.mjs
index 820a1d63..c3442b91 100644
--- a/docs/next.config.mjs
+++ b/docs/next.config.mjs
@@ -14,13 +14,16 @@ const { findPages } = require('./src/modules/utils/find');

 const WORKSPACE_ROOT = path.resolve(currentDirectory, '../');
 const MONOREPO_PATH = path.resolve(currentDirectory, '../node_modules/@mui/monorepo');
+const MONOREPO_PACKAGES = {
+  '@mui/docs': path.resolve(MONOREPO_PATH, './packages/mui-docs/src'),
+};

@@ -40,6 +43,7 @@ export default withDocsInfra({
         alias: {
           ...config.resolve.alias,
           docs: path.resolve(MONOREPO_PATH, './docs'),
+           ...MONOREPO_PACKAGES,
           '@toolpad/studio-components': path.resolve(
             currentDirectory,
             '../packages/toolpad-studio-components/src',

Transpile it:

diff --git a/docs/next.config.mjs b/docs/next.config.mjs
index 820a1d63..c3442b91 100644
--- a/docs/next.config.mjs
+++ b/docs/next.config.mjs
@@ -14,13 +14,16 @@ const { findPages } = require('./src/modules/utils/find');
 export default withDocsInfra({
   experimental: {
     workerThreads: true,
     cpus: 3,
   },
-  transpilePackages: ['@mui/monorepo', '@mui/x-charts'],
+  transpilePackages: ['@mui/monorepo', '@mui/x-charts', '@mui/docs'],
   // Avoid conflicts with the other Next.js apps hosted under https://mui.com/
   assetPrefix: process.env.DEPLOY_ENV === 'development' ? undefined : '/toolpad',
   env: {

@Janpot
Copy link
Member

Janpot commented Apr 15, 2024

process.env.__NEXT_TRAILING_SLASH is not true on the server-side, strange. I can only see two options possible:

oh wow, ok. Let's transpile it then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: code-infra Specific to the core-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants