core: add multiple aspects at a time
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 71
Description
### Describe the feature
Update the `add` command for Aspects to add multiple Aspects at a time
### Use Case
I often find myself adding multiple Aspects to a scope, which leads to a lot of `Aspects.of(scope).add()`lines in my code.
It would be nice to only have to add that line once
### Proposed Solution
Update the current implementation
from this
```ts
/**
* Adds an aspect to apply this scope before synthesis.
* @param aspect The aspect to add.
*/
public add(aspect: IAspect) {
this._aspects.push(aspect);
}
```
to this
```ts
/**
* Adds aspects to apply this scope before synthesis.
* @param aspect The aspects to add.
*/
public add(...aspect: IAspect[]) {
this._aspects.push(...aspect);
}
```
### Other Information
_No response_
### Acknowledgements
- [X] I may be able to implement this feature request
- [x] This feature might incur a breaking change
### CDK version used
v2.69.0
### Environment details (OS name and version, etc.)
N/A
Contributor guide
Research direction
Locate the Aspects implementation containing the add(aspect: IAspect) method and inspect nearby tests or usages. Update the API to accept multiple aspects while preserving single-aspect calls, then verify that each supplied aspect is added to the scope and that the relevant tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- infrastructure
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100