Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 7 additions & 7 deletions lib/commands/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Diff extends BaseCommand {
const pkgName = await this.packageName()
return [
`${pkgName}@${this.npm.config.get('tag')}`,
`file:${this.prefix.replace(/#/g, '%23')}`,
`file:${this.prefix}`,
]
}

Expand Down Expand Up @@ -134,7 +134,7 @@ class Diff extends BaseCommand {
}
return [
`${pkgName}@${a}`,
`file:${this.prefix.replace(/#/g, '%23')}`,
`file:${this.prefix}`,
]
}

Expand Down Expand Up @@ -166,7 +166,7 @@ class Diff extends BaseCommand {
}
return [
`${spec.name}@${spec.fetchSpec}`,
`file:${this.prefix.replace(/#/g, '%23')}`,
`file:${this.prefix}`,
]
}

Expand All @@ -179,7 +179,7 @@ class Diff extends BaseCommand {
}
}

const aSpec = `file:${node.realpath.replace(/#/g, '%23')}`
const aSpec = `file:${node.realpath}`

// finds what version of the package to compare against, if a exact
// version or tag was passed than it should use that, otherwise
Expand Down Expand Up @@ -212,8 +212,8 @@ class Diff extends BaseCommand {
]
} else if (spec.type === 'directory') {
return [
`file:${spec.fetchSpec.replace(/#/g, '%23')}`,
`file:${this.prefix.replace(/#/g, '%23')}`,
`file:${spec.fetchSpec}`,
`file:${this.prefix}`,
]
} else {
throw this.usageError(`Spec type ${spec.type} not supported.`)
Expand Down Expand Up @@ -281,7 +281,7 @@ class Diff extends BaseCommand {

const res = !node || !node.package || !node.package.version
? spec.fetchSpec
: `file:${node.realpath.replace(/#/g, '%23')}`
: `file:${node.realpath}`

return `${spec.name}@${res}`
})
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Link extends ArboristWorkspaceCmd {
...this.npm.flatOptions,
prune: false,
path: this.npm.prefix,
add: names.map(l => `file:${resolve(globalTop, 'node_modules', l).replace(/#/g, '%23')}`),
add: names.map(l => `file:${resolve(globalTop, 'node_modules', l)}`),
save,
workspaces: this.workspaceNames,
})
Expand All @@ -135,7 +135,7 @@ class Link extends ArboristWorkspaceCmd {
async linkPkg () {
const wsp = this.workspacePaths
const paths = wsp && wsp.length ? wsp : [this.npm.prefix]
const add = paths.map(path => `file:${path.replace(/#/g, '%23')}`)
const add = paths.map(path => `file:${path}`)
const globalTop = resolve(this.npm.globalDir, '..')
const Arborist = require('@npmcli/arborist')
const arb = new Arborist({
Expand Down
Loading
Loading