File tree Expand file tree Collapse file tree 3 files changed +49
-0
lines changed
packages/check-peer-dependencies-optional-dependency Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -86,3 +86,6 @@ Searching for solutions:
86
86
yarn upgrade @angular/
[email protected]
87
87
```
88
88
89
+ ## Running as postinstall script using ` yarn ` package manager
90
+
91
+ Please see [ check-peer-dependencies-optional-dependency] ( https://github.com/christopherthielen/check-peer-dependencies/tree/master/packages/check-peer-dependencies-optional-dependency )
Original file line number Diff line number Diff line change
1
+ # check-peer-dependencies-optional-dependency
2
+
3
+ ## This is a hack to make check-peer-dependency output visible as a postinstall script when using yarn.
4
+
5
+ ### Motivation
6
+
7
+ I wanted to create a meta-package that provides a set of peerDependencies to downstream projects.
8
+ I wanted to run ` check-peer-dependencies ` as a ` postinstall ` script to inform users which dependencies are not met and offer a solution.
9
+
10
+ ### Problem
11
+
12
+ By default, ` yarn ` package manager hides output from postinstall scripts.
13
+ I noticed, however, that output from ` optionalDependencies ` is visible.
14
+
15
+ ### Using
16
+
17
+ To run ` check-peer-dependencies ` as when your package is installed, add ` check-peer-dependencies-optional-dependency ` as an optional dependency.
18
+ This package has a ` postinstall ` script which invokes ` check-peer-dependencies ` .
19
+
20
+ ```
21
+ {
22
+ "name": "my-installable-package",
23
+ ...
24
+ "dependencies": {
25
+ ...
26
+ "check-peer-dependencies": "latest"
27
+ },
28
+ "peerDependencies": {
29
+ "this-package-should-be-installed-downstream": "10.0.0"
30
+ },
31
+ "optionalDependencies: {
32
+ "check-peer-dependencies-optional-dependency": "latest"
33
+ }
34
+ }
35
+ ```
36
+
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " check-peer-dependencies-optional-dependency" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " Add this module as an optional dependency to check peer dependencies as a postinstall script (yarn)" ,
5
+ "author" : " Chris Thielen" ,
6
+ "license" : " MIT" ,
7
+ "scripts" : {
8
+ "postinstall" : " npx check-peer-dependencies"
9
+ }
10
+ }
You can’t perform that action at this time.
0 commit comments