Sha256: 82c9d088d3d5e50c27a93edf4db8a0fdf04abbb9c47c10a31755fcd7a1c27292
Contents?: true
Size: 1.3 KB
Versions: 17
Compression:
Stored size: 1.3 KB
Contents
module ShopifyCLI module Services module App module Serve class NodeService < BaseService attr_accessor :host, :port, :context def initialize(host:, port:, context:) @host = host @port = port @context = context super() end def call project = ShopifyCLI::Project.current url = host || ShopifyCLI::Tunnel.start(context, port: port) raise ShopifyCLI::Abort, context.message("core.app.serve.error.host_must_be_https") if url.match(/^https/i).nil? project.env.update(context, :host, url) ShopifyCLI::Tasks::UpdateDashboardURLS.call( context, url: url, callback_url: "/auth/callback", ) if project.env.shop project_url = "#{project.env.host}/auth?shop=#{project.env.shop}" context.puts("\n" + context.message("core.app.serve.open_info", project_url) + "\n") end CLI::UI::Frame.open(context.message("core.app.serve.running_server")) do env = project.env.to_h env["PORT"] = port.to_s context.system("npm run dev", env: env) end end end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems