@@ -40,6 +40,7 @@ async function getVersion(pkg) {
4040async function getLockfileHash ( project ) {
4141 const rootReader = project . getRootReader ( { useGitIgnore : false } ) ;
4242 const lockfiles = await Promise . all ( [
43+ // TODO: Search upward for lockfiles in parent directories?
4344 // npm
4445 await rootReader . byPath ( "/package-lock.json" ) ,
4546 await rootReader . byPath ( "/npm-shrinkwrap.json" ) ,
@@ -59,18 +60,43 @@ async function getLockfileHash(project) {
5960}
6061
6162function collectDepInfo ( graph , project ) {
62- const projects = Object . create ( null ) ;
63+ let projects = [ ] ;
6364 for ( const depName of graph . getTransitiveDependencies ( project . getName ( ) ) ) {
6465 const dep = graph . getProject ( depName ) ;
65- projects [ depName ] = {
66+ projects . push ( {
67+ name : dep . getName ( ) ,
6668 version : dep . getVersion ( )
67- } ;
69+ } ) ;
6870 }
69- const extensions = Object . create ( null ) ;
70- for ( const extension of graph . getExtensions ( ) ) {
71- extensions [ extension . getName ( ) ] = {
72- version : extension . getVersion ( )
73- } ;
71+ projects = projects . sort ( ( a , b ) => {
72+ return a . name . localeCompare ( b . name ) ;
73+ } ) ;
74+
75+ // Collect relevant extensions
76+ let extensions = [ ] ;
77+ if ( graph . getRoot ( ) === project ) {
78+ // Custom middleware is only relevant for root project
79+ project . getCustomMiddleware ( ) . forEach ( ( middlewareDef ) => {
80+ const extension = graph . getExtension ( middlewareDef . name ) ;
81+ if ( extension ) {
82+ extensions . push ( {
83+ name : extension . getName ( ) ,
84+ version : extension . getVersion ( )
85+ } ) ;
86+ }
87+ } ) ;
7488 }
89+ project . getCustomTasks ( ) . forEach ( ( taskDef ) => {
90+ const extension = graph . getExtension ( taskDef . name ) ;
91+ if ( extension ) {
92+ extensions . push ( {
93+ name : extension . getName ( ) ,
94+ version : extension . getVersion ( )
95+ } ) ;
96+ }
97+ } ) ;
98+ extensions = extensions . sort ( ( a , b ) => {
99+ return a . name . localeCompare ( b . name ) ;
100+ } ) ;
75101 return { projects, extensions} ;
76102}
0 commit comments