Syntax Video
What is Semantic Versioning? (semver)
Transcript
this next question comes from Spike and the question is what is Sim ver anyways which is short for semantic version versioning and uh they uh they had a really long story I'm going to summarize and honestly the story might even be good for like one of the the spooky Halloween episodes because it's about uh upgrading when they shouldn't have but the tldr is they wanted to use jQuery version 3 features so they just upgraded without realizing that some Downstream site was actually dependent on jQuery V2 clients got mad they started reaching out why is everything broke and then they just downgraded back to to V2 so I'll dive in really quick just to talk about what SIM is if you want to learn more sim.org has a great explanation of of what this is but you've probably seen it before so if you're installing a package from mpm it's always going to have a three DOT number so that's the major number do the minor number do the patch number the current version of react is
18.2.1 is the major version two is the minor version and zero is the patch number and if a project is following semantic versioning like the react library is that major number that 18 if that ever goes up that means there are breaking changes so that's why we see the jump from like 16 to 17 to 18 react has introduced backwards incompatible changes and they're letting you know via the the version number the major version number the minor version number is for added functionality so like new features that don't break things so the next version here if react adds new features would be 18.3 and then that last number is for patches and Bug fixes so if there's maybe not a new feature but they fixed a bug they would bump that to 18.2.1 and there's other stuff to learn about this like pre-release and like Alpha and and different things like that but when you see a version number like that it's very likely that the project is using semantic versioning you should note though that any version number Bel below
version one there are no guarantees so you can expect breaking changes at any time and I have experience with that more recently with OJs so that's the project from the next o team to make an O library that will work with a lot of different back-end libraries not just nextjs and it's still experimental um and they clearly label that on their website so they are version 0.280 so they're not even version one yet but each each new feature a lot of times actually is a breaking change and next time it'll be like 0.3 or 0.4 so you can't always guarantee that they're they're following semantic versioning but you definitely like look at their the look at the library and and see what they say in their docs and then another interesting one is typescript so typescript actually doesn't follow semantic versioning at all yeah yeah at all yeah and they they have a I'll link in the show notes there's an article that describes what exactly they do I'll give you the short version here so a new minor version is released every three months with new features and then a new
major version is released if the minor version would have exceeded nine so if they if if they're going from 4.9 to if to 4.10 they actually just bump the whole version to five so they're they're actually you'll find that in typescript a lot of times you can upgrade from four to five and there actually aren't breaking changes and that's because they're not actually following semantic versioning yeah well it's it's I've really like that explanation about everything what's funny is that I've always said and I could not tell you why this is I've always said semar and and like now that you saying SE saying it like that I'm like obviously it's S I don't know why I would have ever said svar in the first place I pronounce a lot of things wrong so maybe I don't know no it's semantic versioning sver that makes so much more sense than svar I have no idea why I possibly would I now I'm feeling embarrassed because I know I've said that on the podcast a whole bunch um in a general rule too if
you're updating packages typically you can update a patch version but always test your code make sure it works I pretty much always YOLO update patch versions for stuff and then just make sure everything's working afterwards I'll I'll update you know 10 or so different it's a bad practice but I'll update like 10 or so different packages to their patch versions at once typically because it doesn't break anything but you know yeah you never can be sure you always got to test it yeah and it was really hard for us too when we announced that syntax was getting acquired by centry I think rightfully people were concerned they were very concerned that this was going to be another CSS tricks which obviously it hasn't been but I think Sentry was cognizant of that they were like we need to make sure that we are assuring people that this is not that we
Quote it with credit and a link. Quoting Syntax