Skip to content

Commit e97b2a5

Browse files
43081jmrstork
andauthored
chore: remove p-every (#6586)
* chore: remove `p-every` We can achieve this with `Promise.all` and no longer need a dependency. * chore: drop p-every dependency --------- Co-authored-by: Mateusz Bocian <[email protected]>
1 parent ecd4383 commit e97b2a5

File tree

4 files changed

+21
-40
lines changed

4 files changed

+21
-40
lines changed

package-lock.json

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/build/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
"minimatch": "^9.0.4",
9797
"os-name": "^6.0.0",
9898
"p-event": "^6.0.0",
99-
"p-every": "^2.0.0",
10099
"p-filter": "^4.0.0",
101100
"p-locate": "^6.0.0",
102101
"p-map": "^7.0.0",

packages/build/src/plugins/compatibility.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import _pEvery from 'p-every'
21
import pLocate from 'p-locate'
32
import { type PackageJson } from 'read-package-up'
43
import semver from 'semver'
@@ -9,9 +8,6 @@ import { SystemLogger } from '../plugins_core/types.js'
98
import { PluginVersion } from './list.js'
109
import { CONDITIONS } from './plugin_conditions.js'
1110

12-
// the types of that package seem to be not correct and demand a `pEvery.default()` usage which is wrong
13-
const pEvery = _pEvery as unknown as typeof import('p-every').default
14-
1511
/**
1612
* Retrieve the `expectedVersion` of a plugin:
1713
* - This is the version which should be run
@@ -128,9 +124,13 @@ const getCompatibleEntry = async function ({
128124
return false
129125
}
130126

131-
return await pEvery(conditions, async ({ type, condition }) =>
132-
CONDITIONS[type].test(condition as any, { nodeVersion, packageJson, packagePath, buildDir }),
133-
)
127+
return (
128+
await Promise.all(
129+
conditions.map(async ({ type, condition }) =>
130+
CONDITIONS[type].test(condition as any, { nodeVersion, packageJson, packagePath, buildDir }),
131+
),
132+
)
133+
).every(Boolean)
134134
})
135135

136136
if (compatibleEntry) {
@@ -192,9 +192,13 @@ const getFirstCompatibleEntry = async function ({
192192
return true
193193
}
194194

195-
return await pEvery(conditions, async ({ type, condition }) =>
196-
CONDITIONS[type].test(condition as any, { nodeVersion, packageJson, packagePath, buildDir }),
197-
)
195+
return (
196+
await Promise.all(
197+
conditions.map(async ({ type, condition }) =>
198+
CONDITIONS[type].test(condition as any, { nodeVersion, packageJson, packagePath, buildDir }),
199+
),
200+
)
201+
).every(Boolean)
198202
})
199203

200204
if (compatibleEntry) {

packages/build/src/plugins/plugin_conditions.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { join } from 'path'
22

3-
import _pEvery from 'p-every'
43
import { type PackageJson } from 'read-package-up'
54
import semver from 'semver'
65

@@ -9,9 +8,6 @@ import { resolvePath } from '../utils/resolve.js'
98

109
import { type PluginVersion } from './list.js'
1110

12-
// the types of that package seem to be not correct and demand a `pEvery.default()` usage which is wrong
13-
const pEvery = _pEvery as unknown as typeof import('p-every').default
14-
1511
type ConditionContext = {
1612
nodeVersion: string
1713
packageJson: PackageJson
@@ -53,9 +49,13 @@ const siteDependenciesTest = async function (
5349
}
5450
}
5551

56-
return await pEvery(Object.entries(allowedSiteDependencies), ([dependencyName, allowedVersion]) =>
57-
siteDependencyTest({ dependencyName, allowedVersion, siteDependencies, buildDir }),
58-
)
52+
return (
53+
await Promise.all(
54+
Object.entries(allowedSiteDependencies).map(async ([dependencyName, allowedVersion]) =>
55+
siteDependencyTest({ dependencyName, allowedVersion, siteDependencies, buildDir }),
56+
),
57+
)
58+
).every(Boolean)
5959
}
6060

6161
const siteDependencyTest = async function ({

0 commit comments

Comments
 (0)