mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-19 14:20:36 -04:00
fix: should work when only current shrinkwrap.yaml is available
This commit is contained in:
@@ -94,6 +94,7 @@ async function _outdated (
|
||||
},
|
||||
): Promise<OutdatedPackage[]> {
|
||||
const wantedShrinkwrap = await readWantedShrinkwrap(pkgPath, {ignoreIncompatible: false})
|
||||
|| await readCurrentShrinkwrap(pkgPath, {ignoreIncompatible: false})
|
||||
if (!wantedShrinkwrap) {
|
||||
throw new Error('No shrinkwrapfile in this directory. Run `pnpm install` to generate one.')
|
||||
}
|
||||
|
||||
1
test/fixtures/current-shrinkwrap-only/.gitignore
vendored
Normal file
1
test/fixtures/current-shrinkwrap-only/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!node_modules
|
||||
27
test/fixtures/current-shrinkwrap-only/node_modules/.shrinkwrap.yaml
generated
vendored
Normal file
27
test/fixtures/current-shrinkwrap-only/node_modules/.shrinkwrap.yaml
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
dependencies:
|
||||
is-negative: 1.1.0
|
||||
is-positive: 3.1.0
|
||||
from-github: github.com/blabla/from-github/d5f8d5500f7faf593d32e134c1b0043ff69151b3
|
||||
from-github-2: github.com/blabla/from-github-2/d5f8d5500f7faf593d32e134c1b0043ff69151b3
|
||||
packages:
|
||||
/is-negative/1.1.0:
|
||||
resolution:
|
||||
integrity: sha1-8Nhjd6oVpkw0lh84rCqb4rQKEYc=
|
||||
/is-positive/3.1.0:
|
||||
resolution:
|
||||
integrity: sha1-hX21hKG6XRyymAUn/DtsQ103sP0=
|
||||
github.com/blabla/from-github/d5f8d5500f7faf593d32e134c1b0043ff69151b3:
|
||||
name: from-github
|
||||
version: 1.0.0
|
||||
resolution:
|
||||
tarball: 'https://codeload.github.com/blabla/from-github/tar.gz/d5f8d5500f7faf593d32e134c1b0043ff69151b3'
|
||||
github.com/blabla/from-github-2/d5f8d5500f7faf593d32e134c1b0043ff69151b3:
|
||||
name: from-github-2
|
||||
version: 1.0.0
|
||||
resolution:
|
||||
tarball: 'https://codeload.github.com/blabla/from-github-2/tar.gz/d5f8d5500f7faf593d32e134c1b0043ff69151b3'
|
||||
registry: 'https://registry.npmjs.org/'
|
||||
shrinkwrapVersion: 3
|
||||
specifiers:
|
||||
is-negative: ^2.1.0
|
||||
is-positive: ^3.1.0
|
||||
8
test/fixtures/current-shrinkwrap-only/package.json
vendored
Normal file
8
test/fixtures/current-shrinkwrap-only/package.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "wanted-shrinkwrap",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"is-negative": "^2.1.0",
|
||||
"is-positive": "^3.1.0"
|
||||
}
|
||||
}
|
||||
@@ -75,3 +75,16 @@ test('forPackages()', async (t) => {
|
||||
])
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('outdated() when only current shrinkwrap is present', async (t) => {
|
||||
const outdatedPkgs = await outdated('current-shrinkwrap-only', outdatedOpts)
|
||||
t.deepEqual(outdatedPkgs, [
|
||||
{
|
||||
current: '1.1.0',
|
||||
latest: '2.1.0',
|
||||
packageName: 'is-negative',
|
||||
wanted: '1.1.0',
|
||||
},
|
||||
])
|
||||
t.end()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user