@@ -823,20 +823,6 @@ define('global', {
823823 } ,
824824} )
825825
826- define ( 'global-style' , {
827- default : false ,
828- type : Boolean ,
829- description : `
830- Causes npm to install the package into your local \`node_modules\` folder
831- with the same layout it uses with the global \`node_modules\` folder.
832- Only your direct dependencies will show in \`node_modules\` and
833- everything they depend on will be flattened in their \`node_modules\`
834- folders. This obviously will eliminate some deduping. If used with
835- \`legacy-bundling\`, \`legacy-bundling\` will be preferred.
836- ` ,
837- flatten,
838- } )
839-
840826// the globalconfig has its default defined outside of this module
841827define ( 'globalconfig' , {
842828 type : path ,
@@ -851,6 +837,25 @@ define('globalconfig', {
851837 flatten,
852838} )
853839
840+ define ( 'global-style' , {
841+ default : false ,
842+ type : Boolean ,
843+ description : `
844+ Only install direct dependencies in the top level \`node_modules\`,
845+ but hoist on deeper dependendencies.
846+ Sets \`--install-strategy=shallow\`.
847+ ` ,
848+ deprecated : `
849+ This option has been deprecated in favor of \`--install-strategy=shallow\`
850+ ` ,
851+ flatten ( key , obj , flatOptions ) {
852+ if ( obj [ key ] ) {
853+ obj [ 'install-strategy' ] = 'shallow'
854+ flatOptions . installStrategy = 'shallow'
855+ }
856+ } ,
857+ } )
858+
854859define ( 'heading' , {
855860 default : 'npm' ,
856861 type : String ,
@@ -1076,6 +1081,21 @@ define('install-links', {
10761081 flatten,
10771082} )
10781083
1084+ define ( 'install-strategy' , {
1085+ default : 'hoisted' ,
1086+ type : [ 'hoisted' , 'nested' , 'shallow' ] ,
1087+ description : `
1088+ Sets the strategy for installing packages in node_modules.
1089+ hoisted (default): Install non-duplicated in top-level, and duplicated as
1090+ necessary within directory structure.
1091+ nested: (formerly --legacy-bundling) install in place, no hoisting.
1092+ shallow (formerly --global-style) only install direct deps at top-level.
1093+ linked: (coming soon) install in node_modules/.store, link in place,
1094+ unhoisted.
1095+ ` ,
1096+ flatten,
1097+ } )
1098+
10791099define ( 'json' , {
10801100 default : false ,
10811101 type : Boolean ,
@@ -1111,12 +1131,21 @@ define('legacy-bundling', {
11111131 default : false ,
11121132 type : Boolean ,
11131133 description : `
1114- Causes npm to install the package such that versions of npm prior to 1.4,
1115- such as the one included with node 0.8, can install the package. This
1116- eliminates all automatic deduping. If used with \`global-style\` this
1117- option will be preferred.
1134+ Instead of hoisting package installs in \`node_modules\`, install packages
1135+ in the same manner that they are depended on. This may cause very deep
1136+ directory structures and duplicate package installs as there is no
1137+ de-duplicating.
1138+ Sets \`--install-strategy=nested\`.
11181139 ` ,
1119- flatten,
1140+ deprecated : `
1141+ This option has been deprecated in favor of \`--install-strategy=nested\`
1142+ ` ,
1143+ flatten ( key , obj , flatOptions ) {
1144+ if ( obj [ key ] ) {
1145+ obj [ 'install-strategy' ] = 'nested'
1146+ flatOptions . installStrategy = 'nested'
1147+ }
1148+ } ,
11201149} )
11211150
11221151define ( 'legacy-peer-deps' , {
@@ -1523,8 +1552,8 @@ define('prefix', {
15231552 short : 'C' ,
15241553 default : '' ,
15251554 defaultDescription : `
1526- In global mode, the folder where the node executable is installed. In
1527- local mode , the nearest parent folder containing either a package.json
1555+ In global mode, the folder where the node executable is installed.
1556+ Otherwise , the nearest parent folder containing either a package.json
15281557 file or a node_modules folder.
15291558 ` ,
15301559 description : `
0 commit comments