Skip to content

Commit

Permalink
[typescript-to-proptypes] Integrate into monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Jun 19, 2020
1 parent 54064f1 commit 66fa209
Show file tree
Hide file tree
Showing 94 changed files with 1,729 additions and 4,688 deletions.
15 changes: 15 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,21 @@ jobs:
else
echo "no changes"
fi
- run:
name: typescript-to-proptypes
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)
if [ $FOLDER_COMMIT = $LATEST_COMMIT ]; then
echo "changes, let's run the tests"
yarn workspace typescript-to-proptypes test
else
echo "no changes"
fi
- run:
name: Coverage
command: bash <(curl -s https://codecov.io/bash) -Z -C $CIRCLE_SHA1
Expand Down
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
/packages/material-ui-icons/src
/packages/material-ui-icons/legacy
/packages/material-ui-icons/templateSvgIcon.js
# Ignore fixtures
/packages/typescript-to-proptypes/test/**/*.js
/tmp
build
node_modules
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
"ts-node": "^8.3.0",
"tslint": "5.14.0",
"typescript": "^3.8.2",
"typescript-to-proptypes": "^2.0.1",
"unist-util-visit": "^2.0.2",
"vrtest-mui": "^0.3.3",
"webpack": "^4.41.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/typescript-to-proptypes/.mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
require: [require.resolve('./test/testSetup')],
};
8 changes: 0 additions & 8 deletions packages/typescript-to-proptypes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

An API for converting [TypeScript](https://www.npmjs.com/package/typescript) definitions to [PropTypes](https://www.npmjs.com/package/prop-types) using the TypeScript Compiler API

## Install

```
yarn add typescript-to-proptypes --dev
or
npm install typescript-to-proptypes --save-dev
```

## Support

| Component type | |
Expand Down
13 changes: 0 additions & 13 deletions packages/typescript-to-proptypes/jest.config.js

This file was deleted.

106 changes: 52 additions & 54 deletions packages/typescript-to-proptypes/package.json
Original file line number Diff line number Diff line change
@@ -1,56 +1,54 @@
{
"name": "typescript-to-proptypes",
"version": "2.0.1",
"description": "Generate proptypes from typescript declarations",
"main": "dist/index.js",
"engines": {
"node": ">=10.3.0"
},
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "https://github.com/merceyz/typescript-to-proptypes.git"
},
"author": "merceyz <merceyz@users.noreply.github.com>",
"license": "MIT",
"keywords": [
"proptypes",
"typescript",
"react"
],
"scripts": {
"test": "jest",
"build": "rm -rf dist && tsc",
"release": "run build && standard-version",
"prepack": "run build"
},
"devDependencies": {
"@types/babel__core": "^7.1.2",
"@types/doctrine": "^0.0.3",
"@types/glob": "^7.1.1",
"@types/jest": "^24.0.15",
"@types/lodash": "^4.14.136",
"@types/node": "^12.6.2",
"@types/prettier": "^1.19.1",
"@types/react": "^16.8.23",
"@types/uuid": "^8.0.0",
"glob": "^7.1.6",
"jest": "^26.0.1",
"react": "^16.8.6",
"standard-version": "^8.0.0",
"ts-jest": "^26.1.0"
},
"dependencies": {
"@babel/core": "^7.5.4",
"@babel/plugin-syntax-class-properties": "^7.2.0",
"@babel/plugin-syntax-jsx": "^7.2.0",
"@babel/types": "^7.5.0",
"doctrine": "^3.0.0",
"lodash": "^4.17.14",
"tslib": "^1.13.0",
"typescript": "3.5.2",
"uuid": "^8.1.0"
}
"name": "typescript-to-proptypes",
"version": "2.0.1",
"private": true,
"description": "Generate proptypes from typescript declarations",
"main": "build/index.js",
"engines": {
"node": ">=10.3.0"
},
"files": [
"build"
],
"repository": {
"type": "git",
"url": "https://github.com/mui-org/material-ui.git",
"directory": "packages/typescript-to-proptypes"
},
"author": "merceyz <merceyz@users.noreply.github.com>",
"license": "MIT",
"keywords": [
"proptypes",
"typescript",
"react"
],
"scripts": {
"build": "rimraf build && tsc",
"postinstall": "yarn build",
"test": "cd ../../ && cross-env NODE_ENV=test mocha --config packages/typescript-to-proptypes/.mocharc.js 'packages/typescript-to-proptypes/**/*.test.ts' --exclude '**/node_modules/**'"
},
"devDependencies": {
"@types/babel__core": "^7.1.2",
"@types/doctrine": "^0.0.3",
"@types/glob": "^7.1.1",
"@types/lodash": "^4.14.136",
"@types/node": "^12.6.2",
"@types/prettier": "^2.0.1",
"@types/react": "^16.8.23",
"@types/uuid": "^8.0.0",
"glob": "^7.1.6",
"prettier": "^2.0.5",
"react": "^16.8.6",
"rimraf": "^3.0.2"
},
"dependencies": {
"@babel/core": "^7.5.4",
"@babel/plugin-syntax-class-properties": "^7.2.0",
"@babel/plugin-syntax-jsx": "^7.2.0",
"@babel/types": "^7.5.0",
"doctrine": "^3.0.0",
"lodash": "^4.17.14",
"typescript": "3.5.2",
"uuid": "^8.1.0"
}
}
22 changes: 11 additions & 11 deletions packages/typescript-to-proptypes/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import path from 'path';
* @param tsConfigPath The location for a `tsconfig.json` file
*/
export function loadConfig(tsConfigPath: string) {
const { config, error } = ts.readConfigFile(tsConfigPath, (filePath) =>
fs.readFileSync(filePath).toString()
);
const { config, error } = ts.readConfigFile(tsConfigPath, (filePath) =>
fs.readFileSync(filePath).toString(),
);

if (error) throw error;
if (error) throw error;

const { options, errors } = ts.parseJsonConfigFileContent(
config,
ts.sys,
path.dirname(tsConfigPath)
);
const { options, errors } = ts.parseJsonConfigFileContent(
config,
ts.sys,
path.dirname(tsConfigPath),
);

if (errors.length > 0) throw errors[0];
if (errors.length > 0) throw errors[0];

return options;
return options;
}
Loading

0 comments on commit 66fa209

Please sign in to comment.