shopify-cli 2.6.6 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer.json +5 -0
  3. data/.github/DESIGN.md +1 -1
  4. data/.github/ISSUE_TEMPLATE.md +7 -0
  5. data/.vscode/extensions.json +5 -0
  6. data/.vscode/settings.json +9 -0
  7. data/CHANGELOG.md +12 -3
  8. data/CONTRIBUTING.md +1 -29
  9. data/{Dockerfile → Codespace.dockerfile} +0 -0
  10. data/Gemfile.lock +4 -4
  11. data/README.md +20 -99
  12. data/Tests.dockerfile +35 -0
  13. data/assets/logo.png +0 -0
  14. data/dev.yml +0 -3
  15. data/docs/README.md +13 -0
  16. data/docs/contributors/testing.md +27 -0
  17. data/docs/users/installation.md +46 -0
  18. data/{THEMEKIT_MIGRATION.md → docs/users/migrate-from-themekit.md} +1 -1
  19. data/lib/project_types/extension/cli.rb +6 -3
  20. data/lib/project_types/extension/commands/create.rb +5 -6
  21. data/lib/project_types/extension/commands/extension_command.rb +1 -1
  22. data/lib/project_types/extension/features/argo_serve.rb +9 -23
  23. data/lib/project_types/extension/forms/questions/ask_template.rb +1 -5
  24. data/lib/project_types/extension/models/development_server_requirements.rb +2 -3
  25. data/lib/project_types/extension/models/server_config/app.rb +13 -0
  26. data/lib/project_types/extension/models/server_config/development.rb +5 -4
  27. data/lib/project_types/extension/models/server_config/development_renderer.rb +1 -1
  28. data/lib/project_types/extension/models/server_config/development_resource.rb +13 -0
  29. data/lib/project_types/extension/models/server_config/extension.rb +3 -1
  30. data/lib/project_types/extension/models/server_config/root.rb +4 -1
  31. data/lib/project_types/extension/tasks/convert_server_config.rb +65 -0
  32. data/lib/project_types/extension/tasks/ensure_resource_url.rb +39 -0
  33. data/lib/project_types/extension/tasks/merge_server_config.rb +32 -0
  34. data/lib/project_types/extension/tasks/run_extension_command.rb +10 -9
  35. data/lib/project_types/node/cli.rb +0 -16
  36. data/lib/project_types/node/forms/create.rb +5 -5
  37. data/lib/project_types/node/messages/messages.rb +2 -144
  38. data/lib/project_types/php/cli.rb +0 -11
  39. data/lib/project_types/php/forms/create.rb +5 -6
  40. data/lib/project_types/php/messages/messages.rb +2 -161
  41. data/lib/project_types/rails/cli.rb +0 -16
  42. data/lib/project_types/rails/commands/create.rb +1 -1
  43. data/lib/project_types/rails/forms/create.rb +5 -6
  44. data/lib/project_types/rails/messages/messages.rb +6 -151
  45. data/lib/project_types/script/cli.rb +1 -1
  46. data/lib/project_types/script/commands/create.rb +1 -1
  47. data/lib/project_types/script/commands/push.rb +1 -1
  48. data/lib/project_types/theme/cli.rb +1 -1
  49. data/lib/project_types/theme/commands/check.rb +1 -1
  50. data/lib/project_types/theme/commands/delete.rb +1 -1
  51. data/lib/project_types/theme/commands/init.rb +1 -1
  52. data/lib/project_types/theme/commands/language_server.rb +1 -1
  53. data/lib/project_types/theme/commands/package.rb +1 -1
  54. data/lib/project_types/theme/commands/publish.rb +1 -1
  55. data/lib/project_types/theme/commands/pull.rb +1 -1
  56. data/lib/project_types/theme/commands/push.rb +1 -1
  57. data/lib/project_types/theme/commands/serve.rb +9 -3
  58. data/lib/project_types/theme/messages/messages.rb +5 -1
  59. data/lib/shopify_cli/admin_api/populate_resource_command.rb +1 -1
  60. data/lib/shopify_cli/api.rb +7 -2
  61. data/lib/shopify_cli/app_type_detector.rb +24 -20
  62. data/lib/shopify_cli/command/app_sub_command.rb +10 -0
  63. data/lib/shopify_cli/command/project_command.rb +18 -0
  64. data/lib/shopify_cli/command/sub_command.rb +19 -0
  65. data/lib/shopify_cli/command.rb +7 -2
  66. data/lib/shopify_cli/commands/app/connect.rb +22 -0
  67. data/lib/shopify_cli/commands/app/create/node.rb +38 -0
  68. data/lib/shopify_cli/commands/app/create/php.rb +36 -0
  69. data/lib/shopify_cli/commands/app/create/rails.rb +40 -0
  70. data/lib/shopify_cli/commands/app/create.rb +28 -0
  71. data/lib/shopify_cli/commands/app/deploy.rb +49 -0
  72. data/lib/shopify_cli/commands/app/open.rb +19 -0
  73. data/lib/shopify_cli/commands/app/serve.rb +49 -0
  74. data/lib/shopify_cli/commands/app/tunnel.rb +43 -0
  75. data/lib/shopify_cli/commands/app.rb +29 -0
  76. data/lib/shopify_cli/commands/config.rb +2 -2
  77. data/lib/shopify_cli/commands.rb +1 -0
  78. data/lib/shopify_cli/constants.rb +4 -0
  79. data/lib/shopify_cli/exception_reporter.rb +3 -4
  80. data/lib/shopify_cli/git.rb +12 -1
  81. data/lib/shopify_cli/github/issue_url_generator.rb +19 -0
  82. data/lib/shopify_cli/github.rb +5 -0
  83. data/lib/shopify_cli/messages/messages.rb +252 -8
  84. data/lib/shopify_cli/project.rb +5 -1
  85. data/lib/shopify_cli/project_commands.rb +1 -1
  86. data/lib/shopify_cli/services/app/connect_service.rb +25 -0
  87. data/lib/shopify_cli/services/app/create/node_service.rb +153 -0
  88. data/lib/shopify_cli/services/app/create/php_service.rb +152 -0
  89. data/lib/shopify_cli/services/app/create/rails_service.rb +213 -0
  90. data/lib/shopify_cli/services/app/deploy/heroku/node_service.rb +101 -0
  91. data/lib/shopify_cli/services/app/deploy/heroku/php_service.rb +135 -0
  92. data/lib/shopify_cli/services/app/deploy/heroku/rails_service.rb +120 -0
  93. data/lib/shopify_cli/services/app/open_service.rb +19 -0
  94. data/lib/shopify_cli/services/app/serve/node_service.rb +42 -0
  95. data/lib/shopify_cli/services/app/serve/php_service.rb +46 -0
  96. data/lib/shopify_cli/services/app/serve/rails_service.rb +48 -0
  97. data/lib/shopify_cli/services/app/tunnel/auth_service.rb +21 -0
  98. data/lib/shopify_cli/services/app/tunnel/start_service.rb +20 -0
  99. data/lib/shopify_cli/services/app/tunnel/stop_service.rb +20 -0
  100. data/lib/shopify_cli/services.rb +31 -0
  101. data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
  102. data/lib/shopify_cli/theme/dev_server.rb +8 -2
  103. data/lib/shopify_cli/version.rb +1 -1
  104. data/lib/shopify_cli.rb +1 -2
  105. data/shopify-cli.gemspec +1 -1
  106. data/shopify-dev +18 -0
  107. data/utilities/constants.rb +7 -0
  108. data/utilities/docker/container.rb +10 -3
  109. data/utilities/docker.rb +2 -2
  110. data/utilities/utilities.rb +1 -0
  111. metadata +49 -48
  112. data/docs/_config.yml +0 -2
  113. data/docs/app/node/commands/index.md +0 -4
  114. data/docs/app/node/index.md +0 -4
  115. data/docs/app/rails/commands/index.md +0 -4
  116. data/docs/app/rails/index.md +0 -4
  117. data/docs/core/index.md +0 -4
  118. data/docs/getting-started/index.md +0 -4
  119. data/docs/getting-started/install/index.md +0 -4
  120. data/docs/getting-started/migrate/index.md +0 -4
  121. data/docs/getting-started/uninstall/index.md +0 -4
  122. data/docs/getting-started/upgrade/index.md +0 -4
  123. data/docs/help/start-app/index.md +0 -4
  124. data/docs/index.md +0 -4
  125. data/install.sh +0 -7
  126. data/lib/project_types/extension/tasks/converters/server_config_converter.rb +0 -30
  127. data/lib/project_types/extension/tasks/load_server_config.rb +0 -28
  128. data/lib/project_types/node/commands/connect.rb +0 -21
  129. data/lib/project_types/node/commands/create.rb +0 -125
  130. data/lib/project_types/node/commands/deploy/heroku.rb +0 -96
  131. data/lib/project_types/node/commands/deploy.rb +0 -32
  132. data/lib/project_types/node/commands/generate.rb +0 -22
  133. data/lib/project_types/node/commands/open.rb +0 -18
  134. data/lib/project_types/node/commands/serve.rb +0 -45
  135. data/lib/project_types/node/commands/tunnel.rb +0 -41
  136. data/lib/project_types/php/commands/connect.rb +0 -19
  137. data/lib/project_types/php/commands/create.rb +0 -143
  138. data/lib/project_types/php/commands/deploy/heroku.rb +0 -129
  139. data/lib/project_types/php/commands/deploy.rb +0 -32
  140. data/lib/project_types/php/commands/open.rb +0 -16
  141. data/lib/project_types/php/commands/serve.rb +0 -48
  142. data/lib/project_types/php/commands/tunnel.rb +0 -37
  143. data/lib/project_types/rails/commands/connect.rb +0 -21
  144. data/lib/project_types/rails/commands/deploy/heroku.rb +0 -115
  145. data/lib/project_types/rails/commands/deploy.rb +0 -32
  146. data/lib/project_types/rails/commands/generate/webhook.rb +0 -42
  147. data/lib/project_types/rails/commands/generate.rb +0 -60
  148. data/lib/project_types/rails/commands/open.rb +0 -18
  149. data/lib/project_types/rails/commands/serve.rb +0 -51
  150. data/lib/project_types/rails/commands/tunnel.rb +0 -41
  151. data/lib/shopify_cli/sub_command.rb +0 -17
  152. data/shopify.fish +0 -12
  153. data/shopify.sh +0 -11
@@ -16,7 +16,7 @@ module Extension
16
16
 
17
17
  def self.find(type)
18
18
  case type.downcase
19
- when "admin_ui_extension"
19
+ when "product_subscription"
20
20
  new(name: "@shopify/admin-ui-extensions")
21
21
  when "checkout_ui_extension"
22
22
  new(name: "@shopify/checkout-ui-extensions")
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Extension
4
+ module Models
5
+ module ServerConfig
6
+ class DevelopmentResource < Base
7
+ include SmartProperties
8
+
9
+ property! :url, accepts: String
10
+ end
11
+ end
12
+ end
13
+ end
@@ -10,7 +10,9 @@ module Extension
10
10
  property! :type, accepts: String
11
11
  property! :user, accepts: ServerConfig::User
12
12
  property! :development, accepts: ServerConfig::Development
13
- property :extension_points, accepts: Array
13
+ property :extension_points, accepts: Array
14
+ property :version, accepts: String
15
+ property :title, accepts: String
14
16
 
15
17
  def self.build(uuid: "", template:, type:, root_dir:)
16
18
  renderer = ServerConfig::DevelopmentRenderer.find(type)
@@ -6,8 +6,11 @@ module Extension
6
6
  class Root < Base
7
7
  include SmartProperties
8
8
 
9
- property! :port, accepts: Integer, default: 39351
9
+ property :app, accepts: ServerConfig::App
10
10
  property! :extensions, accepts: Array, default: -> { [] }
11
+ property! :port, accepts: Integer, default: 39351
12
+ property :public_url, accepts: String
13
+ property :store, accepts: String
11
14
 
12
15
  def to_yaml
13
16
  to_h.to_yaml.gsub("---\n", "")
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+ require "shopify_cli"
3
+
4
+ module Extension
5
+ module Tasks
6
+ class ConvertServerConfig
7
+ include SmartProperties
8
+
9
+ property! :api_key, accepts: String
10
+ property! :context, accepts: ShopifyCLI::Context
11
+ property! :hash, accepts: Hash
12
+ property! :registration_uuid, accepts: String
13
+ property :resource_url, accepts: String
14
+ property! :store, accepts: String
15
+ property! :title, accepts: String
16
+ property! :tunnel_url, accepts: String
17
+ property! :type, accepts: String
18
+
19
+ def self.call(*args)
20
+ new(*args).call
21
+ end
22
+
23
+ def call
24
+ context.abort(context.message("tasks.errors.parse_error")) if hash.nil?
25
+
26
+ renderer = Models::ServerConfig::DevelopmentRenderer.find(type)
27
+
28
+ extension = Models::ServerConfig::Extension.new(
29
+ uuid: registration_uuid,
30
+ type: type.upcase,
31
+ user: Models::ServerConfig::User.new,
32
+ development: Models::ServerConfig::Development.new(
33
+ build_dir: hash.dig("development", "build_dir"),
34
+ renderer: renderer,
35
+ entries: Models::ServerConfig::DevelopmentEntries.new(
36
+ main: hash.dig("development", "entries", "main")
37
+ )
38
+ ),
39
+ extension_points: hash.dig("extension_points"),
40
+ version: version(renderer.name, context),
41
+ title: title
42
+ )
43
+
44
+ unless resource_url.nil?
45
+ extension.development.resource = Models::ServerConfig::DevelopmentResource.new(url: resource_url)
46
+ end
47
+ server_config = Models::ServerConfig::Root.new(
48
+ extensions: [extension],
49
+ public_url: tunnel_url,
50
+ store: store
51
+ )
52
+
53
+ unless api_key.nil?
54
+ server_config.app = Models::ServerConfig::App.new(api_key: api_key)
55
+ end
56
+
57
+ server_config
58
+ end
59
+
60
+ def version(renderer, context)
61
+ Tasks::FindPackageFromJson.call(renderer, context: context).version
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+ require "shopify_cli"
3
+
4
+ module Extension
5
+ module Tasks
6
+ class EnsureResourceUrl < ShopifyCLI::Task
7
+ include SmartProperties
8
+
9
+ property! :context, accepts: ShopifyCLI::Context
10
+ property! :specification_handler, accepts: Extension::Models::SpecificationHandlers::Default
11
+
12
+ def self.call(*args)
13
+ new(*args).call
14
+ end
15
+
16
+ def call
17
+ project = ExtensionProject.current(force_reload: true)
18
+
19
+ ShopifyCLI::Result
20
+ .wrap(project.resource_url)
21
+ .rescue { specification_handler.build_resource_url(shop: project.env.shop, context: context) }
22
+ .then(&method(:persist_resource_url))
23
+ .unwrap do |nil_or_exception|
24
+ case nil_or_exception
25
+ when nil
26
+ context.warn(context.message("warnings.resource_url_auto_generation_failed", project.env.shop))
27
+ else
28
+ context.abort(nil_or_exception)
29
+ end
30
+ end
31
+ end
32
+
33
+ def persist_resource_url(resource_url)
34
+ ExtensionProject.update_env_file(context: context, resource_url: resource_url)
35
+ resource_url
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+ require "shopify_cli"
3
+ require "yaml"
4
+
5
+ module Extension
6
+ module Tasks
7
+ class MergeServerConfig < ShopifyCLI::Task
8
+ class << self
9
+ def call(context:, file_name:, resource_url:, tunnel_url:, type:)
10
+ config = YAML.load_file(file_name)
11
+ project = ExtensionProject.current
12
+ Tasks::ConvertServerConfig.call(
13
+ api_key: project.env.api_key,
14
+ context: context,
15
+ hash: config,
16
+ registration_uuid: project.registration_uuid,
17
+ resource_url: resource_url || project.resource_url,
18
+ store: project.env.shop || "",
19
+ title: project.title,
20
+ tunnel_url: tunnel_url,
21
+ type: type
22
+ )
23
+ rescue Psych::SyntaxError => e
24
+ raise(
25
+ ShopifyCLI::Abort,
26
+ ShopifyCLI::Context.message("core.yaml.error.invalid", file_name, e.message)
27
+ )
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -7,10 +7,6 @@ module Extension
7
7
  class RunExtensionCommand < ShopifyCLI::Task
8
8
  include SmartProperties
9
9
 
10
- SUPPORTED_EXTENSION_TYPES = [
11
- "checkout_ui_extension",
12
- ]
13
-
14
10
  SUPPORTED_COMMANDS = [
15
11
  "create",
16
12
  "build",
@@ -18,12 +14,14 @@ module Extension
18
14
  ]
19
15
 
20
16
  property! :command, accepts: SUPPORTED_COMMANDS
21
- property! :type, accepts: SUPPORTED_EXTENSION_TYPES
17
+ property! :type, accepts: Models::DevelopmentServerRequirements::SUPPORTED_EXTENSION_TYPES
22
18
  property :context, accepts: ShopifyCLI::Context
23
19
  property :config_file_name, accepts: String
24
20
  property :port, accepts: Integer, default: 39351
21
+ property :resource_url, accepts: String
25
22
  property :root_dir, accepts: String
26
23
  property :template, accepts: Models::ServerConfig::Development::VALID_TEMPLATES
24
+ property :tunnel_url, accepts: String
27
25
 
28
26
  def call
29
27
  ShopifyCLI::Result.success(config_file_exists?)
@@ -43,14 +41,17 @@ module Extension
43
41
  end
44
42
 
45
43
  def load_or_build_server_config(config_file_exists)
46
- return load_server_config if config_file_exists
44
+ return merge_server_config if config_file_exists
47
45
  build_server_config
48
46
  end
49
47
 
50
- def load_server_config
51
- Tasks::LoadServerConfig.call(
48
+ def merge_server_config
49
+ Tasks::MergeServerConfig.call(
50
+ context: context,
52
51
  file_name: config_file_name,
53
- type: type,
52
+ resource_url: resource_url,
53
+ tunnel_url: tunnel_url,
54
+ type: type
54
55
  )
55
56
  end
56
57
 
@@ -5,22 +5,6 @@ module Node
5
5
  register_messages(Node::Messages::MESSAGES)
6
6
  end
7
7
 
8
- # define/autoload project specific Commands
9
- class Command < ShopifyCLI::ProjectCommands
10
- subcommand :Connect, "connect", Project.project_filepath("commands/connect")
11
- subcommand :Create, "create", Project.project_filepath("commands/create")
12
- subcommand :Deploy, "deploy", Project.project_filepath("commands/deploy")
13
- subcommand :Generate, "generate", Project.project_filepath("commands/generate")
14
- subcommand :Open, "open", Project.project_filepath("commands/open")
15
- subcommand :Serve, "serve", Project.project_filepath("commands/serve")
16
- subcommand :Tunnel, "tunnel", Project.project_filepath("commands/tunnel")
17
- end
18
- ShopifyCLI::Commands.register("Node::Command", "node")
19
-
20
- # define/autoload project specific Tasks
21
- module Tasks
22
- end
23
-
24
8
  # define/autoload project specific Forms
25
9
  module Forms
26
10
  autoload :Create, Project.project_filepath("forms/create")
@@ -4,10 +4,10 @@ module Node
4
4
  module Forms
5
5
  class Create < ShopifyCLI::Form
6
6
  attr_accessor :name
7
- flag_arguments :title, :organization_id, :shop_domain, :type
7
+ flag_arguments :name, :organization_id, :shop_domain, :type
8
8
 
9
9
  def ask
10
- self.title ||= CLI::UI::Prompt.ask(ctx.message("node.forms.create.app_name"))
10
+ self.name ||= CLI::UI::Prompt.ask(ctx.message("node.forms.create.app_name"))
11
11
  self.name = format_name
12
12
  self.type = ask_type
13
13
  res = ShopifyCLI::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
@@ -18,12 +18,12 @@ module Node
18
18
  private
19
19
 
20
20
  def format_name
21
- name = title.downcase.split(" ").join("_")
21
+ formatted_name = name.downcase.split(" ").join("_")
22
22
 
23
- if name.include?("shopify")
23
+ if formatted_name.include?("shopify")
24
24
  ctx.abort(ctx.message("node.forms.create.error.invalid_app_name"))
25
25
  end
26
- name
26
+ formatted_name
27
27
  end
28
28
 
29
29
  def ask_type
@@ -5,155 +5,13 @@ module Node
5
5
  MESSAGES = {
6
6
  node: {
7
7
  help: <<~HELP,
8
- Suite of commands for developing Node.js apps. See {{command:%1$s node <command> --help}} for usage of each command.
9
- Usage: {{command:%1$s node [ %2$s ]}}
8
+ Suite of commands for developing Node.js apps. See {{command:%1$s app node <command> --help}} for usage of each command.
9
+ Usage: {{command:%1$s app node [ %2$s ]}}
10
10
  HELP
11
11
 
12
12
  error: {
13
13
  generic: "Error",
14
14
  },
15
-
16
- connect: {
17
- connected: "Project now connected to {{green:%s}}",
18
- help: <<~HELP,
19
- {{command:%s node connect}}: Connects an existing Node.js app to Shopify CLI. Creates a config file.
20
- Usage: {{command:%s node connect}}
21
- HELP
22
- production_warning: <<~MESSAGE,
23
- {{yellow:! Warning: if you have connected to an {{bold:app in production}}, running {{command:serve}} may update the app URL and cause an outage.
24
- MESSAGE
25
- },
26
-
27
- create: {
28
- help: <<~HELP,
29
- {{command:%s node create}}: Creates an embedded nodejs app.
30
- Usage: {{command:%s node create}}
31
- Options:
32
- {{command:--name=NAME}} App name. Any string.
33
- {{command:--organization-id=ID}} Partner organization ID. Must be an existing organization.
34
- {{command:--store=MYSHOPIFYDOMAIN }} Development store URL. Must be an existing development store.
35
- HELP
36
- error: {
37
- node_required: "node is required to create an app project. Download at https://nodejs.org/en/download.",
38
- node_version_failure: "Failed to get the current node version. Please make sure it is installed as " \
39
- "per the instructions at https://nodejs.org/en.",
40
- npm_required: "npm is required to create an app project. Download at https://www.npmjs.com/get-npm.",
41
- npm_version_failure: "Failed to get the current npm version. Please make sure it is installed as per " \
42
- "the instructions at https://www.npmjs.com/get-npm.",
43
- },
44
- node_version: "node %s",
45
- npm_version: "npm %s",
46
- },
47
-
48
- deploy: {
49
- help: <<~HELP,
50
- Deploy the current Node project to a hosting service. Heroku ({{underline:https://www.heroku.com}}) is currently the only option, but more will be added in the future.
51
- Usage: {{command:%s node deploy [ heroku ]}}
52
- HELP
53
- extended_help: <<~HELP,
54
- {{bold:Subcommands:}}
55
- {{cyan:heroku}}: Deploys the current Node project to Heroku.
56
- Usage: {{command:%s node deploy heroku}}
57
- HELP
58
- heroku: {
59
- help: <<~HELP,
60
- Deploy the current Node project to Heroku
61
- Usage: {{command:%s node deploy heroku}}
62
- HELP
63
- downloading: "Downloading Heroku CLI…",
64
- downloaded: "Downloaded Heroku CLI",
65
- installing: "Installing Heroku CLI…",
66
- installing_windows: "Running Heroku CLI install wizard…",
67
- installed: "Installed Heroku CLI",
68
- authenticating: "Authenticating with Heroku…",
69
- authenticated: "{{v}} Authenticated with Heroku",
70
- authenticated_with_account: "{{v}} Authenticated with Heroku as {{green:%s}}",
71
- deploying: "Deploying to Heroku…",
72
- deployed: "{{v}} Deployed to Heroku",
73
- git: {
74
- checking: "Checking git repo…",
75
- initialized: "Git repo initialized",
76
- what_branch: "What branch would you like to deploy?",
77
- branch_selected: "{{v}} Git branch {{green:%s}} selected for deploy",
78
- },
79
- app: {
80
- no_apps_found: "No existing Heroku app found. What would you like to do?",
81
- name: "What is your Heroku app’s name?",
82
- select: "Specify an existing Heroku app",
83
- selecting: "Selecting Heroku app %s…",
84
- selected: "{{v}} Heroku app {{green:%s}} selected",
85
- create: "Create a new Heroku app",
86
- creating: "Creating new Heroku app…",
87
- created: "{{v}} New Heroku app created",
88
- },
89
- },
90
- },
91
-
92
- generate: {
93
- help: <<~HELP,
94
- {{red:The {{command:generate}} command is no longer supported.}}
95
- You can complete any tasks previously supported by {{command:generate}} with these guides:
96
- {{green:page}}
97
- Create a page with Polaris design components: {{green:https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/build-your-user-interface-with-polaris}}
98
-
99
- {{green:webhook}}
100
- Register and process webhooks: {{green:https://github.com/Shopify/shopify-node-api/blob/main/docs/usage/webhooks.md}}
101
-
102
- {{green:billing}}
103
- Create and manage app billing models: {{green:https://shopify.dev/tutorials/bill-for-your-app-using-graphql-admin-api}}
104
- HELP
105
- },
106
-
107
- open: {
108
- help: <<~HELP,
109
- Open your local development app in the default browser.
110
- Usage: {{command:%s node open}}
111
- HELP
112
- },
113
-
114
- serve: {
115
- help: <<~HELP,
116
- Start a local development node server for your project, as well as a public ngrok tunnel to your localhost.
117
- Usage: {{command:%s node serve}}
118
- HELP
119
- extended_help: <<~HELP,
120
- {{bold:Options:}}
121
- {{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
122
- {{cyan:--port=PORT}}: Use custom port.
123
- HELP
124
-
125
- open_info: <<~MESSAGE,
126
- {{*}} To install and start using your app, open this URL in your browser:
127
- {{green:%s}}
128
- MESSAGE
129
- running_server: "Running server…",
130
- },
131
-
132
- tunnel: {
133
- help: <<~HELP,
134
- Start or stop an http tunnel to your local development app using ngrok.
135
- Usage: {{command:%s node tunnel [ auth | start | stop ]}}
136
- HELP
137
- extended_help: <<~HELP,
138
- {{bold:Subcommands:}}
139
-
140
- {{cyan:auth}}: Writes an ngrok auth token to ~/.ngrok2/ngrok.yml to connect with an ngrok account. Visit https://dashboard.ngrok.com/signup to sign up.
141
- Usage: {{command:%1$s node tunnel auth <token>}}
142
-
143
- {{cyan:start}}: Starts an ngrok tunnel, will print the URL for an existing tunnel if already running.
144
- Usage: {{command:%1$s node tunnel start}}
145
-
146
- {{cyan:stop}}: Stops the ngrok tunnel.
147
- Usage: {{command:%1$s node tunnel stop}}
148
-
149
- HELP
150
-
151
- error: {
152
- token_argument_missing: "{{x}} {{red:auth requires a token argument}}\n\n",
153
- },
154
-
155
- },
156
-
157
15
  forms: {
158
16
  create: {
159
17
  error: {
@@ -5,17 +5,6 @@ module PHP
5
5
  register_messages(PHP::Messages::MESSAGES)
6
6
  end
7
7
 
8
- # define/autoload project specific Commands
9
- class Command < ShopifyCLI::ProjectCommands
10
- subcommand :Connect, "connect", Project.project_filepath("commands/connect")
11
- subcommand :Create, "create", Project.project_filepath("commands/create")
12
- subcommand :Deploy, "deploy", Project.project_filepath("commands/deploy")
13
- subcommand :Open, "open", Project.project_filepath("commands/open")
14
- subcommand :Serve, "serve", Project.project_filepath("commands/serve")
15
- subcommand :Tunnel, "tunnel", Project.project_filepath("commands/tunnel")
16
- end
17
- ShopifyCLI::Commands.register("PHP::Command", "php")
18
-
19
8
  # define/autoload project specific Tasks
20
9
  module Tasks
21
10
  end
@@ -3,11 +3,10 @@ require "uri"
3
3
  module PHP
4
4
  module Forms
5
5
  class Create < ShopifyCLI::Form
6
- attr_accessor :name
7
- flag_arguments :title, :organization_id, :shop_domain, :type
6
+ flag_arguments :name, :organization_id, :shop_domain, :type
8
7
 
9
8
  def ask
10
- self.title ||= CLI::UI::Prompt.ask(ctx.message("php.forms.create.app_name"))
9
+ self.name ||= CLI::UI::Prompt.ask(ctx.message("php.forms.create.app_name"))
11
10
  self.name = format_name
12
11
  self.type = ask_type
13
12
  res = ShopifyCLI::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
@@ -18,12 +17,12 @@ module PHP
18
17
  private
19
18
 
20
19
  def format_name
21
- name = title.downcase.split(" ").join("_")
20
+ formatted_name = name.downcase.split(" ").join("_")
22
21
 
23
- if name.include?("shopify")
22
+ if formatted_name.include?("shopify")
24
23
  ctx.abort(ctx.message("php.forms.create.error.invalid_app_name"))
25
24
  end
26
- name
25
+ formatted_name
27
26
  end
28
27
 
29
28
  def ask_type
@@ -5,168 +5,9 @@ module PHP
5
5
  MESSAGES = {
6
6
  php: {
7
7
  help: <<~HELP,
8
- Suite of commands for developing PHP apps with Laravel. See {{command:%1$s php <command> --help}} for usage of each command.
9
- Usage: {{command:%1$s php [ %2$s ]}}
8
+ Suite of commands for developing PHP apps with Laravel. See {{command:%1$s app php <command> --help}} for usage of each command.
9
+ Usage: {{command:%1$s app php [ %2$s ]}}
10
10
  HELP
11
-
12
- connect: {
13
- connected: "Project now connected to {{green:%s}}",
14
- help: <<~HELP,
15
- {{command:%s php connect}}: Connects an existing PHP app to Shopify CLI. Creates a config file.
16
- Usage: {{command:%s php connect}}
17
- HELP
18
- production_warning: <<~MESSAGE,
19
- {{yellow:! Warning: if you have connected to an {{bold:app in production}}, running {{command:serve}} may update the app URL and cause an outage.
20
- MESSAGE
21
- },
22
-
23
- create: {
24
- help: <<~HELP,
25
- {{command:%s create php}}: Creates an embedded PHP app.
26
- Usage: {{command:%s create php}}
27
- Options:
28
- {{command:--name=NAME}} App name. Any string.
29
- {{command:--organization-id=ID}} Partner organization ID. Must be an existing organization.
30
- {{command:--shop-domain=MYSHOPIFYDOMAIN}} Development store URL. Must be an existing development store.
31
- {{command:--type=APPTYPE}} Whether this app is public or custom.
32
- {{command:--verbose}} Output verbose information when installing dependencies.
33
- HELP
34
-
35
- error: {
36
- php_required: <<~VERSION,
37
- PHP is required to create an app project. For installation instructions, visit:
38
- {{underline:https://www.php.net/manual/en/install.php}}
39
- VERSION
40
- php_version_failure: <<~VERSION,
41
- Failed to get the current PHP version. Please make sure it is installed as per the instructions at:
42
- {{underline:https://www.php.net/manual/en/install.php.}}
43
- VERSION
44
- php_version_too_low: "Your PHP version is too low. Please use version %s or higher.",
45
- composer_required: <<~COMPOSER,
46
- Composer is required to create an app project. Download at:
47
- {{underline:https://getcomposer.org/download/}}
48
- COMPOSER
49
- npm_required: "npm is required to create an app project. Download at https://www.npmjs.com/get-npm.",
50
- npm_version_failure: "Failed to get the current npm version. Please make sure it is installed as per " \
51
- "the instructions at https://www.npmjs.com/get-npm.",
52
- app_setup: "Failed to set up the app",
53
- },
54
-
55
- php_version: "PHP %s",
56
- npm_version: "npm %s",
57
- app_setting_up: "Setting up app…",
58
- app_set_up: "App is now set up",
59
- },
60
-
61
- open: {
62
- help: <<~HELP,
63
- Open your local development app in the default browser.
64
- Usage: {{command:%s open}}
65
- HELP
66
- },
67
-
68
- deploy: {
69
- help: <<~HELP,
70
- Deploy the current PHP project to a hosting service. Heroku ({{underline:https://www.heroku.com}}) is currently the only option, but more will be added in the future.
71
- Usage: {{command:%s deploy [ heroku ]}}
72
- HELP
73
-
74
- extended_help: <<~HELP,
75
- {{bold:Subcommands:}}
76
- {{cyan:heroku}}: Deploys the current PHP project to Heroku.
77
- Usage: {{command:%s deploy heroku}}
78
- HELP
79
-
80
- heroku: {
81
- help: <<~HELP,
82
- Deploy the current PHP project to Heroku
83
- Usage: {{command:%s deploy heroku}}
84
- HELP
85
-
86
- error: {
87
- generate_app_key: "Failed to generate Laravel APP_KEY",
88
- },
89
-
90
- downloading: "Downloading Heroku CLI…",
91
- downloaded: "Downloaded Heroku CLI",
92
- installing: "Installing Heroku CLI…",
93
- installing_windows: "Running Heroku CLI install wizard…",
94
- installed: "Installed Heroku CLI",
95
- authenticating: "Authenticating with Heroku…",
96
- authenticated: "{{v}} Authenticated with Heroku",
97
- authenticated_with_account: "{{v}} Authenticated with Heroku as `%s`",
98
- deploying: "Deploying to Heroku…",
99
- deployed: "Deployed to Heroku",
100
- post_deploy: <<~DEPLOYED,
101
- {{v}} Deployed to Heroku, you can access your app at {{green:%s}}
102
-
103
- If you're deploying this app for the first time, make sure to set up your database and your app's environment at {{bold:App dashboard -> Settings -> Config Vars}}.
104
-
105
- When setting your config vars, don't forget to set up your database and the appropriate Laravel values for it, particularly {{bold:DB_CONNECTION and DB_DATABASE}}.
106
- DEPLOYED
107
- git: {
108
- checking: "Checking git repo…",
109
- initialized: "Git repo initialized",
110
- what_branch: "What branch would you like to deploy?",
111
- branch_selected: "{{v}} Git branch `%s` selected for deploy",
112
- },
113
- app: {
114
- no_apps_found: "No existing Heroku app found. What would you like to do?",
115
- name: "What is your Heroku app’s name?",
116
- select: "Specify an existing Heroku app",
117
- selecting: "Selecting Heroku app `%s`…",
118
- selected: "{{v}} Heroku app `%s` selected",
119
- create: "Create a new Heroku app",
120
- creating: "Creating new Heroku app…",
121
- created: "{{v}} New Heroku app created",
122
- setting_configs: "Setting Shopify app configs…",
123
- configs_set: "{{v}} Shopify app configs set",
124
- },
125
- },
126
- },
127
-
128
- serve: {
129
- help: <<~HELP,
130
- Start a local development PHP server for your project, as well as a public ngrok tunnel to your localhost.
131
- Usage: {{command:%s serve}}
132
- HELP
133
- extended_help: <<~HELP,
134
- {{bold:Options:}}
135
- {{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
136
- {{cyan:--port=PORT}}: Use custom port.
137
- HELP
138
-
139
- open_info: <<~MESSAGE,
140
- {{*}} To install and start using your app, open this URL in your browser:
141
- {{green:%s}}
142
- MESSAGE
143
- running_server: "Running server…",
144
- },
145
-
146
- tunnel: {
147
- help: <<~HELP,
148
- Start or stop an http tunnel to your local development app using ngrok.
149
- Usage: {{command:%s tunnel [ auth | start | stop ]}}
150
- HELP
151
- extended_help: <<~HELP,
152
- {{bold:Subcommands:}}
153
-
154
- {{cyan:auth}}: Writes an ngrok auth token to ~/.ngrok2/ngrok.yml to connect with an ngrok account. Visit https://dashboard.ngrok.com/signup to sign up.
155
- Usage: {{command:%1$s tunnel auth <token>}}
156
-
157
- {{cyan:start}}: Starts an ngrok tunnel, will print the URL for an existing tunnel if already running.
158
- Usage: {{command:%1$s tunnel start}}
159
-
160
- {{cyan:stop}}: Stops the ngrok tunnel.
161
- Usage: {{command:%1$s tunnel stop}}
162
-
163
- HELP
164
-
165
- error: {
166
- token_argument_missing: "{{x}} {{red:auth requires a token argument}}\n\n",
167
- },
168
- },
169
-
170
11
  forms: {
171
12
  create: {
172
13
  error: {