Skip to content

Commit

Permalink
Detect bref/secrets-loader installed as dependency of another package
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincerro committed Oct 22, 2023
1 parent fc65480 commit cd9aa59
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugin/secrets.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ function warnIfUsingSecretsWithoutTheBrefDependency(serverless, log) {

if (allVariables.length > 0) {
// Check if the bref/secrets-loader dependency is installed in composer.json
if (! fs.existsSync('composer.json')) {
if (! fs.existsSync('composer.lock')) {
return;
}
const composerJson = JSON.parse(fs.readFileSync('composer.json', 'utf8'));
const dependencies = Object.keys(composerJson.require || {});
const composerLock = JSON.parse(fs.readFileSync('composer.lock', 'utf8'));
const dependencies = composerLock.packages.map(v => v.name) || {};
if (dependencies.includes('bref/secrets-loader')) {
return;
}
Expand Down

0 comments on commit cd9aa59

Please sign in to comment.