-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(core): add include property specifying particular files for assets #26365
Conversation
chore: fingerprint fix: comments separate includes chore: new line chore: new line chore: new line feat: mkdir before symlinkSync
* | ||
* @default - everything is included | ||
*/ | ||
readonly include?: string[]; |
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.
I think it would help to add some more detail here.
- How does this interact with
exclude
? That is, if a file matches something ininclude
andexclude
, what happens? My assumption is thatexclude
takes priority but it would be nice to mention that explicitly. - How does this interact with symlinks when using a
SymlinkFollowMode
other thanNEVER
? That is, if I include the symlink but not its target, what happens?
It would also be good to add test cases for these points.
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.
Thanks! I added the docs and tests.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Can't we just use include: ['index.py'],
// this should be equivalent to the following
exclude: ['*', '!index.py'] I am not entirely convinced that it is a good idea to have both include and exclude properties, because it is not clear what the priority is between include and exclude, and how to handle files that do not match both include and exclude, which will confuse users. |
@tmokmss Negative exclusions aren't even documented. If that's going to be the solution (which I don't like because it's more confusing to have to think in terms of double negation), then the docs still should be amended. |
@rittneje aws-cdk/packages/aws-cdk-lib/core/lib/fs/ignore.ts Lines 122 to 124 in eea223b
I think using a negation in ignore files (like .gitignore or .dockerignore) is a common pattern, but yeah, we might need a clearer doc on this. |
@tmokmss Hmmm, I was confused too, but you may be right! Then I would close this PR. |
As for the document, I'll consider it in another PR. |
I submitted the PR for the docs of |
We discussed for the need to document `exclude` patterns using a negation in [the PR](#26365 (comment)). I also could not find documentation for the `exclude` property itself, so I added them. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
We discussed for the need to document `exclude` patterns using a negation in [the PR](aws#26365 (comment)). I also could not find documentation for the `exclude` property itself, so I added them. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This PR adds an
include
property including particular files for assets such aslambda.Code.fromAsset
.include
parameter tointerface FileOptions
withexclude
.include
along withignores
(actuallyexclude
) incopyDirectory
, where the actual file search is done.Closes #26107.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license