Sha256: 51a45fa0bc0f5978c30b5a2e3bd8e1bd980b87170e77f80962ff1c45c6f52ed3

Contents?: true

Size: 1 KB

Versions: 23

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

module ThemeCheck
  # Reports missing shopify required theme files
  # required templates: https://shopify.dev/tutorials/review-theme-store-requirements-files
  class MissingRequiredTemplateFiles < LiquidCheck
    severity :error
    category :liquid
    doc docs_url(__FILE__)

    REQUIRED_LIQUID_FILES = %w(layout/theme)
    REQUIRED_TEMPLATE_FILES = %w(
      index product collection cart blog article page list-collections search 404
      gift_card customers/account customers/activate_account customers/addresses
      customers/login customers/order customers/register customers/reset_password password
    )
      .map { |file| "templates/#{file}" }

    def on_end
      (REQUIRED_LIQUID_FILES - theme.liquid.map(&:name)).each do |file|
        add_offense("'#{file}.liquid' is missing")
      end
      (REQUIRED_TEMPLATE_FILES - (theme.liquid + theme.json).map(&:name)).each do |file|
        add_offense("'#{file}.liquid' or '#{file}.json' is missing")
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
theme-check-1.5.2 lib/theme_check/checks/missing_required_template_files.rb
theme-check-1.5.1 lib/theme_check/checks/missing_required_template_files.rb
theme-check-1.5.0 lib/theme_check/checks/missing_required_template_files.rb
theme-check-1.4.0 lib/theme_check/checks/missing_required_template_files.rb
theme-check-1.3.0 lib/theme_check/checks/missing_required_template_files.rb
theme-check-1.2.0 lib/theme_check/checks/missing_required_template_files.rb
theme-check-1.1.0 lib/theme_check/checks/missing_required_template_files.rb
theme-check-1.0.0 lib/theme_check/checks/missing_required_template_files.rb
theme-check-0.10.2 lib/theme_check/checks/missing_required_template_files.rb
theme-check-0.10.1 lib/theme_check/checks/missing_required_template_files.rb
theme-check-0.10.0 lib/theme_check/checks/missing_required_template_files.rb
theme-check-0.9.1 lib/theme_check/checks/missing_required_template_files.rb
theme-check-0.9.0 lib/theme_check/checks/missing_required_template_files.rb
theme-check-0.8.3 lib/theme_check/checks/missing_required_template_files.rb
theme-check-0.8.2 lib/theme_check/checks/missing_required_template_files.rb
theme-check-0.8.1 lib/theme_check/checks/missing_required_template_files.rb
theme-check-0.8.0 lib/theme_check/checks/missing_required_template_files.rb
theme-check-0.7.3 lib/theme_check/checks/missing_required_template_files.rb
theme-check-0.7.2 lib/theme_check/checks/missing_required_template_files.rb
theme-check-0.7.1 lib/theme_check/checks/missing_required_template_files.rb