-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix for multiple actions using the require-adobe-auth annotation in the same package #137
Conversation
Codecov Report
@@ Coverage Diff @@
## master #137 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 57 57
Lines 1809 1809
Branches 325 326 +1
=========================================
Hits 1809 1809
Continue to review full report at Codecov.
|
@@ -423,74 +424,61 @@ function rewriteActionsWithAdobeAuthAnnotation (packages, deploymentPackages) { | |||
const REWRITE_ACTION_PREFIX = '__secured_' | |||
|
|||
// avoid side effects, do not modify input packages | |||
const newPackages = { ...packages } | |||
const newDeploymentPackages = { ...deploymentPackages } | |||
const newPackages = cloneDeep(packages) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
going with clone deep adds a (small) dependency but makes the implementation clearer and less error prone
// unlikely | ||
throw new Error(`Failed to rename the action '${key}/${actionName}' to '${key}/${renamedAction}': an action with the same name exists already.`) | ||
} | ||
|
||
// copy actions to the new package and move the action content to the new key | ||
newPackages[key]['actions'] = { | ||
...packages[key]['actions'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here was the problem as we were overriding any previous action rewrites
Description
The current implementation of require-adobe-auth is not working when multiple actions in the same action use the annotation.
This is a fix for it using lodash.clonedeep.
Types of changes
Checklist: