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

Options listed after and outside a condition are not showing #67

Open
ghost opened this issue Jul 22, 2020 · 4 comments
Open

Options listed after and outside a condition are not showing #67

ghost opened this issue Jul 22, 2020 · 4 comments

Comments

@ghost
Copy link

ghost commented Jul 22, 2020

According to the documentation found here https://yarnspinner.dev/docs/tutorial#options, an option outside of and after any conditions should be included in the available options for a node. The current bondage.js behavior is that as soon as a conditional option is parsed, other non-conditional options from the node are not added to the available options.
That isn't to say that there are not other issues related to conditions and/or options that may be at the root of the problem, but this describes the behavior I am seeing for my case.
I believe that this is an issue with the runner and so I will add a runner test to my fork that isolates the problem.

@blurymind
Copy link
Collaborator

can you do a pr for this one too please? :)
Giving us more parity with yarnSpinner is highly welcome!

@ghost
Copy link
Author

ghost commented Jul 22, 2020

According to the docs (https://yarnspinner.dev/docs/writing/controlling/#options):

Options are usually at the end of the node, but they don’t have to be. For example, the options in the example above could have been placed anywhere in the code. This is because options are only displayed when the end of a node is reached.

I have written some tests that helped me get further in determining exactly what is going wrong. Currently, if the line after the first option is not another option, then none of the remaining lines are returned. It's as if it were treating the first option as a shortcut. All available options, excluding those within a shortcut, should be collected and returned only when the end of the node is reached.

@ghost
Copy link
Author

ghost commented Jul 23, 2020

My fork now has the runner handling options correctly. The problem was that options within a conditional (of the same nest level of a node) were being yielded instead of accumulated for the end of that node and nest level. "Nest level" refers to nested or hierarchical lines indented beneath a shortcut. My new tests for this are passing. I don't know the protocol for submitting multiple PRs with cumulative changes, so I will have to learn that before I submit this PR.

@ghost
Copy link
Author

ghost commented Jul 30, 2020

I've submitted PR #69 that resolves this issue.

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

No branches or pull requests

1 participant