Skip to content

Commit

Permalink
add branches feature
Browse files Browse the repository at this point in the history
  • Loading branch information
swyxio committed Mar 11, 2020
1 parent b54b792 commit 0c1f9be
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -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`
);
}
}
};
};

0 comments on commit 0c1f9be

Please sign in to comment.