-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pnpmfile.cjs
52 lines (46 loc) · 1.49 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
/**
* .pnpmfile.cjs
*
* This file allows you to customize the pnpm installation process.
*
* You can use it to:
* - Override dependency versions
* - Inject additional dependencies
* - Modify package.json properties of dependencies
* - Adjust the resolution strategy for certain packages
*
* For more details, visit:
* https://pnpm.io/pnpmfile
*
* Author: Alan Szmyt
*/
module.exports = {
hooks: {
/**
* This hook is executed before resolving the dependencies of a package.
* You can use it to override or inject dependencies.
*/
readPackage(pkg, context) {
// Example: Force a specific version of a dependency
// if (pkg.dependencies && pkg.dependencies["example-package"]) {
// pkg.dependencies["example-package"] = "^1.2.3";
// }
// // Example: Inject an additional dependency
// if (!pkg.dependencies["new-package"]) {
// pkg.dependencies["new-package"] = "^1.0.0";
// }
// Log the package being resolved
// context.log("Resolving package:", pkg);
return pkg;
},
},
/**
* This hook is executed after the package has been resolved, allowing
* you to modify the resolved package data.
*/
afterAllResolved(lockfile, context) {
// Example: You can log the resolved dependencies
context.log("Dependencies resolved:", lockfile.packages);
return lockfile;
},
};