-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: version range handling in update_pkg function (#11716)
keep user's library version if higher than hard-defined version fixes #11693
- Loading branch information
Showing
10 changed files
with
133 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"svelte-migrate": patch | ||
--- | ||
|
||
fix: don't downgrade versions when bumping dependencies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
A CLI for migrating Svelte(Kit) codebases. | ||
|
||
Run it using | ||
|
||
``` | ||
npx svelte-migrate [migration] | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,93 @@ | ||
import { assert, test } from 'vitest'; | ||
import { update_pkg } from './utils.js'; | ||
|
||
test('Inserts package at correct position (1)', () => { | ||
const result = update_pkg( | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"z": "3", | ||
"c": "4" | ||
} | ||
}`, | ||
[['b', '2', '', 'dependencies']] | ||
); | ||
|
||
assert.equal( | ||
result, | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"b": "2", | ||
"z": "3", | ||
"c": "4" | ||
} | ||
}` | ||
); | ||
}); | ||
|
||
test('Inserts package at correct position (2)', () => { | ||
const result = update_pkg( | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"b": "2" | ||
} | ||
}`, | ||
[['c', '3', '', 'dependencies']] | ||
); | ||
|
||
assert.equal( | ||
result, | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"b": "2", | ||
"c": "3" | ||
} | ||
}` | ||
); | ||
}); | ||
|
||
test('Inserts package at correct position (3)', () => { | ||
const result = update_pkg( | ||
`{ | ||
"dependencies": { | ||
"b": "2", | ||
"c": "3" | ||
} | ||
}`, | ||
[['a', '1', '', 'dependencies']] | ||
); | ||
|
||
assert.equal( | ||
result, | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"b": "2", | ||
"c": "3" | ||
} | ||
}` | ||
); | ||
}); | ||
import { assert, test } from 'vitest'; | ||
import { update_pkg } from './utils.js'; | ||
|
||
test('Inserts package at correct position (1)', () => { | ||
const result = update_pkg( | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"z": "3", | ||
"c": "4" | ||
} | ||
}`, | ||
[['b', '2', '', 'dependencies']] | ||
); | ||
|
||
assert.equal( | ||
result, | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"b": "2", | ||
"z": "3", | ||
"c": "4" | ||
} | ||
}` | ||
); | ||
}); | ||
|
||
test('Inserts package at correct position (2)', () => { | ||
const result = update_pkg( | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"b": "2" | ||
} | ||
}`, | ||
[['c', '3', '', 'dependencies']] | ||
); | ||
|
||
assert.equal( | ||
result, | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"b": "2", | ||
"c": "3" | ||
} | ||
}` | ||
); | ||
}); | ||
|
||
test('Inserts package at correct position (3)', () => { | ||
const result = update_pkg( | ||
`{ | ||
"dependencies": { | ||
"b": "2", | ||
"c": "3" | ||
} | ||
}`, | ||
[['a', '1', '', 'dependencies']] | ||
); | ||
|
||
assert.equal( | ||
result, | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"b": "2", | ||
"c": "3" | ||
} | ||
}` | ||
); | ||
}); | ||
|
||
test('Does not downgrade versions', () => { | ||
const result = update_pkg( | ||
`{ | ||
"devDependencies": { | ||
"@sveltejs/kit": "^2.4.3" | ||
} | ||
}`, | ||
[['@sveltejs/kit', '^2.0.0']] | ||
); | ||
|
||
assert.equal( | ||
result, | ||
`{ | ||
"devDependencies": { | ||
"@sveltejs/kit": "^2.4.3" | ||
} | ||
}` | ||
); | ||
}); |