shopify-cli 2.6.3 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) 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/.github/PULL_REQUEST_TEMPLATE.md +15 -4
  6. data/.github/workflows/shopify.yml +3 -6
  7. data/.vscode/extensions.json +5 -0
  8. data/.vscode/settings.json +9 -0
  9. data/CHANGELOG.md +98 -104
  10. data/CONTRIBUTING.md +1 -21
  11. data/Codespace.dockerfile +35 -0
  12. data/Gemfile +2 -0
  13. data/Gemfile.lock +9 -5
  14. data/README.md +20 -99
  15. data/RELEASING.md +17 -30
  16. data/Rakefile +0 -5
  17. data/Tests.dockerfile +35 -0
  18. data/assets/logo.png +0 -0
  19. data/dev.yml +0 -3
  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/lib/project_types/extension/cli.rb +7 -3
  25. data/lib/project_types/extension/commands/create.rb +6 -6
  26. data/lib/project_types/extension/commands/extension_command.rb +1 -1
  27. data/lib/project_types/extension/features/argo.rb +9 -10
  28. data/lib/project_types/extension/features/argo_serve.rb +9 -23
  29. data/lib/project_types/extension/forms/create.rb +1 -1
  30. data/lib/project_types/extension/forms/questions/ask_template.rb +3 -6
  31. data/lib/project_types/extension/messages/messages.rb +1 -0
  32. data/lib/project_types/extension/models/development_server_requirements.rb +2 -3
  33. data/lib/project_types/extension/models/server_config/app.rb +13 -0
  34. data/lib/project_types/extension/models/server_config/development.rb +5 -4
  35. data/lib/project_types/extension/models/server_config/development_renderer.rb +1 -1
  36. data/lib/project_types/extension/models/server_config/development_resource.rb +13 -0
  37. data/lib/project_types/extension/models/server_config/extension.rb +4 -0
  38. data/lib/project_types/extension/models/server_config/root.rb +4 -1
  39. data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +1 -1
  40. data/lib/project_types/extension/models/specification_handlers/checkout_ui_extension.rb +1 -1
  41. data/lib/project_types/extension/tasks/convert_server_config.rb +65 -0
  42. data/lib/project_types/extension/tasks/ensure_resource_url.rb +39 -0
  43. data/lib/project_types/extension/tasks/find_package_from_json.rb +37 -0
  44. data/lib/project_types/extension/tasks/merge_server_config.rb +32 -0
  45. data/lib/project_types/extension/tasks/run_extension_command.rb +10 -9
  46. data/lib/project_types/node/cli.rb +0 -16
  47. data/lib/project_types/node/forms/create.rb +5 -5
  48. data/lib/project_types/node/messages/messages.rb +2 -149
  49. data/lib/project_types/php/cli.rb +0 -11
  50. data/lib/project_types/php/forms/create.rb +5 -6
  51. data/lib/project_types/php/messages/messages.rb +2 -164
  52. data/lib/project_types/rails/cli.rb +0 -16
  53. data/lib/project_types/rails/commands/create.rb +46 -17
  54. data/lib/project_types/rails/forms/create.rb +5 -7
  55. data/lib/project_types/rails/messages/messages.rb +6 -154
  56. data/lib/project_types/script/cli.rb +1 -1
  57. data/lib/project_types/script/commands/create.rb +5 -6
  58. data/lib/project_types/script/commands/push.rb +1 -1
  59. data/lib/project_types/script/config/extension_points.yml +10 -0
  60. data/lib/project_types/script/errors.rb +0 -18
  61. data/lib/project_types/script/graphql/app_script_set.graphql +2 -0
  62. data/lib/project_types/script/layers/application/build_script.rb +2 -1
  63. data/lib/project_types/script/layers/application/create_script.rb +2 -2
  64. data/lib/project_types/script/layers/application/push_script.rb +15 -1
  65. data/lib/project_types/script/layers/domain/push_package.rb +5 -2
  66. data/lib/project_types/script/layers/domain/script_json.rb +1 -1
  67. data/lib/project_types/script/layers/infrastructure/api_clients/partners_proxy_api_client.rb +0 -4
  68. data/lib/project_types/script/layers/infrastructure/errors.rb +17 -2
  69. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +29 -13
  70. data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +29 -13
  71. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +4 -2
  72. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +3 -4
  73. data/lib/project_types/script/layers/infrastructure/script_service.rb +7 -2
  74. data/lib/project_types/script/messages/messages.rb +9 -22
  75. data/lib/project_types/script/ui/error_handler.rb +16 -26
  76. data/lib/project_types/theme/cli.rb +1 -1
  77. data/lib/project_types/theme/commands/check.rb +1 -1
  78. data/lib/project_types/theme/commands/delete.rb +1 -1
  79. data/lib/project_types/theme/commands/init.rb +1 -1
  80. data/lib/project_types/theme/commands/language_server.rb +1 -1
  81. data/lib/project_types/theme/commands/package.rb +1 -1
  82. data/lib/project_types/theme/commands/publish.rb +1 -1
  83. data/lib/project_types/theme/commands/pull.rb +1 -1
  84. data/lib/project_types/theme/commands/push.rb +1 -1
  85. data/lib/project_types/theme/commands/serve.rb +10 -2
  86. data/lib/project_types/theme/messages/messages.rb +10 -0
  87. data/lib/shopify_cli/admin_api/populate_resource_command.rb +1 -1
  88. data/lib/shopify_cli/api.rb +7 -2
  89. data/lib/shopify_cli/app_type_detector.rb +36 -0
  90. data/lib/shopify_cli/command/app_sub_command.rb +10 -0
  91. data/lib/shopify_cli/command/project_command.rb +18 -0
  92. data/lib/shopify_cli/command/sub_command.rb +19 -0
  93. data/lib/shopify_cli/command.rb +13 -3
  94. data/lib/shopify_cli/command_options/command_serve_options.rb +43 -0
  95. data/lib/shopify_cli/command_options.rb +7 -0
  96. data/lib/shopify_cli/commands/app/connect.rb +22 -0
  97. data/lib/shopify_cli/commands/app/create/node.rb +38 -0
  98. data/lib/shopify_cli/commands/app/create/php.rb +36 -0
  99. data/lib/shopify_cli/commands/app/create/rails.rb +40 -0
  100. data/lib/shopify_cli/commands/app/create.rb +28 -0
  101. data/lib/shopify_cli/commands/app/deploy.rb +49 -0
  102. data/lib/shopify_cli/commands/app/open.rb +19 -0
  103. data/lib/shopify_cli/commands/app/serve.rb +49 -0
  104. data/lib/shopify_cli/commands/app/tunnel.rb +43 -0
  105. data/lib/shopify_cli/commands/app.rb +29 -0
  106. data/lib/shopify_cli/commands/config.rb +2 -2
  107. data/lib/shopify_cli/commands/login.rb +3 -3
  108. data/lib/shopify_cli/commands/reporting.rb +38 -0
  109. data/lib/shopify_cli/commands/switch.rb +1 -1
  110. data/lib/shopify_cli/commands.rb +2 -0
  111. data/lib/shopify_cli/constants.rb +11 -3
  112. data/lib/shopify_cli/core/monorail.rb +9 -20
  113. data/lib/shopify_cli/environment.rb +15 -1
  114. data/lib/shopify_cli/exception_reporter.rb +29 -16
  115. data/lib/shopify_cli/git.rb +12 -1
  116. data/lib/shopify_cli/github/issue_url_generator.rb +19 -0
  117. data/lib/shopify_cli/github.rb +5 -0
  118. data/lib/shopify_cli/messages/messages.rb +295 -22
  119. data/lib/shopify_cli/migrator/migration.rb +1 -1
  120. data/lib/shopify_cli/migrator/migrations/1631709766_noop.rb +1 -1
  121. data/lib/shopify_cli/migrator/migrations/1633691650_merge_reporting_configuration.rb +41 -0
  122. data/lib/shopify_cli/migrator.rb +9 -11
  123. data/lib/shopify_cli/project.rb +5 -1
  124. data/lib/shopify_cli/project_commands.rb +1 -1
  125. data/lib/shopify_cli/reporting_configuration_controller.rb +64 -0
  126. data/lib/shopify_cli/services/app/connect_service.rb +25 -0
  127. data/lib/shopify_cli/services/app/create/node_service.rb +153 -0
  128. data/lib/shopify_cli/services/app/create/php_service.rb +152 -0
  129. data/lib/shopify_cli/services/app/create/rails_service.rb +213 -0
  130. data/lib/shopify_cli/services/app/deploy/heroku/node_service.rb +101 -0
  131. data/lib/shopify_cli/services/app/deploy/heroku/php_service.rb +135 -0
  132. data/lib/shopify_cli/services/app/deploy/heroku/rails_service.rb +120 -0
  133. data/lib/shopify_cli/services/app/open_service.rb +19 -0
  134. data/lib/shopify_cli/services/app/serve/node_service.rb +42 -0
  135. data/lib/shopify_cli/services/app/serve/php_service.rb +46 -0
  136. data/lib/shopify_cli/services/app/serve/rails_service.rb +48 -0
  137. data/lib/shopify_cli/services/app/tunnel/auth_service.rb +21 -0
  138. data/lib/shopify_cli/services/app/tunnel/start_service.rb +20 -0
  139. data/lib/shopify_cli/services/app/tunnel/stop_service.rb +20 -0
  140. data/lib/shopify_cli/services/base_service.rb +13 -0
  141. data/lib/shopify_cli/services/reporting_service.rb +16 -0
  142. data/lib/shopify_cli/services.rb +37 -0
  143. data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
  144. data/lib/shopify_cli/theme/dev_server/watcher.rb +2 -2
  145. data/lib/shopify_cli/theme/dev_server.rb +9 -2
  146. data/lib/shopify_cli/version.rb +1 -1
  147. data/lib/shopify_cli.rb +5 -2
  148. data/shopify-cli.gemspec +2 -13
  149. data/shopify-dev +18 -0
  150. data/utilities/constants.rb +7 -0
  151. data/utilities/docker/container.rb +104 -0
  152. data/utilities/docker.rb +45 -3
  153. data/utilities/utilities.rb +1 -0
  154. metadata +63 -54
  155. data/Dockerfile +0 -17
  156. data/docs/_config.yml +0 -2
  157. data/docs/app/node/commands/index.md +0 -4
  158. data/docs/app/node/index.md +0 -4
  159. data/docs/app/rails/commands/index.md +0 -4
  160. data/docs/app/rails/index.md +0 -4
  161. data/docs/core/index.md +0 -4
  162. data/docs/getting-started/index.md +0 -4
  163. data/docs/getting-started/install/index.md +0 -4
  164. data/docs/getting-started/migrate/index.md +0 -4
  165. data/docs/getting-started/uninstall/index.md +0 -4
  166. data/docs/getting-started/upgrade/index.md +0 -4
  167. data/docs/help/start-app/index.md +0 -4
  168. data/docs/index.md +0 -4
  169. data/ext/shopify-cli/extconf.rb +0 -60
  170. data/install.sh +0 -7
  171. data/lib/project_types/extension/tasks/converters/server_config_converter.rb +0 -31
  172. data/lib/project_types/extension/tasks/load_server_config.rb +0 -23
  173. data/lib/project_types/node/commands/connect.rb +0 -21
  174. data/lib/project_types/node/commands/create.rb +0 -125
  175. data/lib/project_types/node/commands/deploy/heroku.rb +0 -96
  176. data/lib/project_types/node/commands/deploy.rb +0 -32
  177. data/lib/project_types/node/commands/generate.rb +0 -22
  178. data/lib/project_types/node/commands/open.rb +0 -18
  179. data/lib/project_types/node/commands/serve.rb +0 -54
  180. data/lib/project_types/node/commands/tunnel.rb +0 -41
  181. data/lib/project_types/php/commands/connect.rb +0 -19
  182. data/lib/project_types/php/commands/create.rb +0 -143
  183. data/lib/project_types/php/commands/deploy/heroku.rb +0 -129
  184. data/lib/project_types/php/commands/deploy.rb +0 -32
  185. data/lib/project_types/php/commands/open.rb +0 -16
  186. data/lib/project_types/php/commands/serve.rb +0 -51
  187. data/lib/project_types/php/commands/tunnel.rb +0 -37
  188. data/lib/project_types/rails/commands/connect.rb +0 -21
  189. data/lib/project_types/rails/commands/deploy/heroku.rb +0 -115
  190. data/lib/project_types/rails/commands/deploy.rb +0 -32
  191. data/lib/project_types/rails/commands/generate/webhook.rb +0 -42
  192. data/lib/project_types/rails/commands/generate.rb +0 -60
  193. data/lib/project_types/rails/commands/open.rb +0 -18
  194. data/lib/project_types/rails/commands/serve.rb +0 -52
  195. data/lib/project_types/rails/commands/tunnel.rb +0 -41
  196. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +0 -0
  197. data/lib/shopify_cli/exception_reporter/permission_controller.rb +0 -54
  198. data/lib/shopify_cli/sub_command.rb +0 -17
  199. data/shopify.fish +0 -12
  200. data/shopify.sh +0 -11
@@ -5,171 +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
- HELP
137
-
138
- error: {
139
- host_must_be_https: "HOST must be a HTTPS url.",
140
- },
141
-
142
- open_info: <<~MESSAGE,
143
- {{*}} To install and start using your app, open this URL in your browser:
144
- {{green:%s}}
145
- MESSAGE
146
- running_server: "Running server…",
147
- },
148
-
149
- tunnel: {
150
- help: <<~HELP,
151
- Start or stop an http tunnel to your local development app using ngrok.
152
- Usage: {{command:%s tunnel [ auth | start | stop ]}}
153
- HELP
154
- extended_help: <<~HELP,
155
- {{bold:Subcommands:}}
156
-
157
- {{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.
158
- Usage: {{command:%1$s tunnel auth <token>}}
159
-
160
- {{cyan:start}}: Starts an ngrok tunnel, will print the URL for an existing tunnel if already running.
161
- Usage: {{command:%1$s tunnel start}}
162
-
163
- {{cyan:stop}}: Stops the ngrok tunnel.
164
- Usage: {{command:%1$s tunnel stop}}
165
-
166
- HELP
167
-
168
- error: {
169
- token_argument_missing: "{{x}} {{red:auth requires a token argument}}\n\n",
170
- },
171
- },
172
-
173
11
  forms: {
174
12
  create: {
175
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,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
  module Rails
3
3
  class Command
4
- class Create < ShopifyCLI::SubCommand
5
- prerequisite_task :ensure_authenticated
4
+ class Create < ShopifyCLI::Command::AppSubCommand
5
+ unless ShopifyCLI::Environment.acceptance_test?
6
+ prerequisite_task :ensure_authenticated
7
+ end
6
8
 
7
9
  USER_AGENT_CODE = <<~USERAGENT
8
10
  module ShopifyAPI
@@ -31,8 +33,8 @@ module Rails
31
33
  end
32
34
 
33
35
  def call(args, _name)
34
- form = Forms::Create.ask(@ctx, args, options.flags)
35
- return @ctx.puts(self.class.help) if form.nil?
36
+ form_data = self.form_data(args)
37
+ return @ctx.puts(self.class.help) if form_data.nil?
36
38
 
37
39
  ruby_version = Ruby.version(@ctx)
38
40
  @ctx.abort(@ctx.message("rails.create.error.invalid_ruby_version")) unless
@@ -41,34 +43,61 @@ module Rails
41
43
  check_node
42
44
  check_yarn
43
45
 
44
- build(form.name, form.db)
46
+ build(form_data.name, form_data.db)
47
+
45
48
  set_custom_ua
46
49
  ShopifyCLI::Project.write(
47
50
  @ctx,
48
51
  project_type: "rails",
49
- organization_id: form.organization_id,
52
+ organization_id: form_data.organization_id,
50
53
  )
51
54
 
52
- api_client = ShopifyCLI::Tasks::CreateApiClient.call(
53
- @ctx,
54
- org_id: form.organization_id,
55
- title: form.title,
56
- type: form.type,
57
- )
55
+ api_client = if ShopifyCLI::Environment.acceptance_test?
56
+ {
57
+ "apiKey" => "public_api_key",
58
+ "apiSecretKeys" => [
59
+ {
60
+ "secret" => "api_secret_key",
61
+ },
62
+ ],
63
+ }
64
+ else
65
+ ShopifyCLI::Tasks::CreateApiClient.call(
66
+ @ctx,
67
+ org_id: form_data.organization_id,
68
+ title: form_data.title,
69
+ type: form_data.type,
70
+ )
71
+ end
58
72
 
59
73
  ShopifyCLI::Resources::EnvFile.new(
60
74
  api_key: api_client["apiKey"],
61
75
  secret: api_client["apiSecretKeys"].first["secret"],
62
- shop: form.shop_domain,
76
+ shop: form_data.shop_domain,
63
77
  scopes: "write_products,write_customers,write_draft_orders",
64
78
  ).write(@ctx)
65
79
 
66
- partners_url = ShopifyCLI::PartnersAPI.partners_url_for(form.organization_id, api_client["id"])
80
+ partners_url = ShopifyCLI::PartnersAPI.partners_url_for(form_data.organization_id, api_client["id"])
67
81
 
68
- @ctx.puts(@ctx.message("apps.create.info.created", form.title, partners_url))
69
- @ctx.puts(@ctx.message("apps.create.info.serve", form.name, ShopifyCLI::TOOL_NAME, "rails"))
82
+ @ctx.puts(@ctx.message("apps.create.info.created", form_data.title, partners_url))
83
+ @ctx.puts(@ctx.message("apps.create.info.serve", form_data.name, ShopifyCLI::TOOL_NAME, "rails"))
70
84
  unless ShopifyCLI::Shopifolk.acting_as_shopify_organization?
71
- @ctx.puts(@ctx.message("apps.create.info.install", partners_url, form.title))
85
+ @ctx.puts(@ctx.message("apps.create.info.install", partners_url, form_data.title))
86
+ end
87
+ end
88
+
89
+ def form_data(args)
90
+ if ShopifyCLI::Environment.acceptance_test?
91
+ Struct.new(:title, :name, :organization_id, :type, :shop_domain, :db, keyword_init: true).new(
92
+ title: options.flags[:title],
93
+ name: options.flags[:title],
94
+ organization_id: "123",
95
+ shop_domain: "test.shopify.io",
96
+ type: "public",
97
+ db: options.flags[:db]
98
+ )
99
+ else
100
+ Forms::Create.ask(@ctx, args, options.flags)
72
101
  end
73
102
  end
74
103
 
@@ -3,12 +3,10 @@ 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",
11
- "sqlite3",
12
10
  "oracle",
13
11
  "frontbase",
14
12
  "ibm_db",
@@ -19,7 +17,7 @@ module Rails
19
17
  "jdbc"]
20
18
 
21
19
  def ask
22
- 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"))
23
21
  self.name = format_name
24
22
  self.type = ask_type
25
23
  res = ShopifyCLI::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain)
@@ -31,13 +29,13 @@ module Rails
31
29
  private
32
30
 
33
31
  def format_name
34
- name = title.downcase.split(" ").join("_")
32
+ formatted_name = name.downcase.split(" ").join("_")
35
33
 
36
- if name.include?("shopify")
34
+ if formatted_name.include?("shopify")
37
35
  ctx.abort(ctx.message("rails.forms.create.error.invalid_app_name"))
38
36
  end
39
37
 
40
- name
38
+ formatted_name
41
39
  end
42
40
 
43
41
  def ask_type
@@ -5,8 +5,8 @@ module Rails
5
5
  MESSAGES = {
6
6
  rails: {
7
7
  help: <<~HELP,
8
- Suite of commands for developing Ruby on Rails apps. See {{command:%1$s rails <command> --help}} for usage of each command.
9
- Usage: {{command:%1$s rails [ %2$s ]}}
8
+ Suite of commands for developing Ruby on Rails apps. See {{command:%1$s app rails <command> --help}} for usage of each command.
9
+ Usage: {{command:%1$s app rails [ %2$s ]}}
10
10
  HELP
11
11
 
12
12
  error: {
@@ -21,117 +21,22 @@ module Rails
21
21
  setting_gem_home: "GEM_HOME being set to %s",
22
22
  setting_gem_path: "GEM_PATH being set to %s",
23
23
  },
24
-
25
- connect: {
26
- connected: "Project now connected to {{green:%s}}",
27
- help: <<~HELP,
28
- {{command:%s rails connect}}: Connects an existing Ruby on Rails app to Shopify CLI. Creates a config file.
29
- Usage: {{command:%s rails connect}}
30
- HELP
31
- production_warning: <<~MESSAGE,
32
- {{yellow:! Warning: if you have connected to an {{bold:app in production}}, running {{command:serve}} may update the app URL and cause an outage.
33
- MESSAGE
34
- },
35
-
36
- create: {
37
- help: <<~HELP,
38
- {{command:%s rails create}}: Creates a ruby on rails app.
39
- Usage: {{command:%s rails create}}
40
- Options:
41
- {{command:--name=NAME}} App name. Any string.
42
- {{command:--organization-id=ID}} Partner organization ID. Must be an existing organization.
43
- {{command:--store=MYSHOPIFYDOMAIN }} Development store URL. Must be an existing development store.
44
- {{command:--db=DB}} Database type. Must be one of: mysql, postgresql, sqlite3, oracle, frontbase, ibm_db, sqlserver, jdbcmysql, jdbcsqlite3, jdbcpostgresql, jdbc.
45
- {{command:--rails-opts=RAILSOPTS}} Additional options. Must be string containing one or more valid Rails options, separated by spaces.
46
- HELP
47
-
48
- error: {
49
- invalid_ruby_version: "This project requires a Ruby version ~> 2.5 or Ruby 3.0.",
50
- dir_exists: "Project directory %s already exists. Please use a different name.",
51
- install_failure: "Error installing %s gem",
52
- node_required: "node is required to create a rails project. Download at https://nodejs.org/en/download.",
53
- node_version_failure: "Failed to get the current node version. Please make sure it is installed as " \
54
- "per the instructions at https://nodejs.org/en.",
55
- yarn_required: "yarn is required to create a rails project. Download at " \
56
- "https://classic.yarnpkg.com/en/docs/install.",
57
- yarn_version_failure: "Failed to get the current yarn version. Please make sure it is installed as per " \
58
- "the instructions at https://classic.yarnpkg.com/en/docs/install.",
59
- },
60
-
61
- info: {
62
- open_new_shell: "{{*}} {{yellow:After installing %s, please open a new Command Prompt or PowerShell " \
63
- "window to continue.}}",
64
- },
65
- installing_bundler: "Installing bundler…",
66
- generating_app: "Generating new rails app project in %s…",
67
- adding_shopify_gem: "{{v}} Adding shopify_app gem…",
68
- node_version: "node %s",
69
- yarn_version: "yarn %s",
70
- running_bundle_install: "Running bundle install…",
71
- running_generator: "Running shopify_app generator…",
72
- running_migrations: "Running migrations…",
73
- running_webpacker_install: "Running webpacker:install…",
74
- },
75
-
76
24
  deploy: {
77
25
  help: <<~HELP,
78
26
  Deploy the current Rails project to a hosting service. Heroku ({{underline:https://www.heroku.com}}) is currently the only option, but more will be added in the future.
79
- Usage: {{command:%s rails deploy [ heroku ]}}
27
+ Usage: {{command:%s app rails deploy [ heroku ]}}
80
28
  HELP
81
29
  extended_help: <<~HELP,
82
30
  {{bold:Subcommands:}}
83
31
  {{cyan:heroku}}: Deploys the current Rails project to Heroku.
84
- Usage: {{command:%s rails deploy heroku}}
32
+ Usage: {{command:%s app rails deploy heroku}}
85
33
  HELP
86
-
87
- heroku: {
88
- help: <<~HELP,
89
- Deploy the current Rails project to Heroku
90
- Usage: {{command:%s rails deploy heroku}}
91
- HELP
92
- downloading: "Downloading Heroku CLI…",
93
- downloaded: "Downloaded Heroku CLI",
94
- installing: "Installing Heroku CLI…",
95
- installed: "Installed Heroku CLI",
96
- authenticated_with_account: "{{v}} Authenticated with Heroku as {{green:%s}}",
97
- authenticating: "Authenticating with Heroku…",
98
- authenticated: "{{v}} Authenticated with Heroku",
99
- deploying: "Deploying to Heroku…",
100
- deployed: "{{v}} Deployed to Heroku",
101
- db_check: {
102
- validating: "Validating application…",
103
- checking: "Checking database type…",
104
- validated: "Database type \"%s\" validated for platform \"Heroku\"",
105
- problem: "A problem was encountered while checking your database type.",
106
- sqlite: <<~SQLITE,
107
- Heroku does not support deployment using the SQLite database system.
108
- Change the database type using {{command:rails db:system:change --to=[new_db_type]}}. For more info:
109
- {{underline:https://gorails.com/episodes/rails-6-db-system-change-command}}
110
- SQLITE
111
- },
112
- git: {
113
- checking: "Checking git repo…",
114
- initialized: "Git repo initialized",
115
- what_branch: "What branch would you like to deploy?",
116
- branch_selected: "{{v}} Git branch {{green:%s}} selected for deploy",
117
- },
118
- app: {
119
- no_apps_found: "No existing Heroku app found. What would you like to do?",
120
- name: "What is your Heroku app’s name?",
121
- select: "Specify an existing Heroku app",
122
- selecting: "Selecting Heroku app %s…",
123
- selected: "{{v}} Heroku app {{green:%s}} selected",
124
- create: "Create a new Heroku app",
125
- creating: "Creating new Heroku app…",
126
- created: "{{v}} New Heroku app created",
127
- },
128
- },
129
34
  },
130
35
 
131
36
  generate: {
132
37
  help: <<~HELP,
133
38
  Generate code in your Rails project. Currently supports generating new webhooks.
134
- Usage: {{command:%s rails generate [ webhook ]}}
39
+ Usage: {{command:%s app rails generate [ webhook ]}}
135
40
  HELP
136
41
  extended_help: <<~EXAMPLES,
137
42
  {{bold:Examples:}}
@@ -147,66 +52,13 @@ module Rails
147
52
  webhook: {
148
53
  help: <<~HELP,
149
54
  Generate and register a new webhook that listens for the specified Shopify store event.
150
- Usage: {{command:%s rails generate webhook <type>}}
55
+ Usage: {{command:%s app rails generate webhook <type>}}
151
56
  HELP
152
57
 
153
58
  select: "What type of webhook would you like to create?",
154
59
  selected: "Generating webhook: %s",
155
60
  },
156
61
  },
157
-
158
- open: {
159
- help: <<~HELP,
160
- Open your local development app in the default browser.
161
- Usage: {{command:%s rails open}}
162
- HELP
163
- },
164
-
165
- serve: {
166
- help: <<~HELP,
167
- Start a local development rails server for your project, as well as a public ngrok tunnel to your localhost.
168
- Usage: {{command:%s rails serve}}
169
- HELP
170
- extended_help: <<~HELP,
171
- {{bold:Options:}}
172
- {{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
173
- HELP
174
-
175
- error: {
176
- host_must_be_https: "{{red:HOST must be a HTTPS url.}}",
177
- },
178
-
179
- open_info: <<~MESSAGE,
180
- {{*}} To install and start using your app, open this URL in your browser:
181
- {{green:%s}}
182
- MESSAGE
183
- running_server: "Running server…",
184
- },
185
-
186
- tunnel: {
187
- help: <<~HELP,
188
- Start or stop an http tunnel to your local development app using ngrok.
189
- Usage: {{command:%s rails tunnel [ auth | start | stop ]}}
190
- HELP
191
- extended_help: <<~HELP,
192
- {{bold:Subcommands:}}
193
-
194
- {{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.
195
- Usage: {{command:%1$s rails tunnel auth <token>}}
196
-
197
- {{cyan:start}}: Starts an ngrok tunnel, will print the URL for an existing tunnel if already running.
198
- Usage: {{command:%1$s rails tunnel start}}
199
-
200
- {{cyan:stop}}: Stops the ngrok tunnel.
201
- Usage: {{command:%1$s rails tunnel stop}}
202
-
203
- HELP
204
-
205
- error: {
206
- token_argument_missing: "{{x}} {{red:auth requires a token argument}}\n\n",
207
- },
208
- },
209
-
210
62
  forms: {
211
63
  create: {
212
64
  error: {
@@ -9,7 +9,7 @@ module Script
9
9
  end
10
10
 
11
11
  # define/autoload project specific Commands
12
- class Command < ShopifyCLI::ProjectCommands
12
+ class Command < ShopifyCLI::Command::ProjectCommand
13
13
  hidden_feature(feature_set: :script_project)
14
14
  subcommand :Create, "create", Project.project_filepath("commands/create")
15
15
  subcommand :Push, "push", Project.project_filepath("commands/push")
@@ -2,16 +2,16 @@
2
2
 
3
3
  module Script
4
4
  class Command
5
- class Create < ShopifyCLI::SubCommand
6
- prerequisite_task :ensure_authenticated
5
+ class Create < ShopifyCLI::Command::SubCommand
6
+ unless ShopifyCLI::Environment.acceptance_test?
7
+ prerequisite_task :ensure_authenticated
8
+ end
7
9
 
8
10
  options do |parser, flags|
9
11
  parser.on("--name=NAME") { |name| flags[:name] = name }
10
- parser.on("--extension_point=EP_NAME") { |ep_name| flags[:extension_point] = ep_name }
11
- parser.on("--extension-point=EP_NAME") { |ep_name| flags[:extension_point] = ep_name }
12
+ parser.on("--api=API_NAME") { |ep_name| flags[:extension_point] = ep_name }
12
13
  parser.on("--language=LANGUAGE") { |language| flags[:language] = language }
13
14
  parser.on("--branch=BRANCH") { |branch| flags[:branch] = branch }
14
- parser.on("--no-config-ui") { |no_config_ui| flags[:no_config_ui] = no_config_ui }
15
15
  end
16
16
 
17
17
  def call(args, _name)
@@ -28,7 +28,6 @@ module Script
28
28
  sparse_checkout_branch: options.flags[:branch] || "master",
29
29
  script_name: form.name,
30
30
  extension_point_type: form.extension_point,
31
- no_config_ui: options.flags.key?(:no_config_ui)
32
31
  )
33
32
  @ctx.puts(@ctx.message("script.create.change_directory_notice", project.script_name))
34
33
  rescue StandardError => e
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Script
4
4
  class Command
5
- class Push < ShopifyCLI::SubCommand
5
+ class Push < ShopifyCLI::Command::SubCommand
6
6
  prerequisite_task ensure_project_type: :script
7
7
 
8
8
  options do |parser, flags|
@@ -32,6 +32,7 @@ payment_methods:
32
32
  package: "@shopify/scripts-checkout-apis"
33
33
  typescript:
34
34
  beta: true
35
+ package: "@shopify/scripts-checkout-apis-temp"
35
36
  repo: "https://github.com/Shopify/scripts-apis-examples"
36
37
  shipping_methods:
37
38
  domain: 'checkout'
@@ -41,4 +42,13 @@ shipping_methods:
41
42
  package: "@shopify/scripts-checkout-apis"
42
43
  typescript:
43
44
  beta: true
45
+ package: "@shopify/scripts-checkout-apis-temp"
46
+ repo: "https://github.com/Shopify/scripts-apis-examples"
47
+ discount_types:
48
+ beta: true
49
+ domain: 'discounts'
50
+ libraries:
51
+ typescript:
52
+ beta: true
53
+ package: "@shopify/scripts-discount-apis"
44
54
  repo: "https://github.com/Shopify/scripts-apis-examples"
@@ -6,23 +6,5 @@ module Script
6
6
 
7
7
  class NoExistingAppsError < ScriptProjectError; end
8
8
  class NoExistingOrganizationsError < ScriptProjectError; end
9
-
10
- class NoExistingStoresError < ScriptProjectError
11
- attr_reader :organization_id
12
- def initialize(organization_id)
13
- super()
14
- @organization_id = organization_id
15
- end
16
- end
17
-
18
- class InvalidConfigProps < ScriptProjectError; end
19
-
20
- class InvalidConfigYAMLError < ScriptProjectError
21
- attr_reader :config_file
22
- def initialize(config_file)
23
- super()
24
- @config_file = config_file
25
- end
26
- end
27
9
  end
28
10
  end
@@ -10,6 +10,7 @@ mutation AppScriptSet(
10
10
  $configurationUi: Boolean!,
11
11
  $configurationDefinition: String!,
12
12
  $moduleUploadUrl: String!,
13
+ $library: LibraryInput,
13
14
  ) {
14
15
  appScriptSet(
15
16
  uuid: $uuid
@@ -23,6 +24,7 @@ mutation AppScriptSet(
23
24
  configurationUi: $configurationUi,
24
25
  configurationDefinition: $configurationDefinition,
25
26
  moduleUploadUrl: $moduleUploadUrl,
27
+ library: $library,
26
28
  ) {
27
29
  userErrors {
28
30
  field
@@ -5,7 +5,7 @@ module Script
5
5
  module Application
6
6
  class BuildScript
7
7
  class << self
8
- def call(ctx:, task_runner:, script_project:)
8
+ def call(ctx:, task_runner:, script_project:, library:)
9
9
  CLI::UI::Frame.open(ctx.message("script.application.building")) do
10
10
  begin
11
11
  UI::StrictSpinner.spin(ctx.message("script.application.building_script")) do |spinner|
@@ -14,6 +14,7 @@ module Script
14
14
  script_content: task_runner.build,
15
15
  compiled_type: task_runner.compiled_type,
16
16
  metadata: task_runner.metadata,
17
+ library: library,
17
18
  )
18
19
  spinner.update_title(ctx.message("script.application.built"))
19
20
  end