Skip to content

Allow preserving file paths when including assets from config key entry#7389

Open
vividviolet wants to merge 1 commit into04-23-fix_dev_server_to_allow_serving_static_assets_from_a_shared_folder_outside_of_the_extension_directoryfrom
04-23-allow_preserving_file_paths_when_including_assets_from_config_key_entry
Open

Allow preserving file paths when including assets from config key entry#7389
vividviolet wants to merge 1 commit into04-23-fix_dev_server_to_allow_serving_static_assets_from_a_shared_folder_outside_of_the_extension_directoryfrom
04-23-allow_preserving_file_paths_when_including_assets_from_config_key_entry

Conversation

@vividviolet
Copy link
Copy Markdown
Member

@vividviolet vividviolet commented Apr 24, 2026

WHY are these changes introduced?

When multiple configKey entries reference different source directories or files that produce the same output-relative path, the last writer silently wins. This makes it impossible to detect accidental file collisions when directory structures need to be preserved in the output.

WHAT is this pull request doing?

Adds a preserveFilePaths option (default false) to configKey inclusion entries. When enabled:

  • Files are written to the output directory preserving their relative paths from the source directory, rather than being flattened to unique basenames.
  • A collision check is enforced across all entries in the same build: if two different sources would produce the same output-relative file path, an error is thrown immediately with a descriptive message indicating which file caused the conflict.
  • A shared usedFiles set is threaded through all configKey entries so cross-entry collisions are detected, not just within-entry ones.
  • The existing usedBasenames deduplication logic is preserved for entries where preserveFilePaths is false.

The collision check is extracted into a single assertNoCollision helper used by both the directory and single-file copy branches.

How to test your changes?

Unit tests should be sufficient

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

Copy link
Copy Markdown
Member Author

vividviolet commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

/snapit

@github-actions
Copy link
Copy Markdown
Contributor

🫰✨ Thanks @melissaluu! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260424162325

Caution

After installing, validate the version by running shopify version in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

@vividviolet vividviolet force-pushed the 04-23-allow_preserving_file_paths_when_including_assets_from_config_key_entry branch from 37b6c5f to f653639 Compare April 24, 2026 21:53
@vividviolet vividviolet force-pushed the 04-23-fix_dev_server_to_allow_serving_static_assets_from_a_shared_folder_outside_of_the_extension_directory branch from 5fa082f to 26c602f Compare April 24, 2026 21:53
@vividviolet
Copy link
Copy Markdown
Member Author

/snapit

@github-actions
Copy link
Copy Markdown
Contributor

🫰✨ Thanks @vividviolet! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260424215600

Caution

After installing, validate the version by running shopify version in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

@elanalynn elanalynn force-pushed the 04-23-fix_dev_server_to_allow_serving_static_assets_from_a_shared_folder_outside_of_the_extension_directory branch from 26c602f to 5deb0e5 Compare April 24, 2026 23:15
@elanalynn elanalynn force-pushed the 04-23-allow_preserving_file_paths_when_including_assets_from_config_key_entry branch from f653639 to d862233 Compare April 24, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants