Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Sometimes components are in a mixed order #539

Closed
simonsmith opened this issue Apr 11, 2014 · 7 comments
Closed

Sometimes components are in a mixed order #539

simonsmith opened this issue Apr 11, 2014 · 7 comments

Comments

@simonsmith
Copy link

I'm seeing some odd behaviour when using component inside node. I'm working on a Grunt plugin that uses Component to build SuitCSS components.

I'm using component-resolver, component-build and component-flatten to handle everything.

To validate my plugin works I built SuitCSS using component on the CLI and then compare that output with the output my plugin produces. What is odd is that it fails intermittently.

  • If the components aren't installed then it will always fail after installation of them. By fail I mean the output file is in a different order to the expected.
  • If the components are already installed it of course does not request them again and 9 times out of 10 it passes but every so often it will randomly fail with the components not matching the right order.

All this is happening in this function here. Would it be possible to clarify if I'm using the APIs correctly and perhaps help me understand why this doesn't reliably work?

Thanks so much

@jonathanong
Copy link
Contributor

what do the errors look like? can you show some debug logs? https://github.com/component/guide/blob/master/component/troubleshooting.md

i have an issue in the resolver where sometimes things will be out of order, but it only happens 1/100 times. not sure what's going on.

@simonsmith
Copy link
Author

Logs here - https://gist.github.com/simonsmith/10501679 Showing the difference when I have no components installed vs when they are already installed.

I don't get an error as such just that sometimes the file is built out of order and my unit tests fail. So far it happens every time when the components have to be installed. After they have been installed the tests pass 90% of the time.

Edit: I should probably do a similar test with the component CLI, just to clarify if it's my code.

@simonsmith
Copy link
Author

@jonathanong I set up a similar test but instead used the component CLI. Running this command passed the test every time regardless of installing components or them being there already.

Could I be using the libraries incorrectly? I've tried to follow the docs as closely as possible.

@jonathanong
Copy link
Contributor

not sure. i didn't see anything blatantly wrong with your code.

@simonsmith
Copy link
Author

Hmm okay. I'll go back to stepping through the code and see if I can spot anything obvious. Thanks for casting your eyes over it :)

@clintwood
Copy link
Contributor

@jonathanong, I'm wondering if this is not because of this issue componentjs/builder2.js#29. I know the issue was raised for CSS but the root cause is possibly generator related?

@simonsmith, I'm wondering if the command line version on your platform eliminates using generators (node --harmony-generators) and therefore uses the non-generator code path... whereas your API version maybe uses a generator based code path? If so it make the above issue more likely the cause...

@timaschew
Copy link
Member

close due to componentjs/builder2.js#29 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants