Skip to content
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: handling !pattern in gitignore to avoid excluding everything from watching in sandbox #671

Merged
merged 2 commits into from
Nov 16, 2023

Conversation

Amplifiyer
Copy link
Contributor

Description of changes:
A ! pattern have different meanings for .gitignore and glob pattern (used in sandbox excludes).

The ! pattern in gitignore means explicitly to add back (i.e. include) the file/folder immediately followed by ! if other more generic patterns are excluding it.

However in glob patterns, ! pattern means include everything but the file/folder immediately followed by !

As an example for a .gitignore file

...
output
!output/file-i-want-to-check-in.ts
...

If this file is fed to the sandbox's watcher exclude, it will essentially means exclude everything but file-i-want-to-check-in.ts overriding the src, amplify directories and everything else.

sandbox's watcher include doesn't allow glob patterns, so we can't add these patterns in the include section.

As a short term solution, in this PR, we detect presence of ! and ignore them such that it gets neither "specifically included" or exclude everything from watching and we tell customers that we are explicitly not watching a certain set of files.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

changeset-bot bot commented Nov 16, 2023

🦋 Changeset detected

Latest commit: 6766571

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-amplify/sandbox Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Amplifiyer Amplifiyer merged commit 730afd8 into aws-amplify:main Nov 16, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants