-
Notifications
You must be signed in to change notification settings - Fork 157
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
Improve mechanism that adds .shopify
to .gitignore
to avoid duplicate entries
#5314
Conversation
Coverage report
Show files with reduced coverage 🔻
Test suite run success2034 tests passing in 909 suites. Report generated by 🧪jest coverage report action from da606a6 |
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.
Great idea using ignore
👌
const ignoreManager = ignore.default({allowRelativePaths: true}).add(lines) | ||
|
||
const isIgnoredEntry = ignoreManager.ignores(joinPath(entry)) | ||
const isIgnoredEntryAsDir = ignoreManager.ignores(joinPath(entry, 'ignored.txt')) |
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.
What's ignored.txt
?
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.
It's a mocked file entry that supports the following two test scenarios:
- does nothing when .shopify/* pattern exists in .gitignore
- does nothing when .shopify/** pattern exists in .gitignore
The ignore package doesn't interact with the file system; it just analyzes paths and patterns. This mocked entry helps us ensure that .shopify/*
and .shopify/**
are really working as expected.
c865c3f
to
8eb0b1e
Compare
8eb0b1e
to
da606a6
Compare
(I rebased the branch and fixed |
WHY are these changes introduced?
Fixes #5286
WHAT is this pull request doing?
Instead of manipulating raw strings, now
addToGitIgnore
uses theignore
module (already being used by apps), so we may prevent equivalent patterns from being added.It's important to notice though, that not all patterns reported on Fixes #5286 are equivalent as we may notice in the screenshot below:
How to test your changes?
shopify theme metafields pull
.shopify/metafields.json
.shopify
entry from.gitignore
.shopify/metafields.json
file is created, an entry is also added in the.gitignore
Post-release steps
N/A
Measuring impact
How do we know this change was effective? Please choose one:
Checklist