Skip to content

Commit 20d13e2

Browse files
committed
Prepare proptypes-builder for publishing
1 parent d666e92 commit 20d13e2

14 files changed

+105
-39
lines changed

.codesandbox/ci.json

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"packages/mui-types",
2121
"packages/mui-utils",
2222
"packages/docs-utils",
23+
"packages/proptypes-builder",
2324
"packages/typescript-to-proptypes"
2425
],
2526
"publishDirectory": {
@@ -40,6 +41,7 @@
4041
"@mui/types": "packages/mui-types/build",
4142
"@mui/utils": "packages/mui-utils/build",
4243
"@mui-internal/docs-utils": "packages/docs-utils",
44+
"@mui-internal/proptypes-builder": "packages/proptypes-builder",
4345
"@mui-internal/typescript-to-proptypes": "packages/typescript-to-proptypes"
4446
},
4547
"sandboxes": [

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"preinstall": "npx only-allow pnpm",
7-
"proptypes": "tsx ./scripts/generateProptypes.ts",
7+
"proptypes": "nx run scripts:proptypes",
88
"deduplicate": "pnpm dedupe",
99
"benchmark:browser": "pnpm --filter benchmark browser",
1010
"build": "lerna run --scope \"@mui/*\" build",
@@ -222,5 +222,6 @@
222222
],
223223
"sourceMap": false,
224224
"instrument": false
225-
}
225+
},
226+
"nx": {}
226227
}
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 1.0.0
4+
5+
Initial release as an npm package.

packages/proptypes-builder/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# @mui-internal/proptypes-builder
2+
3+
A utility to create prop types based on TS definitions in MUI codebase.
4+
This is an internal package not meant for general use.
5+
6+
## Release
7+
8+
1. Build the project: `pnpm build`
9+
2. Publish the build artifacts to npm: `pnpm release:publish`
+18-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
11
{
22
"name": "@mui-internal/proptypes-builder",
33
"version": "1.0.0",
4-
"private": "true",
5-
"main": "./index.ts",
4+
"author": "MUI Team",
5+
"description": "A utility to create prop types based on TS definitions in MUI codebase. This is an internal package not meant for general use.",
6+
"main": "./build/index.js",
7+
"exports": {
8+
".": "./build/index.js"
9+
},
10+
"types": "./build/index.d.ts",
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/mui/material-ui.git",
14+
"directory": "packages/proptypes-builder"
15+
},
616
"scripts": {
7-
"typescript": "tsc -p tsconfig.json"
17+
"prebuild": "rimraf ./build",
18+
"build": "tsc -b tsconfig.build.json",
19+
"typescript": "tsc -b tsconfig.json",
20+
"release:publish": "pnpm publish --tag latest",
21+
"release:publish:dry-run": "pnpm publish --tag latest --registry=\"http://localhost:4873/\""
822
},
923
"dependencies": {
10-
"@mui-internal/api-docs-builder": "workspace:^",
1124
"@mui-internal/docs-utils": "workspace:^",
1225
"@mui-internal/typescript-to-proptypes": "workspace:^",
1326
"fast-glob": "^3.3.2",
1427
"fs-extra": "^11.2.0",
1528
"prettier": "^2.8.8"
1629
},
1730
"devDependencies": {
31+
"rimraf": "^5.0.5",
1832
"typescript": "^5.3.3"
1933
}
2034
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"rootDir": "./src",
5+
"outDir": "./build",
6+
"declaration": true,
7+
"noEmit": false,
8+
"composite": true,
9+
"tsBuildInfoFile": "./build/.tsbuildinfo",
10+
"target": "ES2020",
11+
"module": "commonjs",
12+
"types": ["node"]
13+
}
14+
}
+8-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
{
22
"compilerOptions": {
3-
"allowJs": true,
4-
"isolatedModules": true,
53
"noEmit": true,
6-
"noUnusedLocals": false,
7-
"resolveJsonModule": true,
8-
"skipLibCheck": true,
9-
"esModuleInterop": true,
10-
"types": ["node", "mocha"],
11-
"target": "ES2020",
12-
"module": "CommonJS",
134
"moduleResolution": "node",
5+
"types": ["node", "mocha"],
146
"strict": true,
15-
"baseUrl": "./",
16-
"paths": {
17-
"react-docgen": ["./react-docgen.d.ts"]
18-
}
7+
"esModuleInterop": true,
8+
"isolatedModules": true
199
},
20-
"include": ["./**/*.ts", "./**/*.js"],
21-
"exclude": ["node_modules"]
10+
"include": ["./src/*.ts", "./test/*.ts"],
11+
"references": [
12+
{ "path": "../docs-utils/tsconfig.build.json" },
13+
{ "path": "../typescript-to-proptypes/tsconfig.build.json" }
14+
]
2215
}

pnpm-lock.yaml

+9-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ packages:
55
- 'docs'
66
- 'test'
77
- 'apps/*'
8+
- 'scripts'

scripts/generateProptypes.ts

+14-12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import path from 'node:path';
22
import yargs from 'yargs';
33
import { generatePropTypes, ProjectSettings } from '@mui-internal/proptypes-builder';
44

5+
const workspaceRoot = path.resolve(__dirname, '..');
6+
57
const useExternalPropsFromInputBase = [
68
'autoComplete',
79
'autoFocus',
@@ -118,10 +120,10 @@ interface CommandOptions {
118120

119121
const projectSettings: ProjectSettings[] = [
120122
{
121-
rootPath: path.resolve(process.cwd(), 'packages/mui-system/src'),
123+
rootPath: path.resolve(workspaceRoot, 'packages/mui-system/src'),
122124
typeScriptProject: {
123125
name: 'system',
124-
rootPath: path.join(process.cwd(), 'packages/mui-system'),
126+
rootPath: path.join(workspaceRoot, 'packages/mui-system'),
125127
entryPointPath: 'src/index.d.ts',
126128
},
127129
useExternalDocumentation: {
@@ -130,49 +132,49 @@ const projectSettings: ProjectSettings[] = [
130132
},
131133
},
132134
{
133-
rootPath: path.resolve(process.cwd(), 'packages/mui-base/src'),
135+
rootPath: path.resolve(workspaceRoot, 'packages/mui-base/src'),
134136
typeScriptProject: {
135137
name: 'base',
136-
rootPath: path.join(process.cwd(), 'packages/mui-base'),
138+
rootPath: path.join(workspaceRoot, 'packages/mui-base'),
137139
entryPointPath: 'src/index.d.ts',
138140
},
139141
useExternalDocumentation: {
140142
Input: ['inputRef'],
141143
},
142144
},
143145
{
144-
rootPath: path.resolve(process.cwd(), 'packages/mui-material/src'),
146+
rootPath: path.resolve(workspaceRoot, 'packages/mui-material/src'),
145147
typeScriptProject: {
146148
name: 'material',
147-
rootPath: path.join(process.cwd(), 'packages/mui-material'),
149+
rootPath: path.join(workspaceRoot, 'packages/mui-material'),
148150
entryPointPath: 'src/index.d.ts',
149151
},
150152
useExternalDocumentation: useMaterialUiExternalDocumentation,
151153
ignoreExternalDocumentation: ignoreMaterialUiExternalDocumentation,
152154
},
153155
{
154-
rootPath: path.resolve(process.cwd(), 'packages/mui-lab/src'),
156+
rootPath: path.resolve(workspaceRoot, 'packages/mui-lab/src'),
155157
typeScriptProject: {
156158
name: 'lab',
157-
rootPath: path.join(process.cwd(), 'packages/mui-lab'),
159+
rootPath: path.join(workspaceRoot, 'packages/mui-lab'),
158160
entryPointPath: 'src/index.d.ts',
159161
},
160162
},
161163
{
162-
rootPath: path.resolve(process.cwd(), 'packages/mui-material-next/src'),
164+
rootPath: path.resolve(workspaceRoot, 'packages/mui-material-next/src'),
163165
typeScriptProject: {
164166
name: 'material-next',
165-
rootPath: path.join(process.cwd(), 'packages/mui-material-next'),
167+
rootPath: path.join(workspaceRoot, 'packages/mui-material-next'),
166168
entryPointPath: 'src/index.ts',
167169
},
168170
useExternalDocumentation: useMaterialUiExternalDocumentation,
169171
ignoreExternalDocumentation: ignoreMaterialUiExternalDocumentation,
170172
},
171173
{
172-
rootPath: path.resolve(process.cwd(), 'packages/mui-joy/src'),
174+
rootPath: path.resolve(workspaceRoot, 'packages/mui-joy/src'),
173175
typeScriptProject: {
174176
name: 'joy',
175-
rootPath: path.join(process.cwd(), 'packages/mui-joy'),
177+
rootPath: path.join(workspaceRoot, 'packages/mui-joy'),
176178
entryPointPath: 'src/index.ts',
177179
},
178180
useExternalDocumentation: {

scripts/package.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "scripts",
3+
"version": "1.0.0",
4+
"private": true,
5+
"scripts": {
6+
"proptypes": "tsx ./generateProptypes.ts"
7+
},
8+
"nx": {
9+
"targets": {
10+
"proptypes": {
11+
"dependsOn": [
12+
{
13+
"projects": [
14+
"@mui-internal/proptypes-builder"
15+
],
16+
"target": "build"
17+
}
18+
]
19+
}
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)