Skip to content

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

Merged
vividviolet merged 1 commit into
mainfrom
04-23-allow_preserving_file_paths_when_including_assets_from_config_key_entry
Apr 29, 2026
Merged

Allow preserving file paths when including assets from config key entry#7389
vividviolet merged 1 commit into
mainfrom
04-23-allow_preserving_file_paths_when_including_assets_from_config_key_entry

Conversation

@vividviolet

@vividviolet vividviolet commented Apr 24, 2026

Copy link
Copy Markdown
Member

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

vividviolet commented Apr 24, 2026

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

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
@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 5deb0e5 to fa4818d Compare April 27, 2026 13:14
@vividviolet vividviolet force-pushed the 04-23-allow_preserving_file_paths_when_including_assets_from_config_key_entry branch 2 times, most recently from 3300a22 to d17d0ed Compare April 27, 2026 13:36
@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 fa4818d to c81189a Compare April 27, 2026 13:36
@github-actions

Copy link
Copy Markdown
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/cli-launcher.d.ts
@@ -1,8 +1,6 @@
-import type { LazyCommandLoader } from './custom-oclif-loader.js';
 interface Options {
     moduleURL: string;
     argv?: string[];
-    lazyCommandLoader?: LazyCommandLoader;
 }
 /**
  * Launches the CLI.
packages/cli-kit/dist/public/node/cli.d.ts
@@ -1,4 +1,3 @@
-import type { LazyCommandLoader } from './custom-oclif-loader.js';
 /**
  * IMPORTANT NOTE: Imports in this module are dynamic to ensure that "setupEnvironmentVariables" can dynamically
  * set the DEBUG environment variable before the 'debug' package sets up its configuration when modules
@@ -8,8 +7,6 @@ interface RunCLIOptions {
     /** The value of import.meta.url of the CLI executable module */
     moduleURL: string;
     development: boolean;
-    /** Optional lazy command loader for on-demand command loading */
-    lazyCommandLoader?: LazyCommandLoader;
 }
 /**
  * A function that abstracts away setting up the environment and running
@@ -20,7 +17,6 @@ export declare function runCLI(options: RunCLIOptions & {
     runInCreateMode?: boolean;
 }, launchCLI?: (options: {
     moduleURL: string;
-    lazyCommandLoader?: LazyCommandLoader;
 }) => Promise<void>, argv?: string[], env?: NodeJS.ProcessEnv, versions?: NodeJS.ProcessVersions): Promise<void>;
 /**
  * A function for create-x CLIs that automatically runs the "init" command.
@@ -42,5 +38,5 @@ export declare const jsonFlag: {
 /**
  * Clear the CLI cache, used to store some API responses and handle notifications status
  */
-export declare function clearCache(): Promise<void>;
+export declare function clearCache(): void;
 export {};
\ No newline at end of file

@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 c81189a to 55dad85 Compare April 27, 2026 19:36
@elanalynn elanalynn force-pushed the 04-23-allow_preserving_file_paths_when_including_assets_from_config_key_entry branch from d17d0ed to 5925ae9 Compare April 27, 2026 19:36
@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 55dad85 to 2cf0f84 Compare April 27, 2026 20:37
@elanalynn elanalynn force-pushed the 04-23-allow_preserving_file_paths_when_including_assets_from_config_key_entry branch from 5925ae9 to 130ce28 Compare April 27, 2026 20:37
Comment thread packages/app/src/cli/services/build/steps/include-assets/copy-config-key-entry.ts Outdated
@vividviolet vividviolet changed the base branch from 04-23-fix_dev_server_to_allow_serving_static_assets_from_a_shared_folder_outside_of_the_extension_directory to graphite-base/7389 April 29, 2026 16:25
@vividviolet vividviolet force-pushed the 04-23-allow_preserving_file_paths_when_including_assets_from_config_key_entry branch from 130ce28 to a28af28 Compare April 29, 2026 16:25
@vividviolet vividviolet changed the base branch from graphite-base/7389 to main April 29, 2026 16:25
@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Apr 29, 2026
@vividviolet vividviolet force-pushed the 04-23-allow_preserving_file_paths_when_including_assets_from_config_key_entry branch from a28af28 to 1809a56 Compare April 29, 2026 21:11
@vividviolet

Copy link
Copy Markdown
Member Author

/snapit

@vividviolet vividviolet enabled auto-merge April 29, 2026 22:19
@vividviolet vividviolet added this pull request to the merge queue Apr 29, 2026
Merged via the queue into main with commit 3a4bf9c Apr 29, 2026
52 of 53 checks passed
@vividviolet vividviolet deleted the 04-23-allow_preserving_file_paths_when_including_assets_from_config_key_entry branch April 29, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:48450 no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants