Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: map-workspaces@2.0.2 #4545

Merged
merged 1 commit into from
Mar 10, 2022
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
58 changes: 41 additions & 17 deletions node_modules/@npmcli/map-workspaces/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,28 +117,52 @@ async function mapWorkspaces (opts = {}) {

const name = getPackageName(pkg, packagePathname)

let seenPackagePathnames = seen.get(name)
if (!seenPackagePathnames) {
seenPackagePathnames = new Set()
seen.set(name, seenPackagePathnames)
}
if (item.negate) {
results.delete(packagePathname, name)
seenPackagePathnames.delete(packagePathname)
} else {
if (seen.has(name) && seen.get(name) !== packagePathname) {
throw getError({
Type: Error,
message: [
'must not have multiple workspaces with the same name',
`package '${name}' has conflicts in the following paths:`,
' ' + seen.get(name),
' ' + packagePathname,
].join('\n'),
code: 'EDUPLICATEWORKSPACE',
})
}

seen.set(name, packagePathname)
results.set(packagePathname, name)
seenPackagePathnames.add(packagePathname)
}
}
}
return reverseResultMap(results)

const errorMessageArray = ['must not have multiple workspaces with the same name']
for (const [packageName, seenPackagePathnames] of seen) {
if (seenPackagePathnames.size === 0) {
continue
}
if (seenPackagePathnames.size > 1) {
addDuplicateErrorMessages(errorMessageArray, packageName, seenPackagePathnames)
} else {
results.set(packageName, seenPackagePathnames.values().next().value)
}
}

if (errorMessageArray.length > 1) {
throw getError({
Type: Error,
message: errorMessageArray.join('\n'),
code: 'EDUPLICATEWORKSPACE',
})
}

return results
}

function addDuplicateErrorMessages (messageArray, packageName, packagePathnames) {
messageArray.push(
`package '${packageName}' has conflicts in the following paths:`
)

for (const packagePathname of packagePathnames) {
messageArray.push(
' ' + packagePathname
)
}
}

mapWorkspaces.virtual = function (opts = {}) {
Expand Down
15 changes: 5 additions & 10 deletions node_modules/@npmcli/map-workspaces/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@npmcli/map-workspaces",
"version": "2.0.1",
"version": "2.0.2",
"main": "lib/index.js",
"files": [
"bin",
Expand Down Expand Up @@ -37,23 +37,18 @@
"tap": {
"check-coverage": true
},
"standard": {
"ignore": [
"/tap-snapshots/"
]
},
"devDependencies": {
"@npmcli/template-oss": "^2.7.1",
"eslint": "^8.9.0",
"@npmcli/template-oss": "^2.9.2",
"eslint": "^8.10.0",
"tap": "^15.1.6"
},
"dependencies": {
"@npmcli/name-from-folder": "^1.0.1",
"glob": "^7.2.0",
"minimatch": "^5.0.0",
"minimatch": "^5.0.1",
"read-package-json-fast": "^2.0.3"
},
"templateOSS": {
"version": "2.7.1"
"version": "2.9.2"
}
}
18 changes: 9 additions & 9 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"@npmcli/arborist": "^5.0.1",
"@npmcli/ci-detect": "^2.0.0",
"@npmcli/config": "^4.0.1",
"@npmcli/map-workspaces": "^2.0.0",
"@npmcli/map-workspaces": "^2.0.2",
"@npmcli/package-json": "^1.0.1",
"@npmcli/run-script": "^3.0.1",
"abbrev": "~1.1.1",
Expand Down Expand Up @@ -923,14 +923,14 @@
}
},
"node_modules/@npmcli/map-workspaces": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-2.0.1.tgz",
"integrity": "sha512-awwkB/tSWWaCD8F0IbawBdmoPFlbXMaEPN9LyTuJcyJz404/QhB4B/vhQntpk6uxOAkM+bxR7qWMJghYg0tcYQ==",
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-2.0.2.tgz",
"integrity": "sha512-ED54EslGsHFWBPN5x8JAOszuWywuoXYSi9E3HQRsgVkWnqsdTBJDSM4IFMRwmmBUbCHAxmP3wGLu1WMm4fhrOw==",
"inBundle": true,
"dependencies": {
"@npmcli/name-from-folder": "^1.0.1",
"glob": "^7.2.0",
"minimatch": "^5.0.0",
"minimatch": "^5.0.1",
"read-package-json-fast": "^2.0.3"
},
"engines": {
Expand Down Expand Up @@ -11451,13 +11451,13 @@
}
},
"@npmcli/map-workspaces": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-2.0.1.tgz",
"integrity": "sha512-awwkB/tSWWaCD8F0IbawBdmoPFlbXMaEPN9LyTuJcyJz404/QhB4B/vhQntpk6uxOAkM+bxR7qWMJghYg0tcYQ==",
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@npmcli/map-workspaces/-/map-workspaces-2.0.2.tgz",
"integrity": "sha512-ED54EslGsHFWBPN5x8JAOszuWywuoXYSi9E3HQRsgVkWnqsdTBJDSM4IFMRwmmBUbCHAxmP3wGLu1WMm4fhrOw==",
"requires": {
"@npmcli/name-from-folder": "^1.0.1",
"glob": "^7.2.0",
"minimatch": "^5.0.0",
"minimatch": "^5.0.1",
"read-package-json-fast": "^2.0.3"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@npmcli/arborist": "^5.0.1",
"@npmcli/ci-detect": "^2.0.0",
"@npmcli/config": "^4.0.1",
"@npmcli/map-workspaces": "^2.0.0",
"@npmcli/map-workspaces": "^2.0.2",
"@npmcli/package-json": "^1.0.1",
"@npmcli/run-script": "^3.0.1",
"abbrev": "~1.1.1",
Expand Down