Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor utils #388

Merged
merged 1 commit into from
Aug 13, 2016
Merged

Refactor utils #388

merged 1 commit into from
Aug 13, 2016

Conversation

levithomason
Copy link
Member

@levithomason levithomason commented Aug 12, 2016

This PR was begun to fix circular reference issues utils. propUtils imported Icon/Image for the prop renderers, however, Icon/Image also imported some propUtils. This PR resolves circular references and splits utils into 2 categories and refactors all components.

src/lib

Project specific modules that have dependencies on vendors and utils. This is our standard library.

  • AutoControlledComponent
  • childrenUtils
  • classNameBuilders
  • customPropTypes
  • debug
  • deprecate
  • getUnhandledProps
  • index (exports everything in a friendly format)
  • jquery
  • keyboardKey
  • META
  • numberToWord
  • objectDiff
  • SUI

src/factories

These were previously propRenderers. Since they didn't actually render anything, but return JSX elements, they are actually factories. They vary from React.createFactory in that they accept a wider variety of input to create an element.

We now have a generic createFactory function. It returns a factory function capable of creating elements from any value except undefined, including a ReactElement. It accepts extra props and merges the className prop by default. This makes them ideal our prop handling case.

  • createFactory
  • index ( createIcon(), createImage() )

Index Files

Index files were also added to all src/* directories. This greatly simplifies imports throughout the project.


During this entire process some additional housekeeping was done.

@codecov-io
Copy link

codecov-io commented Aug 12, 2016

Current coverage is 93.75% (diff: 95.83%)

Merging #388 into master will decrease coverage by 0.01%

@@             master       #388   diff @@
==========================================
  Files            73         73          
  Lines           946        944     -2   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits            887        885     -2   
  Misses           59         59          
  Partials          0          0          

Powered by Codecov. Last update 63aa837...a730f7d

@levithomason levithomason force-pushed the refactor/utils branch 8 times, most recently from 5874922 to ea9cea7 Compare August 12, 2016 23:49
@@ -18,7 +18,7 @@ CONTRIBUTING
- [API](#api)
- [SUI HTML Classes](#sui-html-classes)
- [API Patterns](#api-patterns)
- [Prop Utils](#prop-utils)
- [Utilities](#utilities)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated scripts to update TOC on every build.

<a
href='https://github.com/TechnologyAdvice/stardust/blob/master/CONTRIBUTING.md'
> contribute</a>!
</Message.Content>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example of housekeeping, the previous usage of Message here threw warnings as we do not support it any longer.

@@ -10,4 +10,4 @@ requireDir('./gulp/tasks')
// do not use tasks/default
// the default task must be loaded after all other tasks
// requireDir above loads all our tasks in alphabetical order
gulp.task('default', gulp.series('generate-docs-json', 'serve', 'watch'))
gulp.task('default', gulp.series('docs', 'serve', 'watch'))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Housekeeping: build docs completely on npm start. This cleans/rebuild the doc dist including images.

@levithomason levithomason merged commit 20e9871 into master Aug 13, 2016
@levithomason levithomason deleted the refactor/utils branch August 13, 2016 00:25
This was referenced Aug 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants