+36
-2
lines changedFilter options
+36
-2
lines changed Original file line number Diff line number Diff line change
@@ -109,13 +109,13 @@ class Link extends ArboristWorkspaceCmd {
109
109
// using any of --save-dev or other types
110
110
const save =
111
111
Boolean(
112
-
this.npm.config.find('save') !== 'default' ||
112
+
(this.npm.config.find('save') !== 'default' &&
113
+
this.npm.config.get('save')) ||
113
114
this.npm.config.get('save-optional') ||
114
115
this.npm.config.get('save-peer') ||
115
116
this.npm.config.get('save-dev') ||
116
117
this.npm.config.get('save-prod')
117
118
)
118
-
119
119
// create a new arborist instance for the local prefix and
120
120
// reify all the pending names as symlinks there
121
121
const localArb = new Arborist({
Original file line number Diff line number Diff line change
@@ -369,6 +369,40 @@ t.test('link pkg already in global space when prefix is a symlink', async t => {
369
369
t.matchSnapshot(await printLinks(), 'should create a local symlink to global pkg')
370
370
})
371
371
372
+
t.test('should not save link to package file', async t => {
373
+
const { link, prefix } = await mockLink(t, {
374
+
globalPrefixDir: {
375
+
node_modules: {
376
+
'@myscope': {
377
+
linked: t.fixture('symlink', '../../../other/scoped-linked'),
378
+
},
379
+
},
380
+
},
381
+
otherDirs: {
382
+
'scoped-linked': {
383
+
'package.json': JSON.stringify({
384
+
name: '@myscope/linked',
385
+
version: '1.0.0',
386
+
}),
387
+
},
388
+
},
389
+
prefixDir: {
390
+
'package.json': JSON.stringify({
391
+
name: 'my-project',
392
+
version: '1.0.0',
393
+
}),
394
+
},
395
+
config: { save: false },
396
+
})
397
+
398
+
await link.exec(['@myscope/linked'])
399
+
t.match(
400
+
require(resolve(prefix, 'package.json')).dependencies,
401
+
undefined,
402
+
'should not save to package.json upon linking'
403
+
)
404
+
})
405
+
372
406
t.test('should not prune dependencies when linking packages', async t => {
373
407
const { link, prefix } = await mockLink(t, {
374
408
globalPrefixDir: {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4