Skip to content

Commit

Permalink
[code-infra] Prepare publishing @mui-internal/typescript-to-proptypes…
Browse files Browse the repository at this point in the history
… to npm (mui#40842)
  • Loading branch information
michaldudak authored and mostafa-rio committed Feb 3, 2024
1 parent c627372 commit 5bcf01d
Show file tree
Hide file tree
Showing 40 changed files with 876 additions and 292 deletions.
8 changes: 6 additions & 2 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"packages/mui-styles",
"packages/mui-system",
"packages/mui-types",
"packages/mui-utils"
"packages/mui-utils",
"packages/docs-utils",
"packages/typescript-to-proptypes"
],
"publishDirectory": {
"@mui/base": "packages/mui-base/build",
Expand All @@ -36,7 +38,9 @@
"@mui/styles": "packages/mui-styles/build",
"@mui/system": "packages/mui-system/build",
"@mui/types": "packages/mui-types/build",
"@mui/utils": "packages/mui-utils/build"
"@mui/utils": "packages/mui-utils/build",
"@mui-internal/docs-utils": "packages/docs-utils",
"@mui-internal/typescript-to-proptypes": "packages/typescript-to-proptypes"
},
"sandboxes": [
"material-ui-issue-latest-s2dsx",
Expand Down
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = function getBabelConfig(api) {
'@mui/material-next': resolveAliasPath('./packages/mui-material-next/src'),
'@mui/joy': resolveAliasPath('./packages/mui-joy/src'),
'@mui/zero-runtime': resolveAliasPath('./packages/zero-runtime/src'),
'@mui-internal/docs-utils': resolveAliasPath('./packages/docs-utils/src'),
docs: resolveAliasPath('./docs'),
test: resolveAliasPath('./test'),
};
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@
"devDependencies": {
"@babel/plugin-transform-react-constant-elements": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@mui-internal/docs-utilities": "workspace:^",
"@mui-internal/docs-utils": "workspace:^",
"@mui-internal/test-utils": "workspace:^",
"@mui-internal/typescript-to-proptypes": "workspace:^",
"@types/autosuggest-highlight": "^3.2.3",
"@types/chai": "^4.3.11",
"@types/css-mediaquery": "^0.1.4",
Expand All @@ -139,7 +140,6 @@
"playwright": "^1.41.1",
"prettier": "^2.8.8",
"tailwindcss": "^3.4.1",
"typescript-to-proptypes": "workspace:^",
"yargs": "^17.7.2"
}
}
7 changes: 5 additions & 2 deletions docs/scripts/formattedTSDemos.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ const path = require('path');
const fse = require('fs-extra');
const babel = require('@babel/core');
const prettier = require('prettier');
const { getPropTypesFromFile, injectPropTypesInFile } = require('typescript-to-proptypes');
const {
getPropTypesFromFile,
injectPropTypesInFile,
} = require('@mui-internal/typescript-to-proptypes');
const {
createTypeScriptProjectBuilder,
} = require('@mui-internal/api-docs-builder/utils/createTypeScriptProject');
const yargs = require('yargs');
const { fixBabelGeneratorIssues, fixLineEndings } = require('@mui-internal/docs-utilities');
const { fixBabelGeneratorIssues, fixLineEndings } = require('@mui-internal/docs-utils');
const { default: CORE_TYPESCRIPT_PROJECTS } = require('../../scripts/coreTypeScriptProjects');

const babelConfig = {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/ApiPage/list/ClassesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as React from 'react';
import { styled } from '@mui/material/styles';
import kebabCase from 'lodash/kebabCase';
import { ComponentClassDefinition } from '@mui-internal/docs-utilities';
import { ComponentClassDefinition } from '@mui-internal/docs-utils';
import { useTranslate } from 'docs/src/modules/utils/i18n';
import ExpandableApiItem, {
ApiItemContaier,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react/no-danger */
import * as React from 'react';
import { useTranslate } from 'docs/src/modules/utils/i18n';
import { ComponentClassDefinition } from '@mui-internal/docs-utilities';
import { ComponentClassDefinition } from '@mui-internal/docs-utils';
import Box from '@mui/material/Box';
import ToggleDisplayOption, {
API_LAYOUT_STORAGE_KEYS,
Expand Down
2 changes: 1 addition & 1 deletion docs/src/modules/components/ApiPage/table/ClassesTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/no-danger */
import * as React from 'react';
import { ComponentClassDefinition } from '@mui-internal/docs-utilities';
import { ComponentClassDefinition } from '@mui-internal/docs-utils';
import { styled, alpha } from '@mui/material/styles';
import {
brandingDarkTheme as darkTheme,
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
"proptypes": "cross-env BABEL_ENV=development babel-node --extensions \".tsx,.ts,.js\" ./scripts/generateProptypes.ts",
"proptypes": "tsx ./scripts/generateProptypes.ts",
"deduplicate": "pnpm dedupe",
"benchmark:browser": "pnpm --filter benchmark browser",
"build": "lerna run --scope \"@mui/*\" build",
"build:zero": "lerna run --scope \"@mui/zero-*\" build",
"clean:zero": "pnpm --filter \"@mui/zero-*\" clean",
"build:codesandbox": "NODE_OPTIONS=\"max_old_space_size=4096\" lerna run --concurrency 8 --scope \"@mui/*\" build",
"build:codesandbox": "NODE_OPTIONS=\"--max_old_space_size=4096\" lerna run --concurrency 8 --scope \"@mui/*\" --scope \"@mui-internal/*\" --no-private build",
"release:version": "lerna version --no-changelog --no-push --no-git-tag-version --no-private --force-publish=@mui/core-downloads-tracker",
"release:build": "lerna run --concurrency 8 --scope \"@mui/*\" build --skip-nx-cache",
"release:changelog": "node scripts/releaseChangelog.mjs",
Expand All @@ -33,7 +33,7 @@
"docs:link-check": "pnpm --filter docs link-check",
"docs:typescript": "pnpm docs:typescript:formatted --watch",
"docs:typescript:check": "pnpm --filter docs typescript",
"docs:typescript:formatted": "cross-env BABEL_ENV=development babel-node --extensions \".tsx,.ts,.js\" ./docs/scripts/formattedTSDemos",
"docs:typescript:formatted": "tsx ./docs/scripts/formattedTSDemos",
"docs:mdicons:synonyms": "cross-env BABEL_ENV=development babel-node --extensions \".tsx,.ts,.js,.mjs\" ./docs/scripts/updateIconSynonyms && pnpm prettier",
"extract-error-codes": "cross-env MUI_EXTRACT_ERROR_CODES=true lerna run --concurrency 8 build:modern",
"rsc:build": "tsx ./packages/rsc-builder/buildRsc.ts",
Expand Down Expand Up @@ -102,8 +102,9 @@
"@mnajdova/enzyme-adapter-react-18": "^0.2.0",
"@mui-internal/api-docs-builder": "workspace:^",
"@mui-internal/api-docs-builder-core": "workspace:^",
"@mui-internal/docs-utilities": "workspace:^",
"@mui-internal/docs-utils": "workspace:^",
"@mui-internal/test-utils": "workspace:^",
"@mui-internal/typescript-to-proptypes": "workspace:^",
"@mui/joy": "workspace:*",
"@mui/material": "workspace:^",
"@mui/utils": "workspace:^",
Expand Down Expand Up @@ -180,7 +181,6 @@
"tsx": "^4.7.0",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"typescript-to-proptypes": "workspace:^",
"webpack": "^5.90.0",
"webpack-bundle-analyzer": "^4.10.1",
"webpack-cli": "^5.1.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import remarkVisit from 'unist-util-visit';
import type { Link } from 'mdast';
import { defaultHandlers, parse as docgenParse, ReactDocgenApi } from 'react-docgen';
import { renderMarkdown } from '@mui/markdown';
import { ComponentClassDefinition } from '@mui-internal/docs-utilities';
import { ComponentClassDefinition } from '@mui-internal/docs-utils';
import { ProjectSettings, SortingStrategiesType } from '../ProjectSettings';
import { ComponentInfo, toGitHubPath, writePrettifiedFile } from '../buildApiUtils';
import muiDefaultPropsHandler from '../utils/defaultPropsHandler';
Expand Down
2 changes: 1 addition & 1 deletion packages/api-docs-builder/ProjectSettings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentClassDefinition } from '@mui-internal/docs-utilities/ComponentClassDefinition';
import { ComponentClassDefinition } from '@mui-internal/docs-utils';
import { ComponentInfo, HookInfo } from './buildApiUtils';
import { CreateTypeScriptProjectOptions } from './utils/createTypeScriptProject';
import { CreateDescribeablePropSettings } from './utils/createDescribeableProp';
Expand Down
2 changes: 1 addition & 1 deletion packages/api-docs-builder/buildApiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path';
import * as ts from 'typescript';
import * as prettier from 'prettier';
import kebabCase from 'lodash/kebabCase';
import { getLineFeed } from '@mui-internal/docs-utilities';
import { getLineFeed } from '@mui-internal/docs-utils';
import { replaceComponentLinks } from './utils/replaceUrl';
import { TypeScriptProject } from './utils/createTypeScriptProject';

Expand Down
2 changes: 1 addition & 1 deletion packages/api-docs-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@babel/core": "^7.23.9",
"@babel/preset-typescript": "^7.23.3",
"@babel/traverse": "^7.23.9",
"@mui-internal/docs-utilities": "workspace:^",
"@mui-internal/docs-utils": "workspace:^",
"@mui/markdown": "workspace:^",
"ast-types": "^0.14.2",
"doctrine": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-docs-builder/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"strict": true,
"baseUrl": "./",
"paths": {
"@mui/utils": ["../mui-utils/src"]
"@mui-internal/docs-utils": ["../docs-utils/src"]
}
},
"include": ["./**/*.ts", "./**/*.js"],
Expand Down
2 changes: 1 addition & 1 deletion packages/api-docs-builder/utils/parseSlotsAndClasses.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as ts from 'typescript';
import { ComponentClassDefinition } from '@mui-internal/docs-utilities';
import { ComponentClassDefinition } from '@mui-internal/docs-utils';
import { renderMarkdown } from '@mui/markdown';
import { getSymbolDescription, getSymbolJSDocTags } from '../buildApiUtils';
import { TypeScriptProject } from './createTypeScriptProject';
Expand Down
5 changes: 0 additions & 5 deletions packages/docs-utilities/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions packages/docs-utilities/index.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/docs-utilities/package.json

This file was deleted.

19 changes: 0 additions & 19 deletions packages/docs-utilities/tsconfig.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/docs-utils/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.tsbuildinfo
5 changes: 5 additions & 0 deletions packages/docs-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 1.0.0

Initial release as an npm package.
9 changes: 9 additions & 0 deletions packages/docs-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# @mui-internal/docs-utils

This package contains utilities shared between MUI docs generation scripts.
This is an internal package not meant for general use.

## Release

1. Build the project: `pnpm build`
2. Publish the build artifacts to npm: `pnpm release:publish`
30 changes: 30 additions & 0 deletions packages/docs-utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@mui-internal/docs-utils",
"version": "1.0.0",
"author": "MUI Team",
"description": "Utilities for MUI docs. This is an internal package not meant for general use.",
"main": "./build/index.js",
"exports": {
".": "./build/index.js"
},
"types": "./build/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/mui/material-ui.git",
"directory": "packages/docs-utils"
},
"scripts": {
"prebuild": "rimraf ./build",
"build": "tsc -b tsconfig.build.json",
"typescript": "tsc -b tsconfig.json",
"release:publish": "pnpm publish --tag latest",
"release:publish:dry-run": "pnpm publish --tag latest --registry=\"http://localhost:4873/\""
},
"dependencies": {
"rimraf": "^5.0.5",
"typescript": "^5.1.6"
},
"publishConfig": {
"access": "public"
}
}
Loading

0 comments on commit 5bcf01d

Please sign in to comment.