Skip to content

Commit 415de3d

Browse files
authored
Merge pull request #4 from ehmicky/feat/upgrade-netlify
2 parents 5714323 + e301b54 commit 415de3d

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

index.js

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,18 @@ const path = require('path')
33
const { promisify } = require('util')
44
const 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

manifest.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: netlify-plugin-debug-cache
2+
inputs:
3+
- name: outputFile
4+
description: Output the result in this file, published with the Site
5+
default: cache-output.json

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"type": "git",
1717
"url": "https://github.com/netlify-labs/netlify-plugin-debug-cache"
1818
},
19+
"bugs": {
20+
"url": "https://github.com/netlify-labs/netlify-plugin-debug-cache/issues"
21+
},
1922
"keywords": [
2023
"netlify",
2124
"netlify-plugin",

0 commit comments

Comments
 (0)