-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.pnpmfile.cjs
41 lines (38 loc) · 1.1 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
// @ts-check
/** @import { PackageManifest } from "@pnpm/types" */
/**
* @template T
* @param {T} thing
* @returns {NonNullable<T>}
*/
function assertNonNullable(thing) {
return /** @type {NonNullable<T>} */ (thing);
}
// eslint-disable-next-line no-undef
module.exports.hooks = {
/**
* @param {PackageManifest} pkg
* @param {unknown} context
*/
// @ts-expect-error TS6133
// eslint-disable-next-line @typescript-eslint/no-unused-vars
readPackage: (pkg, context) => {
for (
const Ԛ of [
"@types/node",
"browserslist",
"caniuse-lite",
"electron-to-chromium",
]
) {
const dependencies = assertNonNullable(pkg.dependencies);
const peerDependencies = assertNonNullable(pkg.peerDependencies);
if (dependencies[Ԛ]) {
peerDependencies[Ԛ] = dependencies[Ԛ];
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete dependencies[Ԛ];
}
}
return pkg;
},
};