Skip to content

Commit

Permalink
[core] Improve imports from the core monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviendelangle committed Sep 21, 2023
1 parent 409f890 commit b4ae149
Show file tree
Hide file tree
Showing 24 changed files with 59 additions and 46 deletions.
15 changes: 10 additions & 5 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ const defaultAlias = {
'@mui/x-date-pickers-pro': resolveAliasPath('./packages/x-date-pickers-pro/src'),
'@mui/x-charts': resolveAliasPath('./packages/x-charts/src'),
'@mui/x-tree-view': resolveAliasPath('./packages/x-tree-view/src'),
'@mui/markdown': '@mui/monorepo/packages/markdown',
'@mui-internal/api-docs-builder': '@mui/monorepo/packages/api-docs-builder',
'@mui-internal/docs-utilities': '@mui/monorepo/packages/docs-utilities',
'typescript-to-proptypes': '@mui/monorepo/packages/typescript-to-proptypes/src',
'@mui/markdown': resolveAliasPath('./node_modules/@mui/monorepo/packages/markdown'),
'@mui-internal/api-docs-builder': resolveAliasPath(
'./node_modules/@mui/monorepo/packages/api-docs-builder',
),
'@mui-internal/docs-utilities': resolveAliasPath(
'./node_modules/@mui/monorepo/packages/docs-utilities',
),
'typescript-to-proptypes': resolveAliasPath(
'./node_modules/@mui/monorepo/packages/typescript-to-proptypes',
),
docs: resolveAliasPath('./node_modules/@mui/monorepo/docs'),
test: resolveAliasPath('./test'),
packages: resolveAliasPath('./packages'),
};

const productionPlugins = [
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-actions-col-def.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-actions-col-def.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-aggregation-function.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-aggregation-function.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-api.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-cell-params.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-cell-params.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-col-def.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-col-def.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-csv-export-options.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-csv-export-options.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-excel-export-options.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-excel-export-options.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-export-state-params.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-export-state-params.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-filter-item.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-filter-item.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-filter-model.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-filter-model.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-filter-operator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-filter-operator.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-print-export-options.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-print-export-options.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-row-class-name-params.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-row-class-name-params.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-row-params.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-row-params.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-row-spacing-params.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-row-spacing-params.md?@mui/markdown';

export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/data-grid/grid-single-select-col-def.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './grid-single-select-col-def.md?@mui/markdown';

export default function Page() {
Expand Down
27 changes: 12 additions & 15 deletions docs/scripts/api/buildComponentsDocumentation.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
import { getPropTypesFromFile } from '@mui/monorepo/packages/typescript-to-proptypes';
import {
UnionType,
InterfaceType,
} from '@mui/monorepo/packages/typescript-to-proptypes/src/models';
import { getPropTypesFromFile } from 'typescript-to-proptypes';
import { UnionType, InterfaceType } from 'typescript-to-proptypes/models';
import * as fse from 'fs-extra';
import fs from 'fs';
import path from 'path';
import parseStyles from '@mui/monorepo/packages/api-docs-builder/utils/parseStyles';
import parseStyles from '@mui-internal/api-docs-builder/utils/parseStyles';
import fromPairs from 'lodash/fromPairs';
import createDescribeableProp, {
DescribeablePropDescriptor,
} from '@mui/monorepo/packages/api-docs-builder/utils/createDescribeableProp';
import generatePropDescription from '@mui/monorepo/packages/api-docs-builder/utils/generatePropDescription';
} from '@mui-internal/api-docs-builder/utils/createDescribeableProp';
import generatePropDescription from '@mui-internal/api-docs-builder/utils/generatePropDescription';
import { parse as parseDoctrine } from 'doctrine';
import generatePropTypeDescription, {
getChained,
} from '@mui/monorepo/packages/api-docs-builder/utils/generatePropTypeDescription';
import parseTest from '@mui/monorepo/packages/api-docs-builder/utils/parseTest';
} from '@mui-internal/api-docs-builder/utils/generatePropTypeDescription';
import parseTest from '@mui-internal/api-docs-builder/utils/parseTest';
import kebabCase from 'lodash/kebabCase';
import camelCase from 'lodash/camelCase';
import { LANGUAGES } from 'docs/config';
import findPagesMarkdownNew from '@mui/monorepo/packages/api-docs-builder/utils/findPagesMarkdown';
import findPagesMarkdownNew from '@mui-internal/api-docs-builder/utils/findPagesMarkdown';
import { defaultHandlers, parse as docgenParse } from 'react-docgen';
import { renderMarkdown, getHeaders, getTitle } from '@mui/monorepo/packages/markdown';
import { getLineFeed } from '@mui/monorepo/packages/docs-utilities';
import { unstable_generateUtilityClass as generateUtilityClass } from '@mui/utils';
import type { ReactApi as CoreReactApi } from '@mui/monorepo/packages/api-docs-builder/ApiBuilders/ComponentApiBuilder';
import { renderMarkdown, getHeaders, getTitle } from '@mui/markdown';
import { getLineFeed } from '@mui-internal/docs-utilities';
import generateUtilityClass from '@mui/utils/generateUtilityClass';
import type { ReactApi as CoreReactApi } from '@mui-internal/api-docs-builder/ApiBuilders/ComponentApiBuilder';
import { DocumentedInterfaces, getJsdocDefaultValue, linkify, writePrettifiedFile } from './utils';
import { XTypeScriptProject, XTypeScriptProjects } from '../createXTypeScriptProjects';
import saveApiDocPages, { ApiPageType, getPlan } from './saveApiDocPages';
Expand Down
2 changes: 1 addition & 1 deletion docs/scripts/api/buildGridEventsDocumentation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as ts from 'typescript';
import path from 'path';
import { renderMarkdown } from '@mui/monorepo/packages/markdown';
import { renderMarkdown } from '@mui/markdown';
import {
DocumentedInterfaces,
getSymbolDescription,
Expand Down
4 changes: 2 additions & 2 deletions docs/scripts/api/buildInterfacesDocumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as ts from 'typescript';
import * as prettier from 'prettier';
import kebabCase from 'lodash/kebabCase';
import path from 'path';
import { renderMarkdown } from '@mui/monorepo/packages/markdown';
import { renderMarkdown } from '@mui/markdown';
import {
escapeCell,
getSymbolDescription,
Expand Down Expand Up @@ -348,7 +348,7 @@ export default function buildInterfacesDocumentation(options: BuildInterfacesDoc
writePrettifiedFile(
path.resolve(apiPagesFolder, project.documentationFolderName, `${slug}.js`),
`import * as React from 'react';
import MarkdownDocs from '@mui/monorepo/docs/src/modules/components/MarkdownDocs';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import * as pageProps from './${slug}.md?@mui/markdown';
export default function Page() {
Expand Down
2 changes: 1 addition & 1 deletion docs/scripts/createXTypeScriptProjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
createTypeScriptProject,
CreateTypeScriptProjectOptions,
TypeScriptProject,
} from '@mui/monorepo/packages/api-docs-builder/utils/createTypeScriptProject';
} from '@mui-internal/api-docs-builder/utils/createTypeScriptProject';
import { getComponentFilesInFolder } from './utils';

const workspaceRoot = path.resolve(__dirname, '../../');
Expand Down
7 changes: 2 additions & 5 deletions docs/scripts/generateProptypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import * as yargs from 'yargs';
import * as path from 'path';
import * as fse from 'fs-extra';
import * as prettier from 'prettier';
import {
getPropTypesFromFile,
injectPropTypesInFile,
} from '@mui/monorepo/packages/typescript-to-proptypes';
import { fixBabelGeneratorIssues, fixLineEndings } from '@mui/monorepo/packages/docs-utilities';
import { getPropTypesFromFile, injectPropTypesInFile } from 'typescript-to-proptypes';
import { fixBabelGeneratorIssues, fixLineEndings } from '@mui-internal/docs-utilities';
import { createXTypeScriptProjects, XTypeScriptProject } from './createXTypeScriptProjects';

const prettierConfig = prettier.resolveConfig.sync(process.cwd(), {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { DateRangeCalendar } from '@mui/x-date-pickers-pro/DateRangeCalendar';
import {
describeGregorianAdapter,
TEST_DATE_ISO_STRING,
} from 'packages/x-date-pickers/src/tests/describeGregorianAdapter';
} from '@mui/x-date-pickers/tests/describeGregorianAdapter';

import 'dayjs/locale/fr';
import 'dayjs/locale/de';
Expand Down
14 changes: 14 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@
"@mui/x-tree-view/*": ["./packages/x-tree-view/src/*"],
"@mui/x-license-pro": ["./packages/x-license-pro/src"],
"@mui/x-license-pro/*": ["./packages/x-license-pro/src/*"],
"@mui/markdown": ["./node_modules/@mui/monorepo/packages/markdown"],
"@mui/markdown/*": ["./node_modules/@mui/monorepo/packages/markdown/*"],
"@mui-internal/api-docs-builder": ["./node_modules/@mui/monorepo/packages/api-docs-builder"],
"@mui-internal/api-docs-builder/*": [
"./node_modules/@mui/monorepo/packages/api-docs-builder/*"
],
"@mui-internal/docs-utilities": ["./node_modules/@mui/monorepo/packages/docs-utilities"],
"@mui-internal/docs-utilities/*": ["./node_modules/@mui/monorepo/packages/docs-utilities/*"],
"typescript-to-proptypes": [
"./node_modules/@mui/monorepo/packages/typescript-to-proptypes/src"
],
"typescript-to-proptypes/*": [
"./node_modules/@mui/monorepo/packages/typescript-to-proptypes/src/*"
],
"test/*": ["./test/*"],
"docs/*": ["./node_modules/@mui/monorepo/docs"],
"docsx/*": ["./docs/*"]
Expand Down

0 comments on commit b4ae149

Please sign in to comment.