Contributing Guide - yarn proptypes
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
It is easy to fail circleci test_static.
I manually added jsdoc comments to proptypes in component js file to match the .d.ts. I was unaware that yarn proptypes is run as part of ci. Any slight difference between the generated and that of the pull request will result in failure.
I think it should be made clear in Contributing.md that if you change the typescript definition file then yarn proptypes will generate the proptypes in the js and will include the doc comments. ( There is a warning that is generated and written to the js )
Note that even running yarn proptypes can still result in the ci error.
When run on circleci - .circleci/config.yml - disable-cache
test_static:
<<: *defaults
steps:
- checkout
- install_js
- run:
name: Check if yarn prettier was run
command: yarn prettier check-changed
- run:
name: Generate PropTypes
command: yarn proptypes --disable-cache
If you change the proptypes in js and yarn proptypes locally disable-cache is false.
generateProptypes.ts
return command
.option('disable-cache', {
default: false,//***************
describe: 'Considers all files on every run',
type: 'boolean',
})
if (!ignoreCache && (await fse.stat(jsFile)).mtimeMs > (await fse.stat(tsFile)).mtimeMs) {
// Javascript version is newer, skip file
return GenerateResult.Skipped;
}
I suggest then that instead of
If props were added or prop types were changed, the TypeScript declarations were updated.
It should be stated that if props are to change then change the TypeScript declaration and then yarn proptypes. Also mention that yarn proptypes will copy across JsDoc comments.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
Top GitHub Comments
Honestly I would just remove the cache. This runs pretty fast as far as I remember. Caching is inherently complex and should have a big improvement. Going from e.g. 10s to 5s is not that.
I think it’s ok @oliviertassinari