@@ -4,9 +4,11 @@ import type Config from '../../config.js';
4
4
import { MessageError } from '../../errors.js' ;
5
5
import type { Reporter } from '../../reporters/index.js' ;
6
6
import buildSubCommands from './_build-sub-commands.js' ;
7
+ import { DEPENDENCY_TYPES } from '../../constants.js' ;
7
8
8
9
const invariant = require ( 'invariant' ) ;
9
10
const path = require ( 'path' ) ;
11
+ const semver = require ( 'semver' ) ;
10
12
11
13
export function hasWrapper ( commander : Object , args : Array < string > ) : boolean {
12
14
return true ;
@@ -27,8 +29,31 @@ export async function info(config: Config, reporter: Reporter, flags: Object, ar
27
29
const publicData = { } ;
28
30
29
31
for ( const workspaceName of Object . keys ( workspaces ) ) {
32
+ const { loc, manifest} = workspaces [ workspaceName ] ;
33
+
34
+ const workspaceDependencies = new Set ( ) ;
35
+ const mismatchedWorkspaceDependencies = new Set ( ) ;
36
+
37
+ for ( const dependencyType of DEPENDENCY_TYPES ) {
38
+ if ( dependencyType !== 'peerDependencies' ) {
39
+ for ( const dependencyName of Object . keys ( manifest [ dependencyType ] || { } ) ) {
40
+ if ( Object . prototype . hasOwnProperty . call ( workspaces , dependencyName ) ) {
41
+ invariant ( manifest && manifest [ dependencyType ] , 'The request should exist' ) ;
42
+ const requestedRange = manifest [ dependencyType ] [ dependencyName ] ;
43
+ if ( semver . satisfies ( workspaces [ dependencyName ] . manifest . version , requestedRange ) ) {
44
+ workspaceDependencies . add ( dependencyName ) ;
45
+ } else {
46
+ mismatchedWorkspaceDependencies . add ( dependencyName ) ;
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+
30
53
publicData [ workspaceName ] = {
31
- location : path . relative ( config . lockfileFolder , workspaces [ workspaceName ] . loc ) . replace ( / \\ / g, '/' ) ,
54
+ location : path . relative ( config . lockfileFolder , loc ) . replace ( / \\ / g, '/' ) ,
55
+ workspaceDependencies : Array . from ( workspaceDependencies ) ,
56
+ mismatchedWorkspaceDependencies : Array . from ( mismatchedWorkspaceDependencies ) ,
32
57
} ;
33
58
}
34
59
0 commit comments