Skip to content

Commit 6bcf5c1

Browse files
committed
deps: minimatch@5.0.1
1 parent 7eaf32f commit 6bcf5c1

File tree

23 files changed

+2187
-3198
lines changed

23 files changed

+2187
-3198
lines changed

lib/workspaces/get-workspaces.js

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
const { resolve } = require('path')
1+
const path = require('path')
22
const mapWorkspaces = require('@npmcli/map-workspaces')
33
const minimatch = require('minimatch')
44
const rpj = require('read-package-json-fast')
55

66
// Returns an Map of paths to workspaces indexed by workspace name
77
// { foo => '/path/to/foo' }
8-
const getWorkspaces = async (filters, { path, includeWorkspaceRoot, relativeFrom }) => {
8+
const getWorkspaces = async (filters, { path: filePath, includeWorkspaceRoot, relativeFrom }) => {
99
// TODO we need a better error to be bubbled up here if this rpj call fails
10-
const pkg = await rpj(resolve(path, 'package.json'))
11-
const workspaces = await mapWorkspaces({ cwd: path, pkg })
10+
const pkg = await rpj(path.resolve(filePath, 'package.json'))
11+
const workspaces = await mapWorkspaces({ cwd: filePath, pkg })
1212
let res = new Map()
1313
if (includeWorkspaceRoot) {
14-
res.set(pkg.name, path)
14+
res.set(pkg.name, filePath)
1515
}
1616

1717
if (!filters.length) {
@@ -20,9 +20,16 @@ const getWorkspaces = async (filters, { path, includeWorkspaceRoot, relativeFrom
2020

2121
for (const filterArg of filters) {
2222
for (const [workspaceName, workspacePath] of workspaces.entries()) {
23-
if (filterArg === workspaceName
24-
|| resolve(relativeFrom || path, filterArg) === workspacePath
25-
|| minimatch(workspacePath, `${resolve(relativeFrom || path, filterArg)}/*`)) {
23+
if (
24+
filterArg === workspaceName
25+
|| path.resolve(relativeFrom || filePath, filterArg) === workspacePath
26+
// path.posix is used here because minimatch wants forward slashes only
27+
// for glob patterns
28+
|| minimatch(
29+
workspacePath,
30+
`${path.posix.resolve(relativeFrom || filePath, filterArg)}/*`
31+
)
32+
) {
2633
res.set(workspaceName, workspacePath)
2734
}
2835
}

node_modules/@npmcli/map-workspaces/node_modules/minimatch/LICENSE

-15
This file was deleted.

0 commit comments

Comments
 (0)