diff --git a/index.js b/index.js index 2fa6e23..47512a6 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,24 @@ const pluginDecrypt = require('./pluginDecrypt'); +const chalk = require('chalk'); module.exports = function netlify404nomore(conf) { return { name: 'netlify-plugin-encrypted-files', - onInit() { + onInit({ pluginConfig: { branches } }) { console.log('decrypting files'); - pluginDecrypt({}); + if (branches && branches.includes(process.env.BRANCH)) { + pluginDecrypt({}); + } else if (typeof branches === 'undefined') { + pluginDecrypt({}); + } else { + console.log( + 'branches specified', + chalk.yellow(branches.join(' ')), + `but our current branch is ${chalk.blue( + process.env.BRANCH + )}, skipping decryption` + ); + } } }; };