Sha256: e9213d60c5649199bd56638b86bfffb4754e3364aefbae20195b9e89838afe22
Contents?: true
Size: 1.36 KB
Versions: 8
Compression:
Stored size: 1.36 KB
Contents
require 'shopify_cli' require 'json' module Node module Commands class Generate class Webhook < ShopifyCli::SubCommand def call(args, _name) selected_type = args.first schema = ShopifyCli::AdminAPI::Schema.get(@ctx) webhooks = schema.get_names_from_type('WebhookSubscriptionTopic') unless selected_type && webhooks.include?(selected_type) selected_type = CLI::UI::Prompt.ask(@ctx.message('node.generate.webhook.type_select')) do |handler| webhooks.each do |type| handler.option(type) { type } end end end generate_path = File.join(ShopifyCli::Project.current.directory, "node_modules/.bin/generate-node-app") generate_path = "\"#{generate_path}\"" spin_group = CLI::UI::SpinGroup.new spin_group.add(@ctx.message('node.generate.webhook.generating', selected_type)) do |spinner| Node::Commands::Generate.run_generate("#{generate_path} webhook #{selected_type}", selected_type, @ctx) spinner.update_title(@ctx.message('node.generate.webhook.generated', selected_type)) end spin_group.wait end def self.help ShopifyCli::Context.message('node.generate.webhook.help', ShopifyCli::TOOL_NAME) end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems