question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should `version` command have `--since` flag?

See original GitHub issue

Affected Packages

version/cli?

Problem

As part of the work we do at The Guild in our repos, we are using snapshot releases for releasing canary versions for PRs.

To do that, we are using version --snapshot alpha and then publish --tag alpha. This works perfectly fine.

When Changesets begin to stack in the target/main branch (master/main), we are seeing a kinda annoying behavior in PRs. The version command includes changesets files that are coming from master, instead of using only the changes relevant to the specific PR.

This causes inconsistent results with our custom GitHub Action (that runs version as described above). We can see that the Changesets bot detects only the relevant packages:

image

While our bot/action (that gets the output of version+publish) has published more packages (because we are those changesets in master):

image

Proposed solution

Similar to status command, we can provide --since flag to version flag, and point to the target branch in a PR. This way, the version command will make sure to include only changesets files that were added in that specific PR (similar to what changesets-bot is doing in the PR comments)

@Andarist @mitchellhamilton @jakubmazanec what do you think? I can open a PR if that makes sense.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Andaristcommented, Aug 14, 2022

Isn’t that should be a by-product of the changeset of a specific PR, instead of all changesets available in the branch?

Yes. I just mean that we can’t only release stuff from the changesets specific to a PR because those might always implicitly pull dependants into the release and that we should have tests etc verifying that this actually happens. Those dependant packages could have more changesets for them (ones unrelated to the PR in question) or they could have no changesets at all - in both scenarios they should be released though.

Actually, even dependencies should be pulled into the release too - but those could be filtered by having some changesets or not.

1reaction
Andaristcommented, Aug 4, 2022

Similar to status command, we can provide --since flag to version flag, and point to the target branch in a PR. This way, the version command will make sure to include only changesets files that were added in that specific PR (similar to what changesets-bot is doing in the PR comments)

We’d have to ensure to still version all dependant packages of all the packages with changesets included in the given PR. Otherwise, you wouldn’t be quite able to test those with the newly released snapshot dependencies.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to not treat the version flag function as a command #372
I need to have the main() function as that's the entry point to my program for poetry.
Read more >
How can the `-V` flag be both `--verbose` and `--version`?
The docs for mkfs say that -V is the short flag for both version and verbose. I'm having trouble understanding how this is...
Read more >
When to Use Long (Word) or Short (Letter) Command Line ...
I prefer using the long version in scripts because it acts as a form of documentation, it's much more descriptive. Likewise if I'm...
Read more >
SRFI 176: Version flag
There is a long tradition of complex command line programs having a version flag. This flag skips the normal operation of the program;...
Read more >
Using ldflags to Set Version Information for Go Applications
In this command, main is the package path of the Version variable, since this variable is in the main.go file. Version is the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found