Skip to content

Commit

Permalink
refactor: enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Oct 1, 2022
1 parent fbec830 commit fa1c0da
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
18 changes: 9 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const getCacheDirs = (constants, inputs) => [
constants.PUBLISH_DIR,
inputs.cacheDir || process.env.CECIL_CACHE_DIR || '.cache'
inputs.cacheDir || process.env.CECIL_CACHE_DIR
];

const printDebug = (items) => {
Expand All @@ -23,13 +23,13 @@ module.exports = {
const cachedFiles = await utils.cache.list();

utils.status.show({
title: 'Build cache',
title: cachedFiles.length + ' files restored',
summary: 'Cecil cache restored from previous build. ' + cachedFiles.length + ' files.'
})
console.log('Cecil cache (%s) restored from previous build.', cacheDirs.join(', '));
if (inputs.debug) printDebug(cachedFiles);
console.log('%s files from Cecil cache (%s) restored from previous build.', cachedFiles.length, cacheDirs.join(', '));
if (inputs.debug || process.env.CECIL_DEBUG) printDebug(cachedFiles);
} else {
console.log('Cecil cache not found.');
console.log('Cache not found.');
}
},
async onPostBuild({constants, inputs, utils}) {
Expand All @@ -39,13 +39,13 @@ module.exports = {
const cachedFiles = await utils.cache.list();

utils.status.show({
title: 'Build cache',
title: cachedFiles.length + ' files stored',
summary: 'Cecil cache stored to speed up next builds. ' + cachedFiles.length + ' files.'
})
console.log('Cecil cache (%s) stored to speed up next builds.', cacheDirs.join(', '));
if (inputs.debug) printDebug(cachedFiles);
console.log('%s files from Cecil cache (%s) stored to speed up next builds.', cachedFiles.length, cacheDirs.join(', '));
if (inputs.debug || process.env.CECIL_DEBUG) printDebug(cachedFiles);
} else {
console.log('No Cecil build found.');
console.log('Cecil cache not found.');
}
},
};
3 changes: 2 additions & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: netlify-plugin-cecil-cache
inputs:
- name: cacheDir
description: Cache directory, relative to publish directory (default is `.cache`).
description: Cache directory, relative to publish directory.
default: .cache
- name: debug
description: Display list of cached files in build log.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "netlify-plugin-cecil-cache",
"version": "0.2.5",
"version": "0.3.0",
"description": "Persist the Cecil cache between Netlify builds.",
"main": "index.js",
"repository": "https://github.com/Cecilapp/netlify-plugin-cecil-cache.git",
Expand All @@ -12,6 +12,7 @@
"keywords": [
"netlify",
"netlify-plugin",
"cecil"
"cecil",
"cache"
]
}

0 comments on commit fa1c0da

Please sign in to comment.