-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Attach commit as package.json#gitHead
in prerelease versions
#47932
Conversation
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Don't know if it's still the same way, but:
|
@DanielRosenwasser I have no opinion on the change itself, but this would be a breaking change for the pipeline that syncs versions across to the ADO repo, so we'll have to make a corresponding change. Let's just make sure that's handled before we merge. |
Note - I don't mind using some other solution for this, I only care about the commit being available somewhere in the published artifact. It made sense for me to include it here as it is some well-defined sport where such a thing can be put, any other place I would have to "figure out" by myself/pick at random and I didn't know what would be the preference of the team. In a sense, this PR is more of a conversation starter than something that has to land ASAP. |
I think that my main concern is that if the commit metadata lands in the package version, it becomes harder (maybe not easily possible?) to get a version of TypeScript on a specific date, which is often how we offhandedly bisect. For example, I'll try installing |
That's actually not true - this build metadata is completely ignored when it comes to matching semver ranges etc. You could install this just fine. |
Could you elaborate? If I try installing a partial date suffix, it will fail.
If I give a full published version (e.g. |
@DanielRosenwasser The build metadata is not part of the actual version number. It makes no difference whether you install
|
Yea, and actually - that build metadata is completely ignored when installing. This particular package and version doesn't have any build metadata and it gets installed successfully:
We can also test a package (
This one installs just fine as well. |
I agree with all the build metadata / semver discussion, but it might just be simpler to put this on a new field in the package json |
What do you think about |
…sion # Conflicts: # scripts/configurePrerelease.mjs
package.json#gitHead
in prerelease versions
switched this one to use |
Many thanks! |
Okay, what? How did this pass CI?
We test this in CI so I don't know how this happened... |
This property displays as |
Right, but it's only |
Note that I dont see an error at this location in the IDE |
:warn: I didn't do any extensive testing - this PR should be verified by somebody who actually understands how this script is used and how this might affect other things.
Why?
I've recognized a regression between nightly builds of TS (well, when you were releasing nightlies for 3.8). I have the exact version in which the valid error has stopped being reported by TS but I cannot easily check from which commit this build was prepared. This helps with that.
Note that I don't care where this commit would be written - it could be in a root
.json
, in the README, or somewhere else. It's just that per semver spec attaching such metadata in the version is allowed and this shouldn't affect any semver-aware algorithms for matching versions, dependency ranges etc. This is described here: https://semver.org/#spec-item-10While this is a very little-known "feature", I've seen this being used "in the wild".