Skip to content

Commit

Permalink
Fix inputs (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny authored May 14, 2021
1 parent 41be5e6 commit 71eeb7d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
const path = require('path');
const cacheDir = inputs.cacheDir || env.CECIL_CACHE_DIR || '.cache';

const getCacheDirs = (constants) => [
const getCacheDirs = (constants, inputs) => [
constants.PUBLISH_DIR,
cacheDir
inputs.cacheDir || env.CECIL_CACHE_DIR || '.cache'
];

module.exports = {
async onPreBuild({constants, utils}) {
async onPreBuild({constants, inputs, utils}) {
if (process.cwd() === constants.PUBLISH_DIR) {
utils.build.failBuild(
`Your site’s publish directory is not set correctly (“${constants.PUBLISH_DIR}”).`
);
}

const cacheDirs = getCacheDirs(constants);
const cacheDirs = getCacheDirs(constants, inputs);

if (await utils.cache.restore(cacheDirs)) {
console.log('Found the Cecil cache.');
} else {
console.log('Cecil cache not found.');
}
},
async onPostBuild({constants, utils}) {
const cacheDirs = getCacheDirs(constants);
async onPostBuild({constants, inputs, utils}) {
const cacheDirs = getCacheDirs(constants, inputs);

if (await utils.cache.save(cacheDirs)) {
console.log('Stored the Cecil cache to speed up next builds.');
Expand Down
2 changes: 1 addition & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ inputs:
- name: cacheDir
description: Cache directory, relative to publish directory (default is `.cache`).
required: false
default: .cache
default: '.cache'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "netlify-plugin-cecil-cache",
"version": "0.2.1",
"version": "0.2.2",
"description": "Persist the Cecil cache between Netlify builds.",
"main": "index.js",
"repository": "https://github.com/Cecilapp/netlify-plugin-cecil-cache.git",
Expand Down

0 comments on commit 71eeb7d

Please sign in to comment.