From 47e1cf934a8bf4e4f31f663ac90e86be4863b62a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dudak?= Date: Tue, 20 Feb 2024 21:04:40 +0100 Subject: [PATCH] [code-infra] Move typescript-to-proptypes to internal-scripts package (#41079) --- .circleci/config.yml | 8 +- .codesandbox/ci.json | 4 +- .eslintignore | 2 +- .eslintrc.js | 2 +- babel.config.js | 1 - docs/package.json | 2 +- docs/scripts/formattedTSDemos.js | 2 +- package.json | 2 +- .../scripts}/.npmignore | 0 packages-internal/scripts/CHANGELOG.md | 6 + .../scripts}/README.md | 0 .../scripts}/package.json | 20 ++- packages-internal/scripts/tsconfig.base.json | 17 ++ packages-internal/scripts/tsconfig.json | 5 + .../scripts/tsconfig.typecheck.json | 11 ++ .../typescript-to-proptypes/CHANGELOG.old.md | 0 .../typescript-to-proptypes/src/createType.ts | 0 .../src/generatePropTypes.ts | 0 .../src/getPropTypesFromFile.ts | 0 .../src/getTypeHash.ts | 0 .../typescript-to-proptypes/src/index.ts | 0 .../src/injectPropTypesInFile.ts | 0 .../typescript-to-proptypes/src/models.ts | 0 .../typescript-to-proptypes/test}/.mocharc.js | 2 +- .../test/boolean-values/optional/input.d.ts | 0 .../test/boolean-values/optional/output.js | 0 .../test/boolean-values/required/input.d.ts | 0 .../test/boolean-values/required/output.js | 0 .../test/code-order/input.d.ts | 0 .../test/code-order/input.js | 0 .../test/code-order/output.js | 0 .../test/default-value/input.d.ts | 0 .../test/default-value/output.js | 0 .../test/generator/html-elements/input.d.ts | 0 .../test/generator/html-elements/output.js | 0 .../test/generic/input.d.ts | 0 .../test/generic/output.js | 0 .../test/genericUnion/input.tsx | 0 .../test/genericUnion/output.js | 0 .../test/getThemeProps/input.d.ts | 0 .../test/getThemeProps/input.js | 0 .../test/getThemeProps/output.js | 0 .../test/injector/all-props-ignored/input.tsx | 0 .../injector/all-props-ignored/options.ts | 0 .../test/injector/all-props-ignored/output.js | 0 .../should-include-component-based/input.tsx | 0 .../should-include-component-based/options.ts | 0 .../should-include-component-based/output.js | 0 .../should-include-filename-based/input.tsx | 0 .../should-include-filename-based/options.ts | 0 .../should-include-filename-based/output.js | 0 .../test/injector/string-props/input.tsx | 0 .../test/injector/string-props/output.js | 0 .../test/injector/whitelisted-props/input.tsx | 0 .../injector/whitelisted-props/options.ts | 0 .../test/injector/whitelisted-props/output.js | 0 .../test/interfaceUnion/input.tsx | 0 .../test/interfaceUnion/output.js | 0 .../test/jsdoc-interface/classes.ts | 0 .../test/jsdoc-interface/input.tsx | 0 .../test/jsdoc-interface/output.js | 0 .../test/mixed-literals/input.tsx | 0 .../test/mixed-literals/output.js | 0 .../test/omit-conditional/input.d.ts | 0 .../test/omit-conditional/output.js | 0 .../test/options-test/input.tsx | 0 .../test/options-test/options.ts | 2 +- .../test/options-test/output.js | 0 .../overloaded-function-component/input.d.ts | 0 .../overloaded-function-component/options.ts | 2 +- .../overloaded-function-component/output.js | 0 .../test/partial-any-props/input.d.ts | 0 .../test/partial-any-props/output.js | 0 .../test/propTypes-casting/input.tsx | 0 .../test/propTypes-casting/output.js | 0 .../test/reconcile-prop-types/input.d.ts | 0 .../test/reconcile-prop-types/input.js | 0 .../test/reconcile-prop-types/options.ts | 0 .../test/reconcile-prop-types/output.js | 0 .../test/remove-proptypes/input.tsx | 0 .../test/remove-proptypes/options.ts | 2 +- .../test/remove-proptypes/output.js | 0 .../test/sort-unions/input.d.ts | 0 .../test/sort-unions/input.js | 0 .../test/sort-unions/options.ts | 0 .../test/sort-unions/output.js | 0 .../typescript-to-proptypes/test/testSetup.js | 0 .../test/type-unknown/input.tsx | 0 .../test/type-unknown/output.js | 0 .../typescript-to-proptypes/test/types.d.ts | 0 .../test/typescript-to-proptypes.test.ts | 9 +- .../test/union-props/input.d.ts | 0 .../test/union-props/input.js | 0 .../test/union-props/output.js | 0 .../test/unused-prop/input.tsx | 0 .../test/unused-prop/output.js | 0 .../typescript-to-proptypes/tsconfig.json | 9 + .../tsconfig.test.json | 2 +- .../src/getPropsFromComponentNode.ts | 2 +- .../test/generated-types/tsconfig.json | 4 +- packages/typescript-to-proptypes/CHANGELOG.md | 18 -- packages/typescript-to-proptypes/LICENSE | 21 --- .../tsconfig.build.json | 15 -- pnpm-lock.yaml | 154 +++++++++--------- pnpm-workspace.yaml | 1 + scripts/generateProptypes.ts | 2 +- tsconfig.json | 4 +- webpackBaseConfig.js | 4 +- 108 files changed, 166 insertions(+), 169 deletions(-) rename {packages/typescript-to-proptypes => packages-internal/scripts}/.npmignore (100%) create mode 100644 packages-internal/scripts/CHANGELOG.md rename {packages/typescript-to-proptypes => packages-internal/scripts}/README.md (100%) rename {packages/typescript-to-proptypes => packages-internal/scripts}/package.json (67%) create mode 100644 packages-internal/scripts/tsconfig.base.json create mode 100644 packages-internal/scripts/tsconfig.json create mode 100644 packages-internal/scripts/tsconfig.typecheck.json rename {packages => packages-internal/scripts}/typescript-to-proptypes/CHANGELOG.old.md (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/src/createType.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/src/generatePropTypes.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/src/getPropTypesFromFile.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/src/getTypeHash.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/src/index.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/src/injectPropTypesInFile.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/src/models.ts (100%) rename {packages/typescript-to-proptypes => packages-internal/scripts/typescript-to-proptypes/test}/.mocharc.js (64%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/boolean-values/optional/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/boolean-values/optional/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/boolean-values/required/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/boolean-values/required/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/code-order/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/code-order/input.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/code-order/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/default-value/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/default-value/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/generator/html-elements/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/generator/html-elements/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/generic/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/generic/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/genericUnion/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/genericUnion/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/getThemeProps/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/getThemeProps/input.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/getThemeProps/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/all-props-ignored/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/all-props-ignored/options.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/all-props-ignored/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/should-include-component-based/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/should-include-component-based/options.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/should-include-component-based/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/should-include-filename-based/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/should-include-filename-based/options.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/should-include-filename-based/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/string-props/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/string-props/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/whitelisted-props/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/whitelisted-props/options.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/injector/whitelisted-props/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/interfaceUnion/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/interfaceUnion/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/jsdoc-interface/classes.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/jsdoc-interface/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/jsdoc-interface/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/mixed-literals/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/mixed-literals/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/omit-conditional/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/omit-conditional/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/options-test/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/options-test/options.ts (91%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/options-test/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/overloaded-function-component/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/overloaded-function-component/options.ts (82%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/overloaded-function-component/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/partial-any-props/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/partial-any-props/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/propTypes-casting/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/propTypes-casting/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/reconcile-prop-types/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/reconcile-prop-types/input.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/reconcile-prop-types/options.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/reconcile-prop-types/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/remove-proptypes/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/remove-proptypes/options.ts (89%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/remove-proptypes/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/sort-unions/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/sort-unions/input.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/sort-unions/options.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/sort-unions/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/testSetup.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/type-unknown/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/type-unknown/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/types.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/typescript-to-proptypes.test.ts (94%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/union-props/input.d.ts (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/union-props/input.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/union-props/output.js (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/unused-prop/input.tsx (100%) rename {packages => packages-internal/scripts}/typescript-to-proptypes/test/unused-prop/output.js (100%) create mode 100644 packages-internal/scripts/typescript-to-proptypes/tsconfig.json rename packages/typescript-to-proptypes/tsconfig.json => packages-internal/scripts/typescript-to-proptypes/tsconfig.test.json (77%) delete mode 100644 packages/typescript-to-proptypes/CHANGELOG.md delete mode 100644 packages/typescript-to-proptypes/LICENSE delete mode 100644 packages/typescript-to-proptypes/tsconfig.build.json diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a93b0944e60b6..74998eba11ed6e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -166,17 +166,17 @@ jobs: echo "no changes" fi - run: - name: typescript-to-proptypes + name: internal-scripts command: | # latest commit LATEST_COMMIT=$(git rev-parse HEAD) - # latest commit where packages/typescript-to-proptypes was changed - FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff packages/typescript-to-proptypes) + # latest commit where internal-scripts was changed + FOLDER_COMMIT=$(git log -1 --format=format:%H --full-diff packages-internal/scripts) if [ $FOLDER_COMMIT = $LATEST_COMMIT ]; then echo "changes, let's run the tests" - pnpm --filter typescript-to-proptypes test + pnpm --filter @mui/internal-scripts test else echo "no changes" fi diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index f81bc2357a68b9..4b729cfbbfff81 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -20,7 +20,7 @@ "packages/mui-types", "packages/mui-utils", "packages/docs-utils", - "packages/typescript-to-proptypes" + "packages-internal/scripts" ], "publishDirectory": { "@mui/base": "packages/mui-base/build", @@ -40,7 +40,7 @@ "@mui/types": "packages/mui-types/build", "@mui/utils": "packages/mui-utils/build", "@mui-internal/docs-utils": "packages/docs-utils", - "@mui-internal/typescript-to-proptypes": "packages/typescript-to-proptypes" + "@mui/internal-scripts": "packages-internal/scripts" }, "sandboxes": [ "/examples/material-ui-cra-ts", diff --git a/.eslintignore b/.eslintignore index 859965ff105a95..d6b5b184b02ed5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -26,7 +26,7 @@ /packages/zero-runtime/tests/fixtures/ /packages/zero-next-plugin/loader.js # Ignore fixtures -/packages/typescript-to-proptypes/test/*/* +/packages-internal/scripts/typescript-to-proptypes/test/*/* /test/bundling/fixtures/**/*.fixture.js # just an import that reports eslint errors depending on whether the fixture (which is not checked in) exists /test/bundling/fixtures/create-react-app/src/index.js diff --git a/.eslintrc.js b/.eslintrc.js index fe096a7451f376..a06ac35ae3f3ae 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -413,7 +413,7 @@ module.exports = { }, }, { - files: ['packages/typescript-to-proptypes/src/**/*.ts'], + files: ['packages-internal/scripts/typescript-to-proptypes/src/**/*.ts'], rules: { // Working with flags is common in TypeScript compiler 'no-bitwise': 'off', diff --git a/babel.config.js b/babel.config.js index f04e19b097f92f..b93f8a9311a167 100644 --- a/babel.config.js +++ b/babel.config.js @@ -138,7 +138,6 @@ module.exports = function getBabelConfig(api) { alias: { ...defaultAlias, modules: './modules', - 'typescript-to-proptypes': './packages/typescript-to-proptypes/src', }, root: ['./'], }, diff --git a/docs/package.json b/docs/package.json index afb328227c1b4c..d58ecec1b0b5cd 100644 --- a/docs/package.json +++ b/docs/package.json @@ -116,9 +116,9 @@ "devDependencies": { "@babel/plugin-transform-react-constant-elements": "^7.23.3", "@babel/preset-typescript": "^7.23.3", + "@mui/internal-scripts": "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", diff --git a/docs/scripts/formattedTSDemos.js b/docs/scripts/formattedTSDemos.js index f4b3ea1d036199..f1a4a46b9f4dbd 100644 --- a/docs/scripts/formattedTSDemos.js +++ b/docs/scripts/formattedTSDemos.js @@ -18,7 +18,7 @@ const prettier = require('prettier'); const { getPropTypesFromFile, injectPropTypesInFile, -} = require('@mui-internal/typescript-to-proptypes'); +} = require('@mui/internal-scripts/typescript-to-proptypes'); const { createTypeScriptProjectBuilder, } = require('@mui-internal/api-docs-builder/utils/createTypeScriptProject'); diff --git a/package.json b/package.json index 21587fee30f237..d3a6d227332943 100644 --- a/package.json +++ b/package.json @@ -101,11 +101,11 @@ "@babel/preset-typescript": "^7.23.3", "@babel/register": "^7.23.7", "@mnajdova/enzyme-adapter-react-18": "^0.2.0", + "@mui/internal-scripts": "workspace:^", "@mui-internal/api-docs-builder": "workspace:^", "@mui-internal/api-docs-builder-core": "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:^", diff --git a/packages/typescript-to-proptypes/.npmignore b/packages-internal/scripts/.npmignore similarity index 100% rename from packages/typescript-to-proptypes/.npmignore rename to packages-internal/scripts/.npmignore diff --git a/packages-internal/scripts/CHANGELOG.md b/packages-internal/scripts/CHANGELOG.md new file mode 100644 index 00000000000000..dc7990cf50c3e2 --- /dev/null +++ b/packages-internal/scripts/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +## 1.0.0 + +Initial release as an npm package. +The package contains the typescript-to-proptypes module. diff --git a/packages/typescript-to-proptypes/README.md b/packages-internal/scripts/README.md similarity index 100% rename from packages/typescript-to-proptypes/README.md rename to packages-internal/scripts/README.md diff --git a/packages/typescript-to-proptypes/package.json b/packages-internal/scripts/package.json similarity index 67% rename from packages/typescript-to-proptypes/package.json rename to packages-internal/scripts/package.json index e7626422b9a64a..caf6ef585608a3 100644 --- a/packages/typescript-to-proptypes/package.json +++ b/packages-internal/scripts/package.json @@ -1,26 +1,28 @@ { - "name": "@mui-internal/typescript-to-proptypes", - "version": "1.0.3", + "name": "@mui/internal-scripts", + "version": "1.0.0", "author": "MUI Team", - "description": "Generate proptypes from TypeScript declarations. This is a fork of the typescript-to-proptypes package adapted for MUI needs. This is an internal package not meant for general use.", + "description": "Utilities supporting MUI libraries build and docs generation. This is an internal package not meant for general use.", "main": "build/index.js", "exports": { - ".": "./build/index.js" + "./typescript-to-proptypes": { + "default": "./build/typescript-to-proptypes/index.js", + "types": "./build/typescript-to-proptypes/index.d.ts" + } }, - "types": "./build/index.d.ts", "repository": { "type": "git", "url": "https://github.com/mui/material-ui.git", - "directory": "packages/typescript-to-proptypes" + "directory": "packages-internal/scripts" }, "license": "MIT", "scripts": { "prebuild": "rimraf ./build", - "build": "tsc -b tsconfig.build.json", + "build": "tsc --build tsconfig.json", "release:publish": "pnpm publish --tag latest", "release:publish:dry-run": "pnpm publish --tag latest --registry=\"http://localhost:4873/\"", - "test": "cd ../../ && cross-env NODE_ENV=test mocha --config packages/typescript-to-proptypes/.mocharc.js 'packages/typescript-to-proptypes/**/*.test.ts'", - "typescript": "tsc -b tsconfig.json" + "test": "cd ../../ && cross-env NODE_ENV=test mocha --config packages-internal/scripts/typescript-to-proptypes/test/.mocharc.js 'packages-internal/scripts/typescript-to-proptypes/**/*.test.ts'", + "typescript": "tsc --build tsconfig.typecheck.json" }, "dependencies": { "@babel/core": "^7.23.9", diff --git a/packages-internal/scripts/tsconfig.base.json b/packages-internal/scripts/tsconfig.base.json new file mode 100644 index 00000000000000..07b81b7552e0a4 --- /dev/null +++ b/packages-internal/scripts/tsconfig.base.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2020", + "moduleResolution": "node", + "module": "commonjs", + "types": ["node"], + + "strict": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "composite": true, + + "esModuleInterop": true, + "isolatedModules": true + } +} diff --git a/packages-internal/scripts/tsconfig.json b/packages-internal/scripts/tsconfig.json new file mode 100644 index 00000000000000..beb8da4f93e065 --- /dev/null +++ b/packages-internal/scripts/tsconfig.json @@ -0,0 +1,5 @@ +{ + "files": [], + "include": [], + "references": [{ "path": "./typescript-to-proptypes" }] +} diff --git a/packages-internal/scripts/tsconfig.typecheck.json b/packages-internal/scripts/tsconfig.typecheck.json new file mode 100644 index 00000000000000..ae133d71c10945 --- /dev/null +++ b/packages-internal/scripts/tsconfig.typecheck.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "rootDir": "../..", + "types": ["node", "mocha"], + "noEmit": true + }, + "include": ["./**/*.ts"], + "exclude": ["./build", "./node_modules"], + "references": [{ "path": "../../packages/docs-utils/tsconfig.build.json" }] +} diff --git a/packages/typescript-to-proptypes/CHANGELOG.old.md b/packages-internal/scripts/typescript-to-proptypes/CHANGELOG.old.md similarity index 100% rename from packages/typescript-to-proptypes/CHANGELOG.old.md rename to packages-internal/scripts/typescript-to-proptypes/CHANGELOG.old.md diff --git a/packages/typescript-to-proptypes/src/createType.ts b/packages-internal/scripts/typescript-to-proptypes/src/createType.ts similarity index 100% rename from packages/typescript-to-proptypes/src/createType.ts rename to packages-internal/scripts/typescript-to-proptypes/src/createType.ts diff --git a/packages/typescript-to-proptypes/src/generatePropTypes.ts b/packages-internal/scripts/typescript-to-proptypes/src/generatePropTypes.ts similarity index 100% rename from packages/typescript-to-proptypes/src/generatePropTypes.ts rename to packages-internal/scripts/typescript-to-proptypes/src/generatePropTypes.ts diff --git a/packages/typescript-to-proptypes/src/getPropTypesFromFile.ts b/packages-internal/scripts/typescript-to-proptypes/src/getPropTypesFromFile.ts similarity index 100% rename from packages/typescript-to-proptypes/src/getPropTypesFromFile.ts rename to packages-internal/scripts/typescript-to-proptypes/src/getPropTypesFromFile.ts diff --git a/packages/typescript-to-proptypes/src/getTypeHash.ts b/packages-internal/scripts/typescript-to-proptypes/src/getTypeHash.ts similarity index 100% rename from packages/typescript-to-proptypes/src/getTypeHash.ts rename to packages-internal/scripts/typescript-to-proptypes/src/getTypeHash.ts diff --git a/packages/typescript-to-proptypes/src/index.ts b/packages-internal/scripts/typescript-to-proptypes/src/index.ts similarity index 100% rename from packages/typescript-to-proptypes/src/index.ts rename to packages-internal/scripts/typescript-to-proptypes/src/index.ts diff --git a/packages/typescript-to-proptypes/src/injectPropTypesInFile.ts b/packages-internal/scripts/typescript-to-proptypes/src/injectPropTypesInFile.ts similarity index 100% rename from packages/typescript-to-proptypes/src/injectPropTypesInFile.ts rename to packages-internal/scripts/typescript-to-proptypes/src/injectPropTypesInFile.ts diff --git a/packages/typescript-to-proptypes/src/models.ts b/packages-internal/scripts/typescript-to-proptypes/src/models.ts similarity index 100% rename from packages/typescript-to-proptypes/src/models.ts rename to packages-internal/scripts/typescript-to-proptypes/src/models.ts diff --git a/packages/typescript-to-proptypes/.mocharc.js b/packages-internal/scripts/typescript-to-proptypes/test/.mocharc.js similarity index 64% rename from packages/typescript-to-proptypes/.mocharc.js rename to packages-internal/scripts/typescript-to-proptypes/test/.mocharc.js index 2093a87b1241b3..5a60ddd0c6b908 100644 --- a/packages/typescript-to-proptypes/.mocharc.js +++ b/packages-internal/scripts/typescript-to-proptypes/test/.mocharc.js @@ -1,5 +1,5 @@ module.exports = { extension: ['js', 'ts', 'tsx'], ignore: ['**/node_modules/**'], - require: [require.resolve('./test/testSetup')], + require: [require.resolve('./testSetup')], }; diff --git a/packages/typescript-to-proptypes/test/boolean-values/optional/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/boolean-values/optional/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/boolean-values/optional/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/boolean-values/optional/input.d.ts diff --git a/packages/typescript-to-proptypes/test/boolean-values/optional/output.js b/packages-internal/scripts/typescript-to-proptypes/test/boolean-values/optional/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/boolean-values/optional/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/boolean-values/optional/output.js diff --git a/packages/typescript-to-proptypes/test/boolean-values/required/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/boolean-values/required/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/boolean-values/required/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/boolean-values/required/input.d.ts diff --git a/packages/typescript-to-proptypes/test/boolean-values/required/output.js b/packages-internal/scripts/typescript-to-proptypes/test/boolean-values/required/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/boolean-values/required/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/boolean-values/required/output.js diff --git a/packages/typescript-to-proptypes/test/code-order/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/code-order/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/code-order/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/code-order/input.d.ts diff --git a/packages/typescript-to-proptypes/test/code-order/input.js b/packages-internal/scripts/typescript-to-proptypes/test/code-order/input.js similarity index 100% rename from packages/typescript-to-proptypes/test/code-order/input.js rename to packages-internal/scripts/typescript-to-proptypes/test/code-order/input.js diff --git a/packages/typescript-to-proptypes/test/code-order/output.js b/packages-internal/scripts/typescript-to-proptypes/test/code-order/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/code-order/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/code-order/output.js diff --git a/packages/typescript-to-proptypes/test/default-value/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/default-value/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/default-value/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/default-value/input.d.ts diff --git a/packages/typescript-to-proptypes/test/default-value/output.js b/packages-internal/scripts/typescript-to-proptypes/test/default-value/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/default-value/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/default-value/output.js diff --git a/packages/typescript-to-proptypes/test/generator/html-elements/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/generator/html-elements/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/generator/html-elements/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/generator/html-elements/input.d.ts diff --git a/packages/typescript-to-proptypes/test/generator/html-elements/output.js b/packages-internal/scripts/typescript-to-proptypes/test/generator/html-elements/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/generator/html-elements/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/generator/html-elements/output.js diff --git a/packages/typescript-to-proptypes/test/generic/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/generic/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/generic/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/generic/input.d.ts diff --git a/packages/typescript-to-proptypes/test/generic/output.js b/packages-internal/scripts/typescript-to-proptypes/test/generic/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/generic/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/generic/output.js diff --git a/packages/typescript-to-proptypes/test/genericUnion/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/genericUnion/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/genericUnion/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/genericUnion/input.tsx diff --git a/packages/typescript-to-proptypes/test/genericUnion/output.js b/packages-internal/scripts/typescript-to-proptypes/test/genericUnion/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/genericUnion/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/genericUnion/output.js diff --git a/packages/typescript-to-proptypes/test/getThemeProps/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/getThemeProps/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/getThemeProps/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/getThemeProps/input.d.ts diff --git a/packages/typescript-to-proptypes/test/getThemeProps/input.js b/packages-internal/scripts/typescript-to-proptypes/test/getThemeProps/input.js similarity index 100% rename from packages/typescript-to-proptypes/test/getThemeProps/input.js rename to packages-internal/scripts/typescript-to-proptypes/test/getThemeProps/input.js diff --git a/packages/typescript-to-proptypes/test/getThemeProps/output.js b/packages-internal/scripts/typescript-to-proptypes/test/getThemeProps/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/getThemeProps/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/getThemeProps/output.js diff --git a/packages/typescript-to-proptypes/test/injector/all-props-ignored/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/injector/all-props-ignored/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/injector/all-props-ignored/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/injector/all-props-ignored/input.tsx diff --git a/packages/typescript-to-proptypes/test/injector/all-props-ignored/options.ts b/packages-internal/scripts/typescript-to-proptypes/test/injector/all-props-ignored/options.ts similarity index 100% rename from packages/typescript-to-proptypes/test/injector/all-props-ignored/options.ts rename to packages-internal/scripts/typescript-to-proptypes/test/injector/all-props-ignored/options.ts diff --git a/packages/typescript-to-proptypes/test/injector/all-props-ignored/output.js b/packages-internal/scripts/typescript-to-proptypes/test/injector/all-props-ignored/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/injector/all-props-ignored/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/injector/all-props-ignored/output.js diff --git a/packages/typescript-to-proptypes/test/injector/should-include-component-based/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/injector/should-include-component-based/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/injector/should-include-component-based/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/injector/should-include-component-based/input.tsx diff --git a/packages/typescript-to-proptypes/test/injector/should-include-component-based/options.ts b/packages-internal/scripts/typescript-to-proptypes/test/injector/should-include-component-based/options.ts similarity index 100% rename from packages/typescript-to-proptypes/test/injector/should-include-component-based/options.ts rename to packages-internal/scripts/typescript-to-proptypes/test/injector/should-include-component-based/options.ts diff --git a/packages/typescript-to-proptypes/test/injector/should-include-component-based/output.js b/packages-internal/scripts/typescript-to-proptypes/test/injector/should-include-component-based/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/injector/should-include-component-based/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/injector/should-include-component-based/output.js diff --git a/packages/typescript-to-proptypes/test/injector/should-include-filename-based/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/injector/should-include-filename-based/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/injector/should-include-filename-based/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/injector/should-include-filename-based/input.tsx diff --git a/packages/typescript-to-proptypes/test/injector/should-include-filename-based/options.ts b/packages-internal/scripts/typescript-to-proptypes/test/injector/should-include-filename-based/options.ts similarity index 100% rename from packages/typescript-to-proptypes/test/injector/should-include-filename-based/options.ts rename to packages-internal/scripts/typescript-to-proptypes/test/injector/should-include-filename-based/options.ts diff --git a/packages/typescript-to-proptypes/test/injector/should-include-filename-based/output.js b/packages-internal/scripts/typescript-to-proptypes/test/injector/should-include-filename-based/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/injector/should-include-filename-based/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/injector/should-include-filename-based/output.js diff --git a/packages/typescript-to-proptypes/test/injector/string-props/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/injector/string-props/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/injector/string-props/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/injector/string-props/input.tsx diff --git a/packages/typescript-to-proptypes/test/injector/string-props/output.js b/packages-internal/scripts/typescript-to-proptypes/test/injector/string-props/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/injector/string-props/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/injector/string-props/output.js diff --git a/packages/typescript-to-proptypes/test/injector/whitelisted-props/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/injector/whitelisted-props/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/injector/whitelisted-props/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/injector/whitelisted-props/input.tsx diff --git a/packages/typescript-to-proptypes/test/injector/whitelisted-props/options.ts b/packages-internal/scripts/typescript-to-proptypes/test/injector/whitelisted-props/options.ts similarity index 100% rename from packages/typescript-to-proptypes/test/injector/whitelisted-props/options.ts rename to packages-internal/scripts/typescript-to-proptypes/test/injector/whitelisted-props/options.ts diff --git a/packages/typescript-to-proptypes/test/injector/whitelisted-props/output.js b/packages-internal/scripts/typescript-to-proptypes/test/injector/whitelisted-props/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/injector/whitelisted-props/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/injector/whitelisted-props/output.js diff --git a/packages/typescript-to-proptypes/test/interfaceUnion/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/interfaceUnion/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/interfaceUnion/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/interfaceUnion/input.tsx diff --git a/packages/typescript-to-proptypes/test/interfaceUnion/output.js b/packages-internal/scripts/typescript-to-proptypes/test/interfaceUnion/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/interfaceUnion/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/interfaceUnion/output.js diff --git a/packages/typescript-to-proptypes/test/jsdoc-interface/classes.ts b/packages-internal/scripts/typescript-to-proptypes/test/jsdoc-interface/classes.ts similarity index 100% rename from packages/typescript-to-proptypes/test/jsdoc-interface/classes.ts rename to packages-internal/scripts/typescript-to-proptypes/test/jsdoc-interface/classes.ts diff --git a/packages/typescript-to-proptypes/test/jsdoc-interface/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/jsdoc-interface/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/jsdoc-interface/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/jsdoc-interface/input.tsx diff --git a/packages/typescript-to-proptypes/test/jsdoc-interface/output.js b/packages-internal/scripts/typescript-to-proptypes/test/jsdoc-interface/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/jsdoc-interface/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/jsdoc-interface/output.js diff --git a/packages/typescript-to-proptypes/test/mixed-literals/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/mixed-literals/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/mixed-literals/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/mixed-literals/input.tsx diff --git a/packages/typescript-to-proptypes/test/mixed-literals/output.js b/packages-internal/scripts/typescript-to-proptypes/test/mixed-literals/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/mixed-literals/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/mixed-literals/output.js diff --git a/packages/typescript-to-proptypes/test/omit-conditional/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/omit-conditional/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/omit-conditional/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/omit-conditional/input.d.ts diff --git a/packages/typescript-to-proptypes/test/omit-conditional/output.js b/packages-internal/scripts/typescript-to-proptypes/test/omit-conditional/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/omit-conditional/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/omit-conditional/output.js diff --git a/packages/typescript-to-proptypes/test/options-test/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/options-test/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/options-test/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/options-test/input.tsx diff --git a/packages/typescript-to-proptypes/test/options-test/options.ts b/packages-internal/scripts/typescript-to-proptypes/test/options-test/options.ts similarity index 91% rename from packages/typescript-to-proptypes/test/options-test/options.ts rename to packages-internal/scripts/typescript-to-proptypes/test/options-test/options.ts index 0d76f3064bb9b8..254f96b7b7d4be 100644 --- a/packages/typescript-to-proptypes/test/options-test/options.ts +++ b/packages-internal/scripts/typescript-to-proptypes/test/options-test/options.ts @@ -8,7 +8,7 @@ const options: TestOptions = { } return true; }, - }, + } as TestOptions['parser'], injector: { includeJSDoc: false, comment: 'Proptypes generated automatically', diff --git a/packages/typescript-to-proptypes/test/options-test/output.js b/packages-internal/scripts/typescript-to-proptypes/test/options-test/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/options-test/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/options-test/output.js diff --git a/packages/typescript-to-proptypes/test/overloaded-function-component/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/overloaded-function-component/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/overloaded-function-component/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/overloaded-function-component/input.d.ts diff --git a/packages/typescript-to-proptypes/test/overloaded-function-component/options.ts b/packages-internal/scripts/typescript-to-proptypes/test/overloaded-function-component/options.ts similarity index 82% rename from packages/typescript-to-proptypes/test/overloaded-function-component/options.ts rename to packages-internal/scripts/typescript-to-proptypes/test/overloaded-function-component/options.ts index 2fa9ca8cddac8b..7bb82591a8b820 100644 --- a/packages/typescript-to-proptypes/test/overloaded-function-component/options.ts +++ b/packages-internal/scripts/typescript-to-proptypes/test/overloaded-function-component/options.ts @@ -3,7 +3,7 @@ import { TestOptions } from '../types'; const options: TestOptions = { parser: { checkDeclarations: true, - }, + } as TestOptions['parser'], }; export default options; diff --git a/packages/typescript-to-proptypes/test/overloaded-function-component/output.js b/packages-internal/scripts/typescript-to-proptypes/test/overloaded-function-component/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/overloaded-function-component/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/overloaded-function-component/output.js diff --git a/packages/typescript-to-proptypes/test/partial-any-props/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/partial-any-props/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/partial-any-props/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/partial-any-props/input.d.ts diff --git a/packages/typescript-to-proptypes/test/partial-any-props/output.js b/packages-internal/scripts/typescript-to-proptypes/test/partial-any-props/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/partial-any-props/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/partial-any-props/output.js diff --git a/packages/typescript-to-proptypes/test/propTypes-casting/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/propTypes-casting/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/propTypes-casting/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/propTypes-casting/input.tsx diff --git a/packages/typescript-to-proptypes/test/propTypes-casting/output.js b/packages-internal/scripts/typescript-to-proptypes/test/propTypes-casting/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/propTypes-casting/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/propTypes-casting/output.js diff --git a/packages/typescript-to-proptypes/test/reconcile-prop-types/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/reconcile-prop-types/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/reconcile-prop-types/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/reconcile-prop-types/input.d.ts diff --git a/packages/typescript-to-proptypes/test/reconcile-prop-types/input.js b/packages-internal/scripts/typescript-to-proptypes/test/reconcile-prop-types/input.js similarity index 100% rename from packages/typescript-to-proptypes/test/reconcile-prop-types/input.js rename to packages-internal/scripts/typescript-to-proptypes/test/reconcile-prop-types/input.js diff --git a/packages/typescript-to-proptypes/test/reconcile-prop-types/options.ts b/packages-internal/scripts/typescript-to-proptypes/test/reconcile-prop-types/options.ts similarity index 100% rename from packages/typescript-to-proptypes/test/reconcile-prop-types/options.ts rename to packages-internal/scripts/typescript-to-proptypes/test/reconcile-prop-types/options.ts diff --git a/packages/typescript-to-proptypes/test/reconcile-prop-types/output.js b/packages-internal/scripts/typescript-to-proptypes/test/reconcile-prop-types/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/reconcile-prop-types/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/reconcile-prop-types/output.js diff --git a/packages/typescript-to-proptypes/test/remove-proptypes/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/remove-proptypes/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/remove-proptypes/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/remove-proptypes/input.tsx diff --git a/packages/typescript-to-proptypes/test/remove-proptypes/options.ts b/packages-internal/scripts/typescript-to-proptypes/test/remove-proptypes/options.ts similarity index 89% rename from packages/typescript-to-proptypes/test/remove-proptypes/options.ts rename to packages-internal/scripts/typescript-to-proptypes/test/remove-proptypes/options.ts index ed232575d39da3..3fa1538b62dc2b 100644 --- a/packages/typescript-to-proptypes/test/remove-proptypes/options.ts +++ b/packages-internal/scripts/typescript-to-proptypes/test/remove-proptypes/options.ts @@ -7,7 +7,7 @@ const options: TestOptions = { }, parser: { checkDeclarations: true, - }, + } as TestOptions['parser'], }; export default options; diff --git a/packages/typescript-to-proptypes/test/remove-proptypes/output.js b/packages-internal/scripts/typescript-to-proptypes/test/remove-proptypes/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/remove-proptypes/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/remove-proptypes/output.js diff --git a/packages/typescript-to-proptypes/test/sort-unions/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/sort-unions/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/sort-unions/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/sort-unions/input.d.ts diff --git a/packages/typescript-to-proptypes/test/sort-unions/input.js b/packages-internal/scripts/typescript-to-proptypes/test/sort-unions/input.js similarity index 100% rename from packages/typescript-to-proptypes/test/sort-unions/input.js rename to packages-internal/scripts/typescript-to-proptypes/test/sort-unions/input.js diff --git a/packages/typescript-to-proptypes/test/sort-unions/options.ts b/packages-internal/scripts/typescript-to-proptypes/test/sort-unions/options.ts similarity index 100% rename from packages/typescript-to-proptypes/test/sort-unions/options.ts rename to packages-internal/scripts/typescript-to-proptypes/test/sort-unions/options.ts diff --git a/packages/typescript-to-proptypes/test/sort-unions/output.js b/packages-internal/scripts/typescript-to-proptypes/test/sort-unions/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/sort-unions/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/sort-unions/output.js diff --git a/packages/typescript-to-proptypes/test/testSetup.js b/packages-internal/scripts/typescript-to-proptypes/test/testSetup.js similarity index 100% rename from packages/typescript-to-proptypes/test/testSetup.js rename to packages-internal/scripts/typescript-to-proptypes/test/testSetup.js diff --git a/packages/typescript-to-proptypes/test/type-unknown/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/type-unknown/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/type-unknown/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/type-unknown/input.tsx diff --git a/packages/typescript-to-proptypes/test/type-unknown/output.js b/packages-internal/scripts/typescript-to-proptypes/test/type-unknown/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/type-unknown/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/type-unknown/output.js diff --git a/packages/typescript-to-proptypes/test/types.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/types.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/types.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/types.d.ts diff --git a/packages/typescript-to-proptypes/test/typescript-to-proptypes.test.ts b/packages-internal/scripts/typescript-to-proptypes/test/typescript-to-proptypes.test.ts similarity index 94% rename from packages/typescript-to-proptypes/test/typescript-to-proptypes.test.ts rename to packages-internal/scripts/typescript-to-proptypes/test/typescript-to-proptypes.test.ts index afeca522b5d596..769925840e26b8 100644 --- a/packages/typescript-to-proptypes/test/typescript-to-proptypes.test.ts +++ b/packages-internal/scripts/typescript-to-proptypes/test/typescript-to-proptypes.test.ts @@ -4,10 +4,7 @@ import * as ts from 'typescript'; import { expect } from 'chai'; import glob from 'fast-glob'; import prettier from 'prettier'; -import { - TypeScriptProject, - createTypeScriptProjectBuilder, -} from '@mui-internal/api-docs-builder/utils/createTypeScriptProject'; +import { TypeScriptProject, createTypeScriptProjectBuilder } from '@mui-internal/docs-utils'; import { generatePropTypes } from '../src/generatePropTypes'; import { injectPropTypesInFile } from '../src/injectPropTypesInFile'; import { getPropTypesFromFile } from '../src/getPropTypesFromFile'; @@ -42,7 +39,7 @@ describe('typescript-to-proptypes', () => { const buildProject = createTypeScriptProjectBuilder({ test: { rootPath: path.join(__dirname, '..'), - tsConfigPath: 'tsconfig.json', + tsConfigPath: 'tsconfig.test.json', }, }); @@ -72,7 +69,7 @@ describe('typescript-to-proptypes', () => { const components = getPropTypesFromFile({ filePath: inputPath, project, ...options.parser }); - let inputSource = null; + let inputSource: string | null = null; if (inputPath.endsWith('.d.ts')) { try { inputSource = fs.readFileSync(inputJS, 'utf8'); diff --git a/packages/typescript-to-proptypes/test/union-props/input.d.ts b/packages-internal/scripts/typescript-to-proptypes/test/union-props/input.d.ts similarity index 100% rename from packages/typescript-to-proptypes/test/union-props/input.d.ts rename to packages-internal/scripts/typescript-to-proptypes/test/union-props/input.d.ts diff --git a/packages/typescript-to-proptypes/test/union-props/input.js b/packages-internal/scripts/typescript-to-proptypes/test/union-props/input.js similarity index 100% rename from packages/typescript-to-proptypes/test/union-props/input.js rename to packages-internal/scripts/typescript-to-proptypes/test/union-props/input.js diff --git a/packages/typescript-to-proptypes/test/union-props/output.js b/packages-internal/scripts/typescript-to-proptypes/test/union-props/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/union-props/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/union-props/output.js diff --git a/packages/typescript-to-proptypes/test/unused-prop/input.tsx b/packages-internal/scripts/typescript-to-proptypes/test/unused-prop/input.tsx similarity index 100% rename from packages/typescript-to-proptypes/test/unused-prop/input.tsx rename to packages-internal/scripts/typescript-to-proptypes/test/unused-prop/input.tsx diff --git a/packages/typescript-to-proptypes/test/unused-prop/output.js b/packages-internal/scripts/typescript-to-proptypes/test/unused-prop/output.js similarity index 100% rename from packages/typescript-to-proptypes/test/unused-prop/output.js rename to packages-internal/scripts/typescript-to-proptypes/test/unused-prop/output.js diff --git a/packages-internal/scripts/typescript-to-proptypes/tsconfig.json b/packages-internal/scripts/typescript-to-proptypes/tsconfig.json new file mode 100644 index 00000000000000..ea50eaf1556770 --- /dev/null +++ b/packages-internal/scripts/typescript-to-proptypes/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "../build/typescript-to-proptypes", + "tsBuildInfoFile": "../build/typescript-to-proptypes/.tsbuildinfo" + }, + "include": ["./src/*"] +} diff --git a/packages/typescript-to-proptypes/tsconfig.json b/packages-internal/scripts/typescript-to-proptypes/tsconfig.test.json similarity index 77% rename from packages/typescript-to-proptypes/tsconfig.json rename to packages-internal/scripts/typescript-to-proptypes/tsconfig.test.json index 9939012a1f603f..d5feab93342396 100644 --- a/packages/typescript-to-proptypes/tsconfig.json +++ b/packages-internal/scripts/typescript-to-proptypes/tsconfig.test.json @@ -8,5 +8,5 @@ "isolatedModules": true }, "include": ["./src/*.ts", "./test/*.ts"], - "references": [{ "path": "../docs-utils/tsconfig.build.json" }] + "references": [{ "path": "../../docs-utils/tsconfig.build.json" }] } diff --git a/packages/docs-utils/src/getPropsFromComponentNode.ts b/packages/docs-utils/src/getPropsFromComponentNode.ts index 2e2036fcaa9472..0c04dcd987c2f7 100644 --- a/packages/docs-utils/src/getPropsFromComponentNode.ts +++ b/packages/docs-utils/src/getPropsFromComponentNode.ts @@ -204,7 +204,7 @@ function getPropsFromVariableDeclaration({ const propsType = type.aliasTypeArguments[0]; if (propsType === undefined) { throw new TypeError( - 'Unable to find symbol for `props`. This is a bug in @mui-internal/typescript-to-proptypes.', + 'Unable to find symbol for `props`. This is a bug in typescript-to-proptypes.', ); } return parsePropsType({ diff --git a/packages/mui-icons-material/test/generated-types/tsconfig.json b/packages/mui-icons-material/test/generated-types/tsconfig.json index 7448a99bb9fb9f..182ab1f9baed41 100644 --- a/packages/mui-icons-material/test/generated-types/tsconfig.json +++ b/packages/mui-icons-material/test/generated-types/tsconfig.json @@ -50,7 +50,9 @@ "@mui/zero-tag-processor/*": ["./zero-tag-processor/src/*"], "@mui/zero-vite-plugin": ["./zero-vite-plugin/src"], "@mui/zero-vite-plugin/*": ["./zero-vite-plugin/src/*"], - "typescript-to-proptypes": ["./typescript-to-proptypes/src"] + "@mui/internal-scripts/typescript-to-proptypes": [ + "../packages-internal/scripts/typescript-to-proptypes/src" + ] } }, "exclude": ["**/node_modules/"] diff --git a/packages/typescript-to-proptypes/CHANGELOG.md b/packages/typescript-to-proptypes/CHANGELOG.md deleted file mode 100644 index 92be29c879bcf8..00000000000000 --- a/packages/typescript-to-proptypes/CHANGELOG.md +++ /dev/null @@ -1,18 +0,0 @@ -# Changelog - -This file documents changes in the `@mui-internal/typescript-to-proptypes` package. -For changes before the package was forked, while it was and published as `typescript-to-proptypes`, see [CHANGELOG.old.md](./CHANGELOG.old.md). - -Unfortunately changes done between forking the `typescript-to-proptypes` and publishing `@mui-internal/typescript-to-proptypes` are not documented. - -## 1.0.2 - -Fix the incorrectly published package. - -## 1.0.1 - -Fix the incorrectly published package. - -## 1.0.0 - -Initial release as a `@mui-internal/typescript-to-proptypes` package. diff --git a/packages/typescript-to-proptypes/LICENSE b/packages/typescript-to-proptypes/LICENSE deleted file mode 100644 index 13df8f10e07beb..00000000000000 --- a/packages/typescript-to-proptypes/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 Kristoffer K. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/packages/typescript-to-proptypes/tsconfig.build.json b/packages/typescript-to-proptypes/tsconfig.build.json deleted file mode 100644 index 8992c3d55a7be0..00000000000000 --- a/packages/typescript-to-proptypes/tsconfig.build.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "rootDir": "./src", - "outDir": "./build", - "declaration": true, - "noEmit": false, - "composite": true, - "tsBuildInfoFile": "./build/.tsbuildinfo", - "target": "ES2020", - "module": "commonjs", - "types": ["node"] - }, - "exclude": ["./test/*.ts"] -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 24a1868a1dfb71..ded5ec4cb045a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -104,9 +104,9 @@ importers: '@mui-internal/test-utils': specifier: workspace:^ version: link:packages/test-utils - '@mui-internal/typescript-to-proptypes': + '@mui/internal-scripts': specifier: workspace:^ - version: link:packages/typescript-to-proptypes + version: link:packages-internal/scripts '@mui/joy': specifier: workspace:* version: link:packages/mui-joy/build @@ -839,9 +839,9 @@ importers: '@mui-internal/test-utils': specifier: workspace:^ version: link:../packages/test-utils - '@mui-internal/typescript-to-proptypes': + '@mui/internal-scripts': specifier: workspace:^ - version: link:../packages/typescript-to-proptypes + version: link:../packages-internal/scripts '@types/autosuggest-highlight': specifier: ^3.2.3 version: 3.2.3 @@ -906,6 +906,79 @@ importers: specifier: ^17.7.2 version: 17.7.2 + packages-internal/scripts: + dependencies: + '@babel/core': + specifier: ^7.23.9 + version: 7.23.9 + '@babel/plugin-syntax-class-properties': + specifier: ^7.12.13 + version: 7.12.13(@babel/core@7.23.9) + '@babel/plugin-syntax-jsx': + specifier: ^7.23.3 + version: 7.23.3(@babel/core@7.23.9) + '@babel/plugin-syntax-typescript': + specifier: ^7.23.3 + version: 7.23.3(@babel/core@7.23.9) + '@babel/types': + specifier: ^7.23.9 + version: 7.23.9 + '@mui-internal/docs-utils': + specifier: workspace:* + version: link:../../packages/docs-utils + doctrine: + specifier: ^3.0.0 + version: 3.0.0 + lodash: + specifier: ^4.17.21 + version: 4.17.21 + typescript: + specifier: ^5.3.3 + version: 5.3.3 + uuid: + specifier: ^9.0.1 + version: 9.0.1 + devDependencies: + '@babel/register': + specifier: ^7.23.7 + version: 7.23.7(@babel/core@7.23.9) + '@types/babel__core': + specifier: ^7.20.5 + version: 7.20.5 + '@types/chai': + specifier: ^4.3.11 + version: 4.3.11 + '@types/doctrine': + specifier: ^0.0.9 + version: 0.0.9 + '@types/lodash': + specifier: ^4.14.202 + version: 4.14.202 + '@types/node': + specifier: ^18.19.15 + version: 18.19.15 + '@types/prettier': + specifier: ^2.7.3 + version: 2.7.3 + '@types/react': + specifier: ^18.2.55 + version: 18.2.55 + '@types/uuid': + specifier: ^9.0.8 + version: 9.0.8 + chai: + specifier: ^4.4.1 + version: 4.4.1 + fast-glob: + specifier: ^3.3.2 + version: 3.3.2 + prettier: + specifier: ^3.2.5 + version: 3.2.5 + rimraf: + specifier: ^5.0.5 + version: 5.0.5 + packages/api-docs-builder: dependencies: '@babel/core': @@ -2259,79 +2332,6 @@ importers: specifier: ^5.3.3 version: 5.3.3 - packages/typescript-to-proptypes: - dependencies: - '@babel/core': - specifier: ^7.23.9 - version: 7.23.9 - '@babel/plugin-syntax-class-properties': - specifier: ^7.12.13 - version: 7.12.13(@babel/core@7.23.9) - '@babel/plugin-syntax-jsx': - specifier: ^7.23.3 - version: 7.23.3(@babel/core@7.23.9) - '@babel/plugin-syntax-typescript': - specifier: ^7.23.3 - version: 7.23.3(@babel/core@7.23.9) - '@babel/types': - specifier: ^7.23.9 - version: 7.23.9 - '@mui-internal/docs-utils': - specifier: workspace:* - version: link:../docs-utils - doctrine: - specifier: ^3.0.0 - version: 3.0.0 - lodash: - specifier: ^4.17.21 - version: 4.17.21 - typescript: - specifier: ^5.3.3 - version: 5.3.3 - uuid: - specifier: ^9.0.1 - version: 9.0.1 - devDependencies: - '@babel/register': - specifier: ^7.23.7 - version: 7.23.7(@babel/core@7.23.9) - '@types/babel__core': - specifier: ^7.20.5 - version: 7.20.5 - '@types/chai': - specifier: ^4.3.11 - version: 4.3.11 - '@types/doctrine': - specifier: ^0.0.9 - version: 0.0.9 - '@types/lodash': - specifier: ^4.14.202 - version: 4.14.202 - '@types/node': - specifier: ^18.19.15 - version: 18.19.15 - '@types/prettier': - specifier: ^2.7.3 - version: 2.7.3 - '@types/react': - specifier: ^18.2.55 - version: 18.2.55 - '@types/uuid': - specifier: ^9.0.8 - version: 9.0.8 - chai: - specifier: ^4.4.1 - version: 4.4.1 - fast-glob: - specifier: ^3.3.2 - version: 3.3.2 - prettier: - specifier: ^3.2.5 - version: 3.2.5 - rimraf: - specifier: ^5.0.5 - version: 5.0.5 - packages/waterfall: {} packages/zero-next-plugin: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 7381846dd1bbab..b02f0b0d8d9901 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -2,6 +2,7 @@ packages: - 'benchmark' - 'packages/*' - 'packages/mui-envinfo/test' + - 'packages-internal/*' - 'docs' - 'test' - 'apps/*' diff --git a/scripts/generateProptypes.ts b/scripts/generateProptypes.ts index aa9d7d63766a14..f029876db67f78 100644 --- a/scripts/generateProptypes.ts +++ b/scripts/generateProptypes.ts @@ -15,7 +15,7 @@ import { getPropTypesFromFile, injectPropTypesInFile, InjectPropTypesInFileOptions, -} from '@mui-internal/typescript-to-proptypes'; +} from '@mui/internal-scripts/typescript-to-proptypes'; import { createTypeScriptProjectBuilder, TypeScriptProject, diff --git a/tsconfig.json b/tsconfig.json index 55113a353cabee..5e860876aa929b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -54,7 +54,9 @@ "@mui/zero-vite-plugin": ["./packages/zero-vite-plugin/src"], "@mui/zero-vite-plugin/*": ["./packages/zero-vite-plugin/src/*"], "@mui-internal/docs-utils": ["./packages/docs-utils/src"], - "@mui-internal/typescript-to-proptypes": ["./packages/typescript-to-proptypes/src"] + "@mui/internal-scripts/typescript-to-proptypes": [ + "./packages-internal/scripts/typescript-to-proptypes/src" + ] }, // Otherwise we get react-native typings which conflict with dom.lib. "types": ["node", "react"] diff --git a/webpackBaseConfig.js b/webpackBaseConfig.js index ac26167c3cabd7..9262773b3678c6 100644 --- a/webpackBaseConfig.js +++ b/webpackBaseConfig.js @@ -26,9 +26,9 @@ module.exports = { '@mui/joy': path.resolve(__dirname, './packages/mui-joy/src'), '@mui/zero-runtime': path.resolve(__dirname, './packages/zero-runtime/src'), '@mui-internal/docs-utils': path.resolve(__dirname, './packages/docs-utils/src'), - '@mui-internal/typescript-to-proptypes': path.resolve( + '@mui/internal-scripts/typescript-to-proptypes': path.resolve( __dirname, - './packages/typescript-to-proptypes/src', + './packages-internal/scripts/typescript-to-proptypes/src', ), docs: path.resolve(__dirname, './docs'), },