Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
New method for determining renderer package name (#1432)
Browse files Browse the repository at this point in the history
Override renderer package for post purchase extensions
  • Loading branch information
t6d authored Aug 9, 2021
1 parent 28c7f7a commit a4b2f02
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased
------

* [1432](https://github.com/Shopify/shopify-cli/pull/1432) New method for determining renderer package name

Version 2.2.0
------
* [#1424](https://github.com/Shopify/shopify-cli/pull/1424/): Add `--resourceUrl` flag to extension serve command
Expand Down
1 change: 0 additions & 1 deletion lib/project_types/extension/commands/push.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class Push < ExtensionCommand
def call(args, name)
Command::Register.new(@ctx).call(args, name) unless project.registered?
Command::Build.new(@ctx).call(args, name) unless specification_handler.specification.options[:skip_build]

CLI::UI::Frame.open(@ctx.message("push.frame_title")) do
updated_draft_version = update_draft
show_message(updated_draft_version)
Expand Down
12 changes: 1 addition & 11 deletions lib/project_types/extension/features/argo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ class Argo
YARN_RUN_SCRIPT_NAME = %w(build).freeze
private_constant :YARN_INSTALL_COMMAND, :YARN_INSTALL_PARAMETERS, :YARN_RUN_COMMAND, :YARN_RUN_SCRIPT_NAME

UI_EXTENSIONS_CHECKOUT = "@shopify/checkout-ui-extensions"
UI_EXTENSIONS_ADMIN = "@shopify/admin-ui-extensions"
UI_EXTENSIONS_POST_PURCHASE = "@shopify/post-purchase-ui-extensions"

PACKAGE_NAMES = [
UI_EXTENSIONS_CHECKOUT,
UI_EXTENSIONS_ADMIN,
UI_EXTENSIONS_POST_PURCHASE,
].freeze

def create(directory_name, identifier, context)
Features::ArgoSetup.new(git_template: git_template).call(directory_name, identifier, context)
end
Expand All @@ -54,7 +44,7 @@ def config(context)
def renderer_package(context)
js_system = ShopifyCli::JsSystem.new(ctx: context)
Tasks::FindNpmPackages
.exactly_one_of(*PACKAGE_NAMES, js_system: js_system)
.exactly_one_of(renderer_package_name, js_system: js_system)
.unwrap { |err| raise err }
rescue Extension::PackageResolutionFailed
context.abort(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@ module Models
module SpecificationHandlers
class CheckoutPostPurchase < Default
PERMITTED_CONFIG_KEYS = [:metafields]
RENDERER_PACKAGE_NAME = "@shopify/post-purchase-ui-extensions"

def config(context)
{
**Features::ArgoConfig.parse_yaml(context, PERMITTED_CONFIG_KEYS),
**argo.config(context),
}
end

protected

def argo
Features::Argo.new(
git_template: specification.features.argo.git_template,
renderer_package_name: RENDERER_PACKAGE_NAME
)
end
end
end
end
Expand Down

0 comments on commit a4b2f02

Please sign in to comment.