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

Changes in 13.5.3 break ability for plugins to provide custom changelog prior to version selection #647

Closed
rwjblue opened this issue Apr 20, 2020 · 5 comments

Comments

@rwjblue
Copy link
Contributor

rwjblue commented Apr 20, 2020

Prior to the changes in 6d6f59b a plugin could this.setContext({ changelog: 'foo' }) and have that changelog be used for the initial prompting of next version. This does not seem to be possible any longer as of 13.5.3+.

6d6f59b refactors the way that the initial changelog is retrieved, from:

const changelog = await reduceUntil(plugins, plugin => plugin.getContext('changelog'));

And now in 13.5.3+ it is always retrieved from the global context:

const { changelog } = config.getContext();

As a result this has broken a feature that I added to release-it-lerna-changelog in release-it-plugins/lerna-changelog#12.

Suggestions on a path forward?

@rwjblue rwjblue changed the title Changes in 13.5.3 break ability for plugins to provide custom changelog Changes in 13.5.3 break ability for plugins to provide custom changelog prior to version selection Apr 20, 2020
@rwjblue
Copy link
Contributor Author

rwjblue commented Apr 20, 2020

Note: I've worked around the issue in release-it-plugins/lerna-changelog#38, but this basically feels like a race condition scenario to me and I'd love to come up with a better solution.

@webpro
Copy link
Collaborator

webpro commented Apr 21, 2020

Oh no, my apologies. I've always wanted to have better tests for plugins. I totally agree it's brittle right now, and this clearly shows it. I'll think about a more robust test suite wrt plugins here.

For now, how about this:

const name = await reduceUntil(plugins, plugin => plugin.getName());
const latestVersion = await reduceUntil(plugins, plugin => plugin.getLatestVersion());
const changelog = await reduceUntil(plugins, plugin => plugin.getChangelog());
...
config.setContext({ name, latestVersion, version, changelog });

Userland plugins come first, so all plugins will use the changelog from the plugin.

I made a release you can install using release-it@changelog, please let me know how this works for you and I'll release it.

@rwjblue
Copy link
Contributor Author

rwjblue commented Apr 21, 2020

Ya, I like the getChangelog hook. That makes sense, and definitely works better than what I did in release-it-plugins/lerna-changelog#38 (which relies on effectively unrelated semantic timing of getLatestVersion running just before the changelog is retrieved from the global config).

@webpro
Copy link
Collaborator

webpro commented Apr 22, 2020

Not sure what happened, yesterday I released v13.5.5 with this change, but my comment here got lost. But here it is, so I'm going to close this issue. Let me know if you encounter any issues.

@webpro webpro closed this as completed Apr 22, 2020
@rwjblue
Copy link
Contributor Author

rwjblue commented Apr 22, 2020

Thank you very much @webpro!

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

2 participants