Skip to content

Config files not copied when using shopify theme component dev --theme-path #10

@lcottingham

Description

@lcottingham

Problem description

When running shopify theme component dev --theme-path="." (or any theme path), the generated .dev folder contains empty config files (settings_data.json and settings_schema.json) instead of copying the existing config files from the specified theme directory. This prevents developers from testing components with actual theme settings during development.

Environment

  • Collection repository: theme directory
  • Branch name: main
  • CLI version: 1.0.4
  • Operating system: macOS
  • Node.js version: 22

Steps to reproduce

  1. Navigate to a Shopify theme directory with populated config/settings_data.json and config/settings_schema.json files
  2. Run command shopify theme component dev --theme-path="."
  3. Check the generated .dev/config/ directory
  4. Open .dev/config/settings_data.json and .dev/config/settings_schema.json
  5. See that both files exist but contain empty objects/arrays instead of the theme's actual configuration

Expected behavior

When using the --theme-path flag, the plugin should copy the existing config files from the specified theme directory to the .dev folder, preserving all theme settings and configurations. This would allow developers to test components with real theme settings (colors, fonts, typography, etc.) in the development environment.

Actual behavior

The plugin creates the following empty files:

  • .dev/config/settings_data.json contains: {}
  • .dev/config/settings_schema.json contains: []

Theme settings are not available in the component development environment, making it impossible to test components that depend on theme configurations.

Additional context

  • This issue is critical for teams maintaining multiple theme variants (e.g., regional versions) where components need to be tested against different configurations
  • Current workaround requires manually copying files after each dev command:
cp config/settings_data.json .dev/config/
cp config/settings_schema.json .dev/config/

Potential fix

When the --theme-path flag is provided, the plugin should:

if (options.themePath) {
  // Copy config files from theme to dev environment
  copyFile(
    path.join(themePath, 'config/settings_data.json'),
    path.join(devPath, 'config/settings_data.json')
  );
  copyFile(
    path.join(themePath, 'config/settings_schema.json'),
    path.join(devPath, 'config/settings_schema.json')
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions