vscode-text-power-tools
vscode-text-power-tools copied to clipboard
[Feature] remove ^ before package version
This seems kind of trivial to do with either search and replace:
": "^
➝ ": "
(Regex flag off)
": "\^
➝ ": "
(Regex flag on)
(?<=^\s+"[^"]+": ")\^(?=\d+(\.\d+){0,2}",?$)
➝
(Replace with empty string) (Regex flag on, safer but probably unnecessarily so if it's already under version control and you skim the diff before committing. Disclaimer, just threw this together, only lightly tested)
Or multiple cursors.
But maybe you'd like a command that you can trigger on a given line to remove that particular caret?
@mrienstra
😄
Not that I'm not able to do it (after all you can do it pretty easily with basic VS Code editing tools or using some of Text Power Tools own commands), but I'm not 100% sure that that this is the right thing to do. After all there is a lock file for a reason in the repository.
My use case is in some package, there some dep is prefix with ^, other are not. So I want to remove all or add all. As for lock file, people who using this command must will pnpm install after call it.
Then I will add ^
to the two packages which do not have it (prettier
in devDependencies and html-entities
in dependencies). Cannot add it to faker though as I use a special fork of it.
Then I will add
^
to the two packages which do not have it
@qcz, I think there has been a misunderstanding. I believe @tjx666 was proposing a new user-facing feature, which would make it easy to add or remove ^
from all semver ranges in a given file. Though I may be mistaken.
@mrienstra @qcz you are right. My meaning is not to modify the extension project lock file. I just want this extension provide a new command to remove/add all ^
in package.json