Fix: Respect .gitignore when discovering web and extension configurations
Fix: Respect .gitignore when discovering web and extension configurations
Resolves https://github.com/Shopify/cli/issues/6518
Problem
The shopify app deploy and shopify app dev commands fail when there are multiple shopify.web.toml files in gitignored directories (e.g., git worktrees, build artifacts, tmp directories). The CLI currently searches through ALL subdirectories and only excludes node_modules.
Solution
- [x] Implement gitignore filtering for web directories
- [x] Implement gitignore filtering for extension directories
- [x] Add comprehensive tests
- [x] Fix linting issues
- [x] All tests pass ✓
Changes Made
Modified packages/app/src/cli/models/app/loader.ts:
- Added
filterIgnoredPathshelper function - Reads.gitignoreif it exists and filters paths using theignorepackage - Updated
loadWebsfunction - Applies gitignore filtering before loading web configs - Updated
createExtensionInstancesfunction - Applies gitignore filtering before loading extensions
Added tests in packages/app/src/cli/models/app/loader.test.ts:
- Web blocks in gitignored directories are excluded
- All web blocks load when no .gitignore exists (backward compatibility)
- Extensions in gitignored directories are excluded
Test Results
✅ Lint passes (0 errors, 38 pre-existing warnings) ✅ All 138 loader tests pass ✅ Manual verification confirms gitignored directories are properly excluded
Note on CI
Some CI jobs may fail due to infrastructure issues:
- graphql-codegen: Requires
/opt/dev/bin/devnot available in CI - Acceptance tests: Require Shopify credentials not available in CI
These are pre-existing environment issues unrelated to these changes.
i signed CLA, but system doesn't recognize