Skip to content

Commit

Permalink
deps: minimatch@5.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Apr 6, 2022
1 parent 7eaf32f commit fb866c8
Show file tree
Hide file tree
Showing 24 changed files with 2,282 additions and 3,279 deletions.
16 changes: 13 additions & 3 deletions lib/workspaces/get-workspaces.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
const { resolve } = require('path')
const { resolve, relative } = require('path')
const mapWorkspaces = require('@npmcli/map-workspaces')
const minimatch = require('minimatch')
const rpj = require('read-package-json-fast')

// minimatch wants forward slashes only for glob patterns
const globify = pattern => pattern.split('\\').join('/')

// Returns an Map of paths to workspaces indexed by workspace name
// { foo => '/path/to/foo' }
const getWorkspaces = async (filters, { path, includeWorkspaceRoot, relativeFrom }) => {
Expand All @@ -20,9 +23,16 @@ const getWorkspaces = async (filters, { path, includeWorkspaceRoot, relativeFrom

for (const filterArg of filters) {
for (const [workspaceName, workspacePath] of workspaces.entries()) {
let relativePath = relative(relativeFrom, workspacePath)
if (filterArg.startsWith('./')) {
relativePath = `./${relativePath}`
}
const relativeFilter = relative(path, filterArg)
if (filterArg === workspaceName
|| resolve(relativeFrom || path, filterArg) === workspacePath
|| minimatch(workspacePath, `${resolve(relativeFrom || path, filterArg)}/*`)) {
|| resolve(relativeFrom, filterArg) === workspacePath
|| minimatch(relativePath, `${globify(relativeFilter)}/*`)
|| minimatch(relativePath, `${globify(filterArg)}/*`)
) {
res.set(workspaceName, workspacePath)
}
}
Expand Down
15 changes: 0 additions & 15 deletions node_modules/@npmcli/map-workspaces/node_modules/minimatch/LICENSE

This file was deleted.

Loading

0 comments on commit fb866c8

Please sign in to comment.