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

[Question] vsce prepublish before version bump ? #834

Closed
wenytang-ms opened this issue Feb 16, 2023 · 6 comments
Closed

[Question] vsce prepublish before version bump ? #834

wenytang-ms opened this issue Feb 16, 2023 · 6 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@wenytang-ms
Copy link

wenytang-ms commented Feb 16, 2023

Hi team, you build a nice tool for VS Code.
But I get some confusion in the process of using it recently.

vsce package 2.0.1 will get a VSIX with version 2.0.1, although it is possible that the version number in package.json was 2.0.0.
The vscode-vsce help to do versionBump after prepublish which executes "vscode:prepublish" script.

Take our project as an example, the package.json file is referenced in the source code, we need to get the package's name, version to collect BI data. so the package will run prepublish to build or compile the source code, so the version of package.json which is 2.0.0 will be hardcoded.
Then vsce will leverage the compiled result to generate visx.
Finally, the verison of visx is 2.0.1, however, the code gets the version number 2.0.0 at runtime.

So I would like to know what is your consideration for this design.
Is there any solution to resolve my problem?

@wenytang-ms
Copy link
Author

wenytang-ms commented Feb 17, 2023

I have also find your commit history, the original design is do versionBump before prepublish, but changed at this commit
The Code change because of this issue
But are there other solutions to resolve this issue?For example, adding backup logic?

@joaomoreno
Copy link
Member

Maybe we need a new lifecycle script?

  1. Pre-publish
  2. Version bump
  3. ??? <- here
  4. Publish

Would this help?

@joaomoreno joaomoreno self-assigned this Feb 21, 2023
@joaomoreno joaomoreno added the info-needed Issue requires more information from poster label Feb 21, 2023
@wenytang-ms
Copy link
Author

wenytang-ms commented Feb 22, 2023

What about add the backup logic?
Just like Lerna, Lerna will backup package.json to package.json.lerna_backup while running lerna bootstrap ?
Once there has any error, then restore the backup file. otherwise just delete it.

@joaomoreno
Copy link
Member

The problem with the backup solution is that npm version might also create a commit and might also create a tag. We'd need to revert those things as well, this isn't trivial.

@wenytang-ms
Copy link
Author

Well, it's really tricky.
But I insist that the version numbers need to be aligned during the two stages.
Maybe you guys need to think about it, I can only handle it with some workaround at the moment.

@joaomoreno
Copy link
Member

Given you have a functional workaround at the moment, we'll close this request for now. Thanks!

@joaomoreno joaomoreno closed this as not planned Won't fix, can't repro, duplicate, stale Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants