forked from daotl/effect-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.pnpmfile.cjs
55 lines (53 loc) · 1.18 KB
/
.pnpmfile.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// TODO: Write a marker to package.json instead?
const enforceSingleVersion = [
'@effect/io',
'@effect/stm',
// Language service currently depends on them
// "@fp-ts/core",
'@effect/data',
'@fp-ts/optic',
'@effect-app/core',
'@effect-app/infra-adapters',
'@effect-app/schema',
'@effect-app/infra',
'@effect-app/prelude',
'@effect-app/react',
'@effect-app/vue',
'vue',
'date-fns',
]
function _afterAllResolved(lockfile, context) {
context.log('Checking duplicate packages')
const packagesKeys = Object.keys(lockfile.packages)
const found = {}
for (const p of packagesKeys) {
for (const x of enforceSingleVersion) {
if (p.startsWith(`/${x}/`)) {
if (found[x]) {
found[x] += 1
} else {
found[x] = 1
}
}
}
}
let msg = ''
for (const p in found) {
const count = found[p]
if (count > 1) {
msg += `${p} found ${count} times\n`
}
}
if (msg) {
throw new Error(msg)
}
return lockfile
}
module.exports = {
hooks: {
// Temporarily disabled, seems to be false positives:
// pnpm: @effect/data found 2 times
// date-fns found 2 times
// afterAllResolved,
},
}