Skip to content

Commit

Permalink
Add default usage to README
Browse files Browse the repository at this point in the history
  • Loading branch information
josephrexme committed Apr 17, 2021
1 parent 71484b3 commit 9b66eb4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ typed(MyComponent, {
},
fruitCount: {
type: typed.number,
default: 0,
description: 'The number of fruit eaten'
},
fruit: {
type: typed.oneOf(['bananas', 'mangoes']),
default: 'bananas',
description: 'The number of fruit eaten'
},
})
Expand All @@ -54,15 +56,31 @@ console.log(MyComponent.types)
},
fruitCount: {
type: 'number',
default: 0,
description: 'The number of fruit eaten'
},
fruit: {
type: { name: 'oneOf', params: ['bananas', 'mangoes'] },
default: 'bananas',
description: 'The number of fruit eaten'
},
}
*/
```
and your installed version of [prop-types][1] is applied

```js
MyComponent.propTypes = {
name: PropTypes.string.isRequired,
fruitCount: PropTypes.number,
fruit: PropTypes.oneOf(['bananas', 'mangoes'])
}

MyComponent.defaultProps = {
fruitCount: 0,
fruit: 'bananas'
}
```

### WHY?
PropTypes is great for regular use but when building components that need to be documented, it
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "typable-react",
"version": "0.0.3",
"description": "React.js prop-types wrapper for easy extraction",
"version": "0.0.4",
"description": "React.js prop-types wrapper for easy extraction to documentation",
"main": "typable.js",
"scripts": {
"test": "jest"
Expand All @@ -13,7 +13,10 @@
"keywords": [
"static",
"typed",
"prop-types"
"prop-types",
"react",
"extract",
"documentation"
],
"author": "Joseph Rex",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Usage:
# publish 1.2 "my publish message"

npm run build
# npm run build
sed -i "" "3s/: .*/: \"$1\",/" package.json
git add .
git commit -m "$2"
git tag -a "v$1" -m "$2"
git push origin --tags
git push origin main
npm publish
# npm publish

0 comments on commit 9b66eb4

Please sign in to comment.