@@ -3,29 +3,18 @@ const path = require('path')
33const  {  promisify }  =  require ( 'util' ) 
44const  writeFile  =  promisify ( fs . writeFile ) 
55
6- module . exports  =  function  netlifyPlugin ( config )  { 
7-  return  { 
8-  name : 'netlify-plugin-debug-cache' , 
9-  onEnd : async  ( {  constants,  pluginConfig,  utils } )  =>  { 
10-  const  {  BUILD_DIR  }  =  constants 
11-  const  cacheManifestFileName  =  pluginConfig . outputFile  ||  'cache-output.json' 
12-  const  cacheManifestPath  =  path . join ( BUILD_DIR ,  cacheManifestFileName ) 
6+ module . exports  =  { 
7+  onEnd : async  ( {  constants,  inputs,  utils } )  =>  { 
8+  const  {  PUBLISH_DIR  }  =  constants 
9+  const  cacheManifestFileName  =  inputs . outputFile 
10+  const  cacheManifestPath  =  path . join ( PUBLISH_DIR ,  cacheManifestFileName ) 
1311 console . log ( 'Saving cache file manifest for debugging...' ) 
14-  let  files  =  [ ] 
15-  try  { 
16-  files  =  await  utils . cache . list ( ) 
17-  if  ( cacheManifestPath )  { 
18-  await  writeFile ( cacheManifestPath ,  JSON . stringify ( files ,  null ,  2 ) ) 
19-  } 
20-  }  catch  ( err )  { 
21-  console . log ( `netlify-plugin-debug-cache error` ) 
22-  console . log ( err ) 
23-  } 
12+  const  files  =  await  utils . cache . list ( ) 
13+  await  writeFile ( cacheManifestPath ,  JSON . stringify ( files ,  null ,  2 ) ) 
2414 console . log ( `Cache file count: ${ files . length }  ` ) 
2515 console . log ( `Cache manifest saved to ${ cacheManifestPath }  ` ) 
2616 console . log ( `Please download the build files to inspect ${ cacheManifestFileName }  .` ) 
2717 console . log ( 'Instructions => http://bit.ly/netlify-dl-cache' ) 
2818 } 
29-  } 
3019} 
3120
0 commit comments