Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2022-07-12 20:14:38 +0300
committerGitHub <noreply@github.com>2022-07-12 20:14:38 +0300
commit52ec5ec61fd3b266efd7a9c5712dd6a769a2d365 (patch)
tree73e8f1e8662cf8e3b4dfe5f0101ce4637d6f292b
parent6e68d237cabd016855b78b3844c10ad1c0b83b20 (diff)
fix: properly open package arg repo inside workspace (#5154)
-rw-r--r--lib/package-url-cmd.js3
-rw-r--r--test/lib/commands/repo.js8
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/package-url-cmd.js b/lib/package-url-cmd.js
index b89727214..4254dde45 100644
--- a/lib/package-url-cmd.js
+++ b/lib/package-url-cmd.js
@@ -40,6 +40,9 @@ class PackageUrlCommand extends BaseCommand {
}
async execWorkspaces (args, filters) {
+ if (args && args.length) {
+ return this.exec(args)
+ }
await this.setWorkspaces(filters)
return this.exec(this.workspacePaths)
}
diff --git a/test/lib/commands/repo.js b/test/lib/commands/repo.js
index e06a28944..4c983f135 100644
--- a/test/lib/commands/repo.js
+++ b/test/lib/commands/repo.js
@@ -311,4 +311,12 @@ t.test('workspaces', async t => {
)
t.match({}, opened, 'opened no repo urls')
})
+
+ t.test('package arg and workspace', async (t) => {
+ npm.config.set('workspace', ['workspace-a'])
+ await npm.exec('repo', ['.'])
+ t.match({
+ 'https://github.com/npm/workspaces-test': 1,
+ }, opened, 'opened url for package arg, not workspace')
+ })
})