Skip to content

Commit

Permalink
fix: make sure --save-exact is converted correctly
Browse files Browse the repository at this point in the history
Fixes armano2#7 

Funny how these things go. I reported the issue then I started fixing a similar issue for npm to pnpm for sapphiredev/documentation-plugins#80 and turns out this fix also works for npm to yarn

Example regexr: regexr.com/6phbp
  • Loading branch information
favna committed Jul 11, 2022
1 parent 7a09f7b commit 2cddbdd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/npmToYarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const npmToYarnTable = {
let ret = command
.replace('install', 'add')
.replace('--save-dev', '--dev')
.replace(/\s*--save/, '')
.replace(/\s*--save(?!-)/, '')
.replace('--no-package-lock', '--no-lockfile')
.replace('--save-optional', '--optional')
.replace('--save-exact', '--exact')
Expand All @@ -22,7 +22,7 @@ const npmToYarnTable = {
let ret = command
.replace('uninstall', 'remove')
.replace('--save-dev', '--dev')
.replace(/\s*--save/, '')
.replace(/\s*--save(?!-)/, '')
.replace('--no-package-lock', '--no-lockfile')
if (/ -(?:-global|g)(?![^\b])/.test(ret)) {
ret = ret.replace(/ -(?:-global|g)(?![^\b])/, '')
Expand Down

0 comments on commit 2cddbdd

Please sign in to comment.