shopify-cli 2.6.6 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer.json +5 -0
  3. data/.github/CODEOWNERS +2 -2
  4. data/.github/DESIGN.md +1 -1
  5. data/.github/ISSUE_TEMPLATE.md +7 -0
  6. data/.github/workflows/shopify.yml +1 -1
  7. data/.gitignore +1 -0
  8. data/.ruby-version +1 -1
  9. data/.vscode/extensions.json +5 -0
  10. data/.vscode/settings.json +9 -0
  11. data/CHANGELOG.md +44 -4
  12. data/CONTRIBUTING.md +1 -29
  13. data/{Dockerfile → Codespace.dockerfile} +2 -2
  14. data/Gemfile.lock +5 -5
  15. data/README.md +20 -99
  16. data/Rakefile +27 -0
  17. data/Tests.dockerfile +35 -0
  18. data/assets/logo.png +0 -0
  19. data/dev.yml +1 -4
  20. data/docs/README.md +13 -0
  21. data/docs/contributors/testing.md +27 -0
  22. data/docs/users/installation.md +46 -0
  23. data/{THEMEKIT_MIGRATION.md → docs/users/migrate-from-themekit.md} +1 -1
  24. data/ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256 +1 -0
  25. data/ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256 +1 -0
  26. data/ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256 +1 -0
  27. data/ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256 +1 -0
  28. data/ext/javy/javy.rb +205 -0
  29. data/ext/javy/version +1 -0
  30. data/lib/project_types/extension/cli.rb +6 -3
  31. data/lib/project_types/extension/commands/build.rb +4 -8
  32. data/lib/project_types/extension/commands/create.rb +2 -5
  33. data/lib/project_types/extension/commands/extension_command.rb +1 -1
  34. data/lib/project_types/extension/features/argo_serve.rb +9 -23
  35. data/lib/project_types/extension/forms/questions/ask_template.rb +1 -5
  36. data/lib/project_types/extension/messages/messages.rb +0 -2
  37. data/lib/project_types/extension/models/development_server.rb +2 -2
  38. data/lib/project_types/extension/models/development_server_requirements.rb +2 -3
  39. data/lib/project_types/extension/models/server_config/app.rb +13 -0
  40. data/lib/project_types/extension/models/server_config/development.rb +5 -4
  41. data/lib/project_types/extension/models/server_config/development_renderer.rb +1 -1
  42. data/lib/project_types/extension/models/server_config/development_resource.rb +13 -0
  43. data/lib/project_types/extension/models/server_config/extension.rb +3 -1
  44. data/lib/project_types/extension/models/server_config/root.rb +4 -1
  45. data/lib/project_types/extension/tasks/convert_server_config.rb +65 -0
  46. data/lib/project_types/extension/tasks/ensure_resource_url.rb +39 -0
  47. data/lib/project_types/extension/tasks/merge_server_config.rb +32 -0
  48. data/lib/project_types/extension/tasks/run_extension_command.rb +11 -10
  49. data/lib/project_types/node/cli.rb +0 -16
  50. data/lib/project_types/node/forms/create.rb +5 -5
  51. data/lib/project_types/node/messages/messages.rb +2 -144
  52. data/lib/project_types/php/cli.rb +0 -11
  53. data/lib/project_types/php/forms/create.rb +5 -6
  54. data/lib/project_types/php/messages/messages.rb +2 -161
  55. data/lib/project_types/rails/cli.rb +0 -16
  56. data/lib/project_types/rails/commands/create.rb +3 -5
  57. data/lib/project_types/rails/forms/create.rb +5 -6
  58. data/lib/project_types/rails/messages/messages.rb +6 -151
  59. data/lib/project_types/script/cli.rb +8 -2
  60. data/lib/project_types/script/commands/create.rb +2 -4
  61. data/lib/project_types/script/commands/javy.rb +29 -0
  62. data/lib/project_types/script/commands/push.rb +3 -2
  63. data/lib/project_types/script/config/extension_points.yml +12 -30
  64. data/lib/project_types/script/forms/ask_app.rb +32 -0
  65. data/lib/project_types/script/forms/ask_org.rb +30 -0
  66. data/lib/project_types/script/forms/ask_script_uuid.rb +22 -0
  67. data/lib/project_types/script/forms/run_against_shopify_org.rb +14 -0
  68. data/lib/project_types/script/graphql/app_script_set.graphql +2 -2
  69. data/lib/project_types/script/layers/application/build_script.rb +0 -1
  70. data/lib/project_types/script/layers/application/connect_app.rb +73 -0
  71. data/lib/project_types/script/layers/application/create_script.rb +1 -1
  72. data/lib/project_types/script/layers/application/push_script.rb +1 -1
  73. data/lib/project_types/script/layers/domain/errors.rb +1 -4
  74. data/lib/project_types/script/layers/domain/push_package.rb +3 -3
  75. data/lib/project_types/script/layers/domain/{script_json.rb → script_config.rb} +2 -2
  76. data/lib/project_types/script/layers/domain/script_project.rb +5 -1
  77. data/lib/project_types/script/layers/infrastructure/errors.rb +36 -7
  78. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +0 -4
  79. data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +0 -4
  80. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +2 -2
  81. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +104 -27
  82. data/lib/project_types/script/layers/infrastructure/script_service.rb +11 -11
  83. data/lib/project_types/script/messages/messages.rb +21 -4
  84. data/lib/project_types/script/ui/error_handler.rb +31 -21
  85. data/lib/project_types/theme/cli.rb +1 -1
  86. data/lib/project_types/theme/commands/check.rb +1 -1
  87. data/lib/project_types/theme/commands/delete.rb +1 -1
  88. data/lib/project_types/theme/commands/init.rb +1 -1
  89. data/lib/project_types/theme/commands/language_server.rb +1 -1
  90. data/lib/project_types/theme/commands/package.rb +1 -1
  91. data/lib/project_types/theme/commands/publish.rb +1 -1
  92. data/lib/project_types/theme/commands/pull.rb +4 -1
  93. data/lib/project_types/theme/commands/push.rb +5 -1
  94. data/lib/project_types/theme/commands/serve.rb +9 -3
  95. data/lib/project_types/theme/messages/messages.rb +39 -2
  96. data/lib/project_types/theme/ui/sync_progress_bar.rb +2 -2
  97. data/lib/shopify_cli/admin_api/populate_resource_command.rb +1 -1
  98. data/lib/shopify_cli/api.rb +7 -2
  99. data/lib/shopify_cli/app_type_detector.rb +24 -20
  100. data/lib/shopify_cli/command/app_sub_command.rb +10 -0
  101. data/lib/shopify_cli/command/project_command.rb +31 -0
  102. data/lib/shopify_cli/command/sub_command.rb +19 -0
  103. data/lib/shopify_cli/command.rb +7 -2
  104. data/lib/shopify_cli/commands/app/connect.rb +22 -0
  105. data/lib/shopify_cli/commands/app/create/node.rb +36 -0
  106. data/lib/shopify_cli/commands/app/create/php.rb +36 -0
  107. data/lib/shopify_cli/commands/app/create/rails.rb +38 -0
  108. data/lib/shopify_cli/commands/app/create.rb +28 -0
  109. data/lib/shopify_cli/commands/app/deploy.rb +49 -0
  110. data/lib/shopify_cli/commands/app/open.rb +19 -0
  111. data/lib/shopify_cli/commands/app/serve.rb +49 -0
  112. data/lib/shopify_cli/commands/app/tunnel.rb +43 -0
  113. data/lib/shopify_cli/commands/app.rb +29 -0
  114. data/lib/shopify_cli/commands/config.rb +2 -2
  115. data/lib/shopify_cli/commands.rb +1 -0
  116. data/lib/shopify_cli/constants.rb +7 -0
  117. data/lib/shopify_cli/context.rb +10 -0
  118. data/lib/shopify_cli/environment.rb +4 -0
  119. data/lib/shopify_cli/exception_reporter.rb +3 -4
  120. data/lib/shopify_cli/git.rb +14 -1
  121. data/lib/shopify_cli/github/issue_url_generator.rb +19 -0
  122. data/lib/shopify_cli/github.rb +5 -0
  123. data/lib/shopify_cli/identity_auth.rb +18 -0
  124. data/lib/shopify_cli/messages/messages.rb +254 -9
  125. data/lib/shopify_cli/partners_api.rb +1 -8
  126. data/lib/shopify_cli/project.rb +5 -1
  127. data/lib/shopify_cli/project_commands.rb +1 -1
  128. data/lib/shopify_cli/services/app/connect_service.rb +25 -0
  129. data/lib/shopify_cli/services/app/create/node_service.rb +155 -0
  130. data/lib/shopify_cli/services/app/create/php_service.rb +152 -0
  131. data/lib/shopify_cli/services/app/create/rails_service.rb +215 -0
  132. data/lib/shopify_cli/services/app/deploy/heroku/node_service.rb +101 -0
  133. data/lib/shopify_cli/services/app/deploy/heroku/php_service.rb +135 -0
  134. data/lib/shopify_cli/services/app/deploy/heroku/rails_service.rb +120 -0
  135. data/lib/shopify_cli/services/app/open_service.rb +19 -0
  136. data/lib/shopify_cli/services/app/serve/node_service.rb +42 -0
  137. data/lib/shopify_cli/services/app/serve/php_service.rb +46 -0
  138. data/lib/shopify_cli/services/app/serve/rails_service.rb +48 -0
  139. data/lib/shopify_cli/services/app/tunnel/auth_service.rb +21 -0
  140. data/lib/shopify_cli/services/app/tunnel/start_service.rb +20 -0
  141. data/lib/shopify_cli/services/app/tunnel/stop_service.rb +20 -0
  142. data/lib/shopify_cli/services.rb +31 -0
  143. data/lib/shopify_cli/tasks/ensure_authenticated.rb +9 -3
  144. data/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +73 -0
  145. data/lib/shopify_cli/theme/dev_server/hot-reload.js +25 -9
  146. data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
  147. data/lib/shopify_cli/theme/dev_server.rb +37 -18
  148. data/lib/shopify_cli/theme/syncer/error_reporter.rb +45 -0
  149. data/lib/shopify_cli/theme/syncer/operation.rb +56 -0
  150. data/lib/shopify_cli/theme/syncer/standard_reporter.rb +32 -0
  151. data/lib/shopify_cli/theme/syncer.rb +40 -39
  152. data/lib/shopify_cli/theme/theme.rb +31 -19
  153. data/lib/shopify_cli/tunnel.rb +26 -22
  154. data/lib/shopify_cli/version.rb +1 -1
  155. data/lib/shopify_cli.rb +1 -2
  156. data/shopify-cli.gemspec +1 -1
  157. data/shopify-dev +18 -0
  158. data/utilities/constants.rb +7 -0
  159. data/utilities/docker/container.rb +10 -3
  160. data/utilities/docker.rb +2 -2
  161. data/utilities/utilities.rb +1 -0
  162. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +1 -1
  163. metadata +66 -50
  164. data/docs/_config.yml +0 -2
  165. data/docs/app/node/commands/index.md +0 -4
  166. data/docs/app/node/index.md +0 -4
  167. data/docs/app/rails/commands/index.md +0 -4
  168. data/docs/app/rails/index.md +0 -4
  169. data/docs/core/index.md +0 -4
  170. data/docs/getting-started/index.md +0 -4
  171. data/docs/getting-started/install/index.md +0 -4
  172. data/docs/getting-started/migrate/index.md +0 -4
  173. data/docs/getting-started/uninstall/index.md +0 -4
  174. data/docs/getting-started/upgrade/index.md +0 -4
  175. data/docs/help/start-app/index.md +0 -4
  176. data/docs/index.md +0 -4
  177. data/install.sh +0 -7
  178. data/lib/project_types/extension/tasks/converters/server_config_converter.rb +0 -30
  179. data/lib/project_types/extension/tasks/load_server_config.rb +0 -28
  180. data/lib/project_types/node/commands/connect.rb +0 -21
  181. data/lib/project_types/node/commands/create.rb +0 -125
  182. data/lib/project_types/node/commands/deploy/heroku.rb +0 -96
  183. data/lib/project_types/node/commands/deploy.rb +0 -32
  184. data/lib/project_types/node/commands/generate.rb +0 -22
  185. data/lib/project_types/node/commands/open.rb +0 -18
  186. data/lib/project_types/node/commands/serve.rb +0 -45
  187. data/lib/project_types/node/commands/tunnel.rb +0 -41
  188. data/lib/project_types/php/commands/connect.rb +0 -19
  189. data/lib/project_types/php/commands/create.rb +0 -143
  190. data/lib/project_types/php/commands/deploy/heroku.rb +0 -129
  191. data/lib/project_types/php/commands/deploy.rb +0 -32
  192. data/lib/project_types/php/commands/open.rb +0 -16
  193. data/lib/project_types/php/commands/serve.rb +0 -48
  194. data/lib/project_types/php/commands/tunnel.rb +0 -37
  195. data/lib/project_types/rails/commands/connect.rb +0 -21
  196. data/lib/project_types/rails/commands/deploy/heroku.rb +0 -115
  197. data/lib/project_types/rails/commands/deploy.rb +0 -32
  198. data/lib/project_types/rails/commands/generate/webhook.rb +0 -42
  199. data/lib/project_types/rails/commands/generate.rb +0 -60
  200. data/lib/project_types/rails/commands/open.rb +0 -18
  201. data/lib/project_types/rails/commands/serve.rb +0 -51
  202. data/lib/project_types/rails/commands/tunnel.rb +0 -41
  203. data/lib/project_types/script/tasks/ensure_env.rb +0 -106
  204. data/lib/shopify_cli/sub_command.rb +0 -17
  205. data/shopify.fish +0 -12
  206. data/shopify.sh +0 -11
@@ -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
22
- property :context, accepts: ShopifyCLI::Context
17
+ property! :type, accepts: Models::DevelopmentServerRequirements::SUPPORTED_EXTENSION_TYPES
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: {
@@ -5,22 +5,6 @@ module Rails
5
5
  register_messages(Rails::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("Rails::Command", "rails")
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")
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
  module Rails
3
3
  class Command
4
- class Create < ShopifyCLI::SubCommand
5
- unless ShopifyCLI::Environment.acceptance_test?
6
- prerequisite_task :ensure_authenticated
7
- end
4
+ class Create < ShopifyCLI::Command::AppSubCommand
5
+ prerequisite_task :ensure_authenticated
8
6
 
9
7
  USER_AGENT_CODE = <<~USERAGENT
10
8
  module ShopifyAPI
@@ -158,10 +156,10 @@ module Rails
158
156
 
159
157
  CLI::UI::Frame.open(@ctx.message("rails.create.generating_app", name)) do
160
158
  new_command = %w(rails new)
159
+ new_command << name
161
160
  new_command += DEFAULT_RAILS_FLAGS
162
161
  new_command << "--database=#{db}"
163
162
  new_command += options.flags[:rails_opts].split unless options.flags[:rails_opts].nil?
164
- new_command << name
165
163
 
166
164
  syscall(new_command)
167
165
  end
@@ -3,8 +3,7 @@ require "uri"
3
3
  module Rails
4
4
  module Forms
5
5
  class Create < ShopifyCLI::Form
6
- attr_accessor :name
7
- flag_arguments :title, :organization_id, :shop_domain, :type, :db
6
+ flag_arguments :name, :organization_id, :shop_domain, :type, :db
8
7
  VALID_DB_TYPES = ["sqlite3",
9
8
  "mysql",
10
9
  "postgresql",
@@ -18,7 +17,7 @@ module Rails
18
17
  "jdbc"]
19
18
 
20
19
  def ask
21
- self.title ||= CLI::UI::Prompt.ask(ctx.message("rails.forms.create.app_name"))
20
+ self.name ||= CLI::UI::Prompt.ask(ctx.message("rails.forms.create.app_name"))
22
21
  self.name = format_name
23
22
  self.type = ask_type
24
23
  res = ShopifyCLI::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
@@ -30,13 +29,13 @@ module Rails
30
29
  private
31
30
 
32
31
  def format_name
33
- name = title.downcase.split(" ").join("_")
32
+ formatted_name = name.downcase.split(" ").join("_")
34
33
 
35
- if name.include?("shopify")
34
+ if formatted_name.include?("shopify")
36
35
  ctx.abort(ctx.message("rails.forms.create.error.invalid_app_name"))
37
36
  end
38
37
 
39
- name
38
+ formatted_name
40
39
  end
41
40
 
42
41
  def ask_type