Skip to content

Conversation

@kairosci
Copy link

Fix: Respect .gitignore when discovering web and extension configurations

Resolves #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

  • Implement gitignore filtering for web directories
  • Implement gitignore filtering for extension directories
  • Add comprehensive tests
  • Fix linting issues
  • All tests pass ✓

Changes Made

Modified packages/app/src/cli/models/app/loader.ts:

  1. Added filterIgnoredPaths helper function - Reads .gitignore if it exists and filters paths using the ignore package
  2. Updated loadWebs function - Applies gitignore filtering before loading web configs
  3. Updated createExtensionInstances function - 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/dev not available in CI
  • Acceptance tests: Require Shopify credentials not available in CI

These are pre-existing environment issues unrelated to these changes.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@kairosci
Copy link
Author

i signed CLA, but system doesn't recognize

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2026

This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action.
→ If there's no activity within a week, then a bot will automatically close this.
Thanks for helping to improve Shopify's dev tooling and experience.

@kairosci
Copy link
Author

kairosci commented Jan 4, 2026

Ping

Copy link
Contributor

@graygilmore graygilmore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Can you:

  • Rebase your changes to fix merge conflicts and ensure you're basing this off of the latest code
  • Remove some of the package.json changes and other manual version bump changes (this happens automatically in our CI when we release a new version of the package)

Copilot AI review requested due to automatic review settings January 5, 2026 20:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds .gitignore filtering to the discovery process for web and extension configurations, resolving an issue where shopify app deploy and shopify app dev commands fail when multiple configuration files exist in gitignored directories (e.g., git worktrees, build artifacts).

Key changes:

  • Added a filterIgnoredPaths helper function that reads and applies .gitignore patterns
  • Updated web configuration discovery to filter out gitignored paths
  • Updated extension configuration discovery to filter out gitignored paths

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/app/src/cli/models/app/loader.ts Implements gitignore filtering by adding the filterIgnoredPaths function and integrating it into both loadWebs and createExtensionInstances methods to exclude gitignored directories from discovery
packages/app/src/cli/models/app/loader.test.ts Adds comprehensive test coverage for the new gitignore filtering functionality, including tests for web blocks and extensions in gitignored directories, plus backward compatibility tests when no .gitignore exists

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


test('ignores web blocks in gitignored directories', async () => {
// Given
const {webDirectory} = await writeConfig(appConfiguration)
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable webDirectory.

Suggested change
const {webDirectory} = await writeConfig(appConfiguration)
await writeConfig(appConfiguration)

Copilot uses AI. Check for mistakes.

test('loads all web blocks when no .gitignore file exists', async () => {
// Given
const {webDirectory} = await writeConfig(appConfiguration)
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable webDirectory.

Suggested change
const {webDirectory} = await writeConfig(appConfiguration)
await writeConfig(appConfiguration)

Copilot uses AI. Check for mistakes.
@kairosci kairosci requested a review from graygilmore January 5, 2026 21:24
Copy link
Contributor

@graygilmore graygilmore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking better! Just need a changelog entry and this should be good to go. I'll run the CI in another PR.

@graygilmore graygilmore mentioned this pull request Jan 6, 2026
@graygilmore
Copy link
Contributor

Would you mind also cleaning up the commits so that we don't have both Version Packages and Merge branch 'main' into main. You should be able to clear those up with a Git rebase.

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.

[Bug]: shopify app deploy doesn't recognize web_directories argument

2 participants