I have publish a couple extensions and published updates to them. I'm still a little bit confused on the process involved and the steps I should be taking and in what order.
Typically when I am committing a change to a JavaScript project on GitHub, this is my process:
version in the package.json to a new version (lets say 0.10.2 as example)v0.10.2So now I've updated my project, updated the version and pushed those changes and tagged them all up on GitHub.
But now, if it's a VSCode extension, I also need to publish those changes to the VS Marketplace. So I use vsce publish patch (or major or minor) and tada I have published my change! But wait, vsce automatically (unnecessarily) incremented my version to v0.10.3 now... Okay so now I have to commit that change and publish a new tag to my GitHub repo.
So what is the process here. Should I always publish before committing? And then let vsce increment my version for me? And then commit after? What happens if I don't commit those changes? Does VSCode install extensions from an extensions project repository on Github or does it save the published version to some sort of Microsoft-controlled server somewhere? If it's the former, and I publish a new version but don't commit to Github what will happen when someone tries to install that new version of my extension? Will they get the new un-committed version or the old version that is still sitting on GitHub?
Overall, the process is just a little bit confusing. I think vsce automatically incrementing your version for you is helpful but can easily trip someone up. It has tripped me up multiple times already.
So what is the process supposed to be exactly? What is the "proper" way to make changes to an extension, commit and publish those changes and maintaining proper semver the whole time?
But wait, vsce automatically (unnecessarily) incremented my version to v0.10.3 now...
That happened because you added patch to the vsce publish command.
Just run vsce publish.
But you can't publish without specifying either a new version OR using major,minor,patch:
Error: [email protected] already exists. Version number cannot be the same.
It is possible to publish without forcing an incrementation on your version? I think this all comes down to needing a bit more specificity in the documentation.
Here's what I do:
vsce publishYou can publish without specifying either a new version OR using major, minor or patch. You just can't republish a version. But if you run vsce publish after manually updating the version in package.json like in your step 2, that won't be a problem.
Oh! So vsce publish will publish a new version as long as your package.json version is not matching what is already published but it won't change your version automatically. Okay this is making much more sense now. Thanks,
Most helpful comment
That happened because you added
patchto thevsce publishcommand.Just run
vsce publish.