Skip to content

Add prefix case for incrementFileName - #50003

Merged
Isidor Nikolic (isidorn) merged 4 commits into
microsoft:masterfrom
Krzysztof-Cieslak:prefixFileNameIncremenr
May 17, 2018
Merged

Isidor Nikolic (isidorn) merged 4 commits into
microsoft:masterfrom
Krzysztof-Cieslak:prefixFileNameIncremenr

Conversation

@Krzysztof-Cieslak

Copy link
Copy Markdown
Contributor

@Krzysztof-Cieslak

Copy link
Copy Markdown
Contributor Author

While this is naive way to add new case there are couple of problems with incrementFileName in general:

  1. It's always using . as separator of version prefix/suffix, it would be good to support also other separators (like -, app-1.js should be incremented to app-2.js)
  2. Since it's just parsing version string to int we lose leading zeros (right now app.0001.js is incremented to app.2.js which is probably wrong behavior.)

@isidorn

Copy link
Copy Markdown

Krzysztof Cieślak (@Krzysztof-Cieslak) thanks a lot for your PR.
I would be happy merging this in if we add some unit tests - they would increase my confidence and would use as a documentation how this beahves. Could you export function incrementFileNameand add a fileActions.test.ts and test out that method.

@Krzysztof-Cieslak

Copy link
Copy Markdown
Contributor Author

Isidor Nikolic (@isidorn), I've added couple of tests. Should I also tackle those 2 problems I've mentioned in an earlier message?

@isidorn

Copy link
Copy Markdown

Krzysztof Cieślak (@Krzysztof-Cieslak) yeah that would be great! Adding tests for those cases would also be awesome! Thanks

@Krzysztof-Cieslak

Copy link
Copy Markdown
Contributor Author

This is ready for review.

@isidorn

Copy link
Copy Markdown

Krzysztof Cieślak (@Krzysztof-Cieslak) thanks a lot! I love the tests, they give me confidence looking at all these regexes.
Merging in, thanks again!

@isidorn
Isidor Nikolic (isidorn) merged commit 19bf185 into microsoft:master May 17, 2018
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to increment prefix when duplicating file/folder

2 participants