Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/commands/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class Link extends ArboristWorkspaceCmd {
}

async linkInstall (args) {

// load current packages from the global space,
// and then add symlinks installs locally
const globalTop = resolve(this.npm.globalDir, '..')
Expand Down Expand Up @@ -109,13 +110,13 @@ class Link extends ArboristWorkspaceCmd {
// using any of --save-dev or other types
const save =
Boolean(
this.npm.config.find('save') !== 'default' ||
(this.npm.config.find('save') !== 'default' &&
this.npm.config.get('save')) ||
this.npm.config.get('save-optional') ||
this.npm.config.get('save-peer') ||
this.npm.config.get('save-dev') ||
this.npm.config.get('save-prod')
)

// create a new arborist instance for the local prefix and
// reify all the pending names as symlinks there
const localArb = new Arborist({
Expand Down
9 changes: 4 additions & 5 deletions test/lib/commands/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,13 @@ t.test('link pkg already in global space', async t => {
})

// XXX: how to convert this to a config that gets passed in?
npm.config.find = () => 'default'
npm.config.find = () => '--save'
Comment thread
Santoshraj2 marked this conversation as resolved.
Outdated

await link.exec(['@myscope/linked'])

t.equal(
t.match(
require(resolve(prefix, 'package.json')).dependencies,
undefined,
'should not save to package.json upon linking'
{ '@myscope/linked': 'file:../other/scoped-linked' },
'should save to package.json upon linking'
)

t.matchSnapshot(await printLinks(), 'should create a local symlink to global pkg')
Expand Down