This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support update options in global package space
This adjusts the portion of the global actualTree that gets loaded when doing an update, and sets up the virtual global package manifest to depend on '*' for all the packages being updated at the top global level. Fixes: npm/cli#1962
- Loading branch information
Showing
4 changed files
with
265 additions
and
10 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
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 |
---|---|---|
|
@@ -2154,7 +2154,7 @@ t.test('always prefer deduping peer deps', async t => { | |
'package.json': JSON.stringify({ | ||
dependencies: { | ||
'@pmmmwh/react-refresh-webpack-plugin': '0.4.2', | ||
'ink': '3.0.8', | ||
ink: '3.0.8', | ||
'react-reconciler': '0.25.0', | ||
}, | ||
}), | ||
|
@@ -2170,7 +2170,7 @@ t.test('do not ever nest peer deps underneath their dependent ever', async t => | |
const path = t.testdir({ | ||
'package.json': JSON.stringify({ | ||
dependencies: { | ||
'ink': '3.0.8', | ||
ink: '3.0.8', | ||
// this peer depends on react 17 | ||
'react-reconciler': '0.26.0', | ||
}, | ||
|
@@ -2212,3 +2212,66 @@ t.test('properly assign fsParent when paths have .. in them', async t => { | |
t.equal(tree.inventory.has(target.fsParent), true, 'other targets have fsParent') | ||
} | ||
}) | ||
|
||
t.test('update global', async t => { | ||
// global root | ||
// ├─┬ @isaacs/[email protected] | ||
// │ ├── [email protected] | ||
// │ └── [email protected] | ||
// └─┬ [email protected] | ||
// └── [email protected] | ||
|
||
const path = t.testdir({ | ||
node_modules: { | ||
'@isaacs': { | ||
'testing-dev-optional-flags': { | ||
'package.json': JSON.stringify({ | ||
name: '@isaacs/testing-dev-optional-flags', | ||
version: '1.0.0', | ||
dependencies: { | ||
wrappy: '^1.0.2', | ||
'own-or': '^1.0.0', | ||
}, | ||
}), | ||
node_modules: { | ||
'own-or': { | ||
'package.json': JSON.stringify({ | ||
name: 'own-or', | ||
version: '1.0.0', | ||
}), | ||
}, | ||
wrappy: { | ||
'package.json': JSON.stringify({ | ||
name: 'wrappy', | ||
version: '1.0.0', | ||
}), | ||
}, | ||
}, | ||
}, | ||
}, | ||
once: { | ||
'package.json': JSON.stringify({ | ||
name: 'once', | ||
version: '1.3.1', | ||
dependencies: { | ||
wrappy: '1', | ||
}, | ||
}), | ||
node_modules: { | ||
wrappy: { | ||
'package.json': JSON.stringify({ | ||
name: 'wrappy', | ||
version: '1.0.1', | ||
}), | ||
}, | ||
}, | ||
}, | ||
}, | ||
}) | ||
t.matchSnapshot(await printIdeal(path, { global: true, update: ['wrappy'] }), | ||
'updating sub-dep has no effect') | ||
t.matchSnapshot(await printIdeal(path, { global: true, update: ['once'] }), | ||
'update a single dep') | ||
t.matchSnapshot(await printIdeal(path, { global: true, update: true }), | ||
'update all the deps') | ||
}) |