shopify-cli 1.14.0 → 2.0.0

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 (179) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -1
  3. data/.github/CONTRIBUTING.md +7 -7
  4. data/.github/DESIGN.md +3 -3
  5. data/.github/workflows/build.yml +1 -1
  6. data/.gitignore +3 -0
  7. data/.rubocop.yml +3 -1
  8. data/.ruby-version +1 -1
  9. data/CHANGELOG.md +35 -29
  10. data/Gemfile +4 -0
  11. data/Gemfile.lock +32 -0
  12. data/LICENSE +4 -1
  13. data/README.md +92 -26
  14. data/RELEASING.md +29 -7
  15. data/Rakefile +2 -2
  16. data/SECURITY.md +1 -1
  17. data/bin/load_shopify.rb +1 -1
  18. data/bin/shopify +3 -3
  19. data/dev.yml +1 -1
  20. data/docs/app/node/index.md +1 -1
  21. data/docs/app/rails/index.md +1 -1
  22. data/docs/core/index.md +1 -1
  23. data/docs/getting-started/index.md +1 -1
  24. data/docs/getting-started/install/index.md +1 -1
  25. data/docs/getting-started/migrate/index.md +1 -1
  26. data/docs/getting-started/uninstall/index.md +1 -1
  27. data/docs/getting-started/upgrade/index.md +1 -1
  28. data/docs/help/start-app/index.md +1 -1
  29. data/docs/index.md +1 -1
  30. data/ext/shopify-cli/extconf.rb +17 -5
  31. data/install.sh +1 -1
  32. data/lib/docgen/index_template.md.erb +2 -2
  33. data/lib/graphql/all_orgs_with_extensions.graphql +37 -0
  34. data/lib/graphql/find_organization.graphql +2 -1
  35. data/lib/project_types/extension/cli.rb +18 -15
  36. data/lib/project_types/extension/commands/build.rb +4 -5
  37. data/lib/project_types/extension/commands/connect.rb +35 -0
  38. data/lib/project_types/extension/commands/create.rb +12 -16
  39. data/lib/project_types/extension/commands/extension_command.rb +2 -2
  40. data/lib/project_types/extension/commands/info.rb +86 -0
  41. data/lib/project_types/extension/commands/push.rb +8 -7
  42. data/lib/project_types/extension/commands/register.rb +4 -5
  43. data/lib/project_types/extension/commands/serve.rb +5 -8
  44. data/lib/project_types/extension/commands/tunnel.rb +3 -1
  45. data/lib/project_types/extension/errors.rb +9 -0
  46. data/lib/project_types/extension/extension_project.rb +5 -0
  47. data/lib/project_types/extension/features/argo.rb +6 -6
  48. data/lib/project_types/extension/features/argo_runtime.rb +22 -66
  49. data/lib/project_types/extension/features/argo_serve.rb +25 -18
  50. data/lib/project_types/extension/forms/connect.rb +42 -0
  51. data/lib/project_types/extension/forms/questions/ask_name.rb +14 -6
  52. data/lib/project_types/extension/forms/questions/ask_registration.rb +51 -0
  53. data/lib/project_types/extension/messages/messages.rb +75 -11
  54. data/lib/project_types/extension/models/specification.rb +1 -0
  55. data/lib/project_types/extension/models/specification_handlers/{checkout_argo_extension.rb → checkout_ui_extension.rb} +3 -1
  56. data/lib/project_types/extension/models/specification_handlers/default.rb +13 -3
  57. data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +86 -0
  58. data/lib/project_types/extension/models/specifications.rb +1 -0
  59. data/lib/project_types/extension/tasks/configure_features.rb +6 -7
  60. data/lib/project_types/extension/tasks/configure_options.rb +20 -0
  61. data/lib/project_types/extension/tasks/get_extensions.rb +32 -0
  62. data/lib/project_types/node/cli.rb +9 -21
  63. data/lib/project_types/node/commands/connect.rb +8 -2
  64. data/lib/project_types/node/commands/create.rb +9 -5
  65. data/lib/project_types/node/commands/deploy.rb +15 -5
  66. data/lib/project_types/node/commands/deploy/heroku.rb +29 -29
  67. data/lib/project_types/node/commands/generate.rb +4 -2
  68. data/lib/project_types/node/commands/open.rb +4 -2
  69. data/lib/project_types/node/commands/serve.rb +3 -2
  70. data/lib/project_types/node/commands/tunnel.rb +4 -2
  71. data/lib/project_types/node/messages/messages.rb +46 -89
  72. data/lib/project_types/rails/cli.rb +9 -21
  73. data/lib/project_types/rails/commands/connect.rb +8 -2
  74. data/lib/project_types/rails/commands/create.rb +10 -6
  75. data/lib/project_types/rails/commands/deploy.rb +15 -5
  76. data/lib/project_types/rails/commands/deploy/heroku.rb +84 -82
  77. data/lib/project_types/rails/commands/generate.rb +15 -5
  78. data/lib/project_types/rails/commands/generate/webhook.rb +28 -26
  79. data/lib/project_types/rails/commands/open.rb +4 -2
  80. data/lib/project_types/rails/commands/serve.rb +3 -2
  81. data/lib/project_types/rails/commands/tunnel.rb +4 -2
  82. data/lib/project_types/rails/messages/messages.rb +54 -101
  83. data/lib/project_types/script/cli.rb +5 -7
  84. data/lib/project_types/script/commands/create.rb +3 -1
  85. data/lib/project_types/script/commands/push.rb +4 -2
  86. data/lib/project_types/script/messages/messages.rb +52 -45
  87. data/lib/project_types/script/ui/error_handler.rb +2 -2
  88. data/lib/project_types/theme/cli.rb +15 -27
  89. data/lib/project_types/theme/commands/check.rb +33 -0
  90. data/lib/project_types/theme/commands/delete.rb +64 -0
  91. data/lib/project_types/theme/commands/language_server.rb +16 -0
  92. data/lib/project_types/theme/commands/package.rb +55 -0
  93. data/lib/project_types/theme/commands/publish.rb +43 -0
  94. data/lib/project_types/theme/commands/pull.rb +51 -0
  95. data/lib/project_types/theme/commands/push.rb +58 -32
  96. data/lib/project_types/theme/commands/serve.rb +7 -17
  97. data/lib/project_types/theme/forms/confirm_store.rb +15 -0
  98. data/lib/project_types/theme/forms/select.rb +59 -0
  99. data/lib/project_types/theme/messages/messages.rb +110 -106
  100. data/lib/project_types/theme/ui/sync_progress_bar.rb +20 -0
  101. data/lib/shopify-cli/admin_api.rb +53 -38
  102. data/lib/shopify-cli/admin_api/populate_resource_command.rb +6 -14
  103. data/lib/shopify-cli/admin_api/schema.rb +1 -10
  104. data/lib/shopify-cli/api.rb +29 -14
  105. data/lib/shopify-cli/command.rb +15 -3
  106. data/lib/shopify-cli/commands.rb +7 -2
  107. data/lib/shopify-cli/commands/help.rb +2 -29
  108. data/lib/shopify-cli/commands/login.rb +95 -0
  109. data/lib/shopify-cli/commands/logout.rb +24 -8
  110. data/lib/shopify-cli/commands/populate.rb +23 -0
  111. data/lib/{project_types/node → shopify-cli}/commands/populate/customer.rb +2 -8
  112. data/lib/{project_types/node → shopify-cli}/commands/populate/draft_order.rb +2 -2
  113. data/lib/{project_types/node → shopify-cli}/commands/populate/product.rb +2 -8
  114. data/lib/shopify-cli/commands/store.rb +15 -0
  115. data/lib/shopify-cli/commands/switch.rb +39 -0
  116. data/lib/shopify-cli/commands/system.rb +12 -0
  117. data/lib/shopify-cli/commands/whoami.rb +28 -0
  118. data/lib/shopify-cli/connect.rb +32 -0
  119. data/lib/shopify-cli/context.rb +52 -4
  120. data/lib/shopify-cli/core/entry_point.rb +3 -22
  121. data/lib/shopify-cli/db.rb +4 -4
  122. data/lib/shopify-cli/http_request.rb +10 -0
  123. data/lib/shopify-cli/identity_auth.rb +282 -0
  124. data/lib/shopify-cli/{oauth → identity_auth}/servlet.rb +11 -12
  125. data/lib/shopify-cli/messages/messages.rb +132 -39
  126. data/lib/shopify-cli/partners_api.rb +21 -44
  127. data/lib/shopify-cli/partners_api/organizations.rb +8 -0
  128. data/lib/shopify-cli/project_commands.rb +16 -0
  129. data/lib/shopify-cli/project_type.rb +0 -31
  130. data/lib/shopify-cli/shopifolk.rb +8 -11
  131. data/lib/shopify-cli/sub_command.rb +1 -0
  132. data/lib/shopify-cli/tasks.rb +3 -0
  133. data/lib/shopify-cli/tasks/confirm_store.rb +18 -0
  134. data/lib/shopify-cli/tasks/create_api_client.rb +2 -2
  135. data/lib/shopify-cli/tasks/ensure_authenticated.rb +13 -0
  136. data/lib/shopify-cli/tasks/ensure_loopback_url.rb +1 -1
  137. data/lib/shopify-cli/tasks/ensure_project_type.rb +12 -0
  138. data/lib/shopify-cli/tasks/select_org_and_shop.rb +0 -3
  139. data/lib/shopify-cli/theme/dev_server.rb +98 -0
  140. data/lib/shopify-cli/theme/dev_server/certificate_manager.rb +79 -0
  141. data/lib/shopify-cli/theme/dev_server/header_hash.rb +94 -0
  142. data/lib/shopify-cli/theme/dev_server/hot-reload.js +93 -0
  143. data/lib/shopify-cli/theme/dev_server/hot_reload.rb +76 -0
  144. data/lib/shopify-cli/theme/dev_server/local_assets.rb +87 -0
  145. data/lib/shopify-cli/theme/dev_server/proxy.rb +205 -0
  146. data/lib/shopify-cli/theme/dev_server/sse.rb +75 -0
  147. data/lib/shopify-cli/theme/dev_server/watcher.rb +59 -0
  148. data/lib/shopify-cli/theme/dev_server/web_server.rb +140 -0
  149. data/lib/shopify-cli/theme/development_theme.rb +69 -0
  150. data/lib/shopify-cli/theme/file.rb +112 -0
  151. data/lib/shopify-cli/theme/ignore_filter.rb +109 -0
  152. data/lib/shopify-cli/theme/mime_type.rb +34 -0
  153. data/lib/shopify-cli/theme/syncer.rb +328 -0
  154. data/lib/shopify-cli/theme/theme.rb +204 -0
  155. data/lib/shopify-cli/version.rb +1 -1
  156. data/lib/shopify_cli.rb +18 -11
  157. data/shopify-cli.gemspec +12 -5
  158. data/shopify.fish +1 -1
  159. data/shopify.sh +1 -1
  160. metadata +88 -34
  161. data/.github/workflows/release.yml +0 -59
  162. data/lib/project_types/extension/features/argo_serve_options.rb +0 -42
  163. data/lib/project_types/node/commands/populate.rb +0 -23
  164. data/lib/project_types/rails/commands/populate.rb +0 -23
  165. data/lib/project_types/rails/commands/populate/customer.rb +0 -31
  166. data/lib/project_types/rails/commands/populate/draft_order.rb +0 -28
  167. data/lib/project_types/rails/commands/populate/product.rb +0 -30
  168. data/lib/project_types/theme/commands/connect.rb +0 -54
  169. data/lib/project_types/theme/commands/create.rb +0 -48
  170. data/lib/project_types/theme/commands/deploy.rb +0 -38
  171. data/lib/project_types/theme/commands/generate.rb +0 -20
  172. data/lib/project_types/theme/commands/generate/env.rb +0 -79
  173. data/lib/project_types/theme/forms/connect.rb +0 -34
  174. data/lib/project_types/theme/forms/create.rb +0 -22
  175. data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +0 -78
  176. data/lib/project_types/theme/themekit.rb +0 -113
  177. data/lib/shopify-cli/commands/connect.rb +0 -64
  178. data/lib/shopify-cli/commands/create.rb +0 -50
  179. data/lib/shopify-cli/oauth.rb +0 -198
@@ -3,10 +3,12 @@
3
3
  require "shopify_cli"
4
4
 
5
5
  module Rails
6
- module Commands
7
- class Tunnel < ShopifyCli::Command
6
+ class Command
7
+ class Tunnel < ShopifyCli::SubCommand
8
8
  # subcommands :auth, :start, :stop
9
9
 
10
+ prerequisite_task ensure_project_type: :rails
11
+
10
12
  def call(args, _name)
11
13
  subcommand = args.shift
12
14
  case subcommand
@@ -4,6 +4,11 @@ module Rails
4
4
  module Messages
5
5
  MESSAGES = {
6
6
  rails: {
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 ]}}
10
+ HELP
11
+
7
12
  error: {
8
13
  generic: "Error",
9
14
  },
@@ -19,30 +24,29 @@ module Rails
19
24
 
20
25
  connect: {
21
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
22
31
  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.
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.
24
33
  MESSAGE
25
34
  },
26
35
 
27
36
  create: {
28
37
  help: <<~HELP,
29
- {{command:%s create rails}}: Creates a ruby on rails app.
30
- Usage: {{command:%s create rails}}
31
- Options:
32
- {{command:--name=NAME}} App name. Any string.
33
- {{command:--app-url=APPURL}} App URL. Must be a valid URL.
34
- {{command:--organization-id=ID}} Partner organization ID. Must be an existing organization.
35
- {{command:--shop-domain=MYSHOPIFYDOMAIN }} Development store URL. Must be an existing development store.
36
- {{command:--db=DB}} Database type. Must be one of: mysql, postgresql, sqlite3, oracle, frontbase, ibm_db, sqlserver, jdbcmysql, jdbcsqlite3, jdbcpostgresql, jdbc.
37
- {{command:--rails-opts=RAILSOPTS}} Additional options. Must be string containing one or more valid Rails options, separated by spaces.
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.
38
46
  HELP
39
47
 
40
48
  error: {
41
- invalid_ruby_version: <<~MSG,
42
- This project requires a Ruby version ~> 2.5 or Ruby 3.0
43
- See {{underline:https://github.com/Shopify/shopify-app-cli/blob/master/docs/installing-ruby.md}}
44
- for our recommended method of installing ruby.
45
- MSG
49
+ invalid_ruby_version: "This project requires a Ruby version ~> 2.5 or Ruby 3.0.",
46
50
  dir_exists: "Project directory %s already exists. Please use a different name.",
47
51
  install_failure: "Error installing %s gem",
48
52
  node_required: "node is required to create a rails project. Download at https://nodejs.org/en/download.",
@@ -71,19 +75,19 @@ module Rails
71
75
 
72
76
  deploy: {
73
77
  help: <<~HELP,
74
- 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.
75
- Usage: {{command:%s deploy [ heroku ]}}
78
+ 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 ]}}
76
80
  HELP
77
81
  extended_help: <<~HELP,
78
- {{bold:Subcommands:}}
79
- {{cyan:heroku}}: Deploys the current Rails project to Heroku.
80
- Usage: {{command:%s deploy heroku}}
82
+ {{bold:Subcommands:}}
83
+ {{cyan:heroku}}: Deploys the current Rails project to Heroku.
84
+ Usage: {{command:%s rails deploy heroku}}
81
85
  HELP
82
86
 
83
87
  heroku: {
84
88
  help: <<~HELP,
85
- Deploy the current Rails project to Heroku
86
- Usage: {{command:%s deploy heroku}}
89
+ Deploy the current Rails project to Heroku
90
+ Usage: {{command:%s rails deploy heroku}}
87
91
  HELP
88
92
  downloading: "Downloading Heroku CLI...",
89
93
  downloaded: "Downloaded Heroku CLI",
@@ -100,9 +104,9 @@ module Rails
100
104
  validated: "Database type \"%s\" validated for platform \"Heroku\"",
101
105
  problem: "A problem was encountered while checking your database type.",
102
106
  sqlite: <<~SQLITE,
103
- Heroku does not support deployment using the SQLite database system.
104
- Change the database type using {{command:rails db:system:change --to=[new_db_type]}}. For more info:
105
- {{underline:https://gorails.com/episodes/rails-6-db-system-change-command}}
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}}
106
110
  SQLITE
107
111
  },
108
112
  git: {
@@ -126,13 +130,13 @@ module Rails
126
130
 
127
131
  generate: {
128
132
  help: <<~HELP,
129
- Generate code in your Rails project. Currently supports generating new webhooks.
130
- Usage: {{command:%s generate [ webhook ]}}
133
+ Generate code in your Rails project. Currently supports generating new webhooks.
134
+ Usage: {{command:%s rails generate [ webhook ]}}
131
135
  HELP
132
136
  extended_help: <<~EXAMPLES,
133
- {{bold:Examples:}}
134
- {{cyan:%s generate webhook PRODUCTS_CREATE}}
135
- Generate and register a new webhook that will be called every time a new product is created on your store.
137
+ {{bold:Examples:}}
138
+ {{cyan:%s generate webhook PRODUCTS_CREATE}}
139
+ Generate and register a new webhook that will be called every time a new product is created on your store.
136
140
  EXAMPLES
137
141
 
138
142
  error: {
@@ -142,8 +146,8 @@ module Rails
142
146
 
143
147
  webhook: {
144
148
  help: <<~HELP,
145
- Generate and register a new webhook that listens for the specified Shopify store event.
146
- Usage: {{command:%s generate webhook <type>}}
149
+ Generate and register a new webhook that listens for the specified Shopify store event.
150
+ Usage: {{command:%s rails generate webhook <type>}}
147
151
  HELP
148
152
 
149
153
  select: "What type of webhook would you like to create?",
@@ -153,70 +157,19 @@ module Rails
153
157
 
154
158
  open: {
155
159
  help: <<~HELP,
156
- Open your local development app in the default browser.
157
- Usage: {{command:%s open}}
158
- HELP
159
- },
160
-
161
- populate: {
162
- help: <<~HELP,
163
- Populate your Shopify development store with example customers, orders, or products.
164
- Usage: {{command:%s populate [ customers | draftorders | products ]}}
160
+ Open your local development app in the default browser.
161
+ Usage: {{command:%s rails open}}
165
162
  HELP
166
- extended_help: <<~HELP,
167
- {{bold:Subcommands:}}
168
-
169
- {{cyan:customers [options]}}: Add dummy customers to the specified development store.
170
- Usage: {{command:%1$s populate customers}}
171
-
172
- {{cyan:draftorders [options]}}: Add dummy orders to the specified development store.
173
- Usage: {{command:%1$s populate draftorders}}
174
-
175
- {{cyan:products [options]}}: Add dummy products to the specified development store.
176
- Usage: {{command:%1$s populate products}}
177
-
178
- {{bold:Options:}}
179
-
180
- {{cyan:--count [integer]}}: The number of dummy items to populate. Defaults to 5.
181
- {{cyan:--silent}}: Silence the populate output.
182
- {{cyan:--help}}: Display more options specific to each subcommand.
183
-
184
- {{bold:Examples:}}
185
-
186
- {{command:%1$s populate products}}
187
- Populate your development store with 5 additional products.
188
-
189
- {{command:%1$s populate customers --count 30}}
190
- Populate your development store with 30 additional customers.
191
-
192
- {{command:%1$s populate draftorders}}
193
- Populate your development store with 5 additional orders.
194
-
195
- {{command:%1$s populate products --help}}
196
- Display the list of options available to customize the {{command:%1$s populate products}} command.
197
- HELP
198
-
199
- customer: {
200
- added: "%s added to {{green:%s}} at {{underline:%scustomers/%d}}",
201
- },
202
-
203
- draft_order: {
204
- added: "DraftOrder added to {{green:%s}} at {{underline:%sdraft_orders/%d}}",
205
- },
206
-
207
- product: {
208
- added: "%s added to {{green:%s}} at {{underline:%sproducts/%d}}",
209
- },
210
163
  },
211
164
 
212
165
  serve: {
213
166
  help: <<~HELP,
214
- Start a local development rails server for your project, as well as a public ngrok tunnel to your localhost.
215
- Usage: {{command:%s serve}}
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}}
216
169
  HELP
217
170
  extended_help: <<~HELP,
218
- {{bold:Options:}}
219
- {{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
171
+ {{bold:Options:}}
172
+ {{cyan:--host=HOST}}: Bypass running tunnel and use custom host. HOST must be HTTPS url.
220
173
  HELP
221
174
 
222
175
  error: {
@@ -232,20 +185,20 @@ module Rails
232
185
 
233
186
  tunnel: {
234
187
  help: <<~HELP,
235
- Start or stop an http tunnel to your local development app using ngrok.
236
- Usage: {{command:%s tunnel [ auth | start | stop ]}}
188
+ Start or stop an http tunnel to your local development app using ngrok.
189
+ Usage: {{command:%s rails tunnel [ auth | start | stop ]}}
237
190
  HELP
238
191
  extended_help: <<~HELP,
239
- {{bold:Subcommands:}}
192
+ {{bold:Subcommands:}}
240
193
 
241
- {{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.
242
- Usage: {{command:%1$s tunnel auth <token>}}
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>}}
243
196
 
244
- {{cyan:start}}: Starts an ngrok tunnel, will print the URL for an existing tunnel if already running.
245
- Usage: {{command:%1$s tunnel start}}
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}}
246
199
 
247
- {{cyan:stop}}: Stops the ngrok tunnel.
248
- Usage: {{command:%1$s tunnel stop}}
200
+ {{cyan:stop}}: Stops the ngrok tunnel.
201
+ Usage: {{command:%1$s rails tunnel stop}}
249
202
 
250
203
  HELP
251
204
 
@@ -270,9 +223,9 @@ module Rails
270
223
  },
271
224
  db: {
272
225
  want_select: <<~WANT_SELECT,
273
- Would you like to select what database type to use now? (SQLite is the default)
274
- If you want to change this in the future, run {{command:rails db:system:change --to=[new_db_type]}}. For more info:
275
- {{underline:https://gorails.com/episodes/rails-6-db-system-change-command}}
226
+ Would you like to select what database type to use now? (SQLite is the default)
227
+ If you want to change this in the future, run {{command:rails db:system:change --to=[new_db_type]}}. For more info:
228
+ {{underline:https://gorails.com/episodes/rails-6-db-system-change-command}}
276
229
  WANT_SELECT
277
230
  select: "What database type would you like to use? Please ensure the database is installed.",
278
231
  select_sqlite3: "SQLite (default)",
@@ -3,20 +3,18 @@
3
3
  module Script
4
4
  class Project < ShopifyCli::ProjectType
5
5
  hidden_feature(feature_set: :script_project)
6
- title("Script")
7
- creator("Script::Commands::Create")
8
-
9
- register_command("Script::Commands::Push", "push")
10
6
 
11
7
  require Project.project_filepath("messages/messages")
12
8
  register_messages(Script::Messages::MESSAGES)
13
9
  end
14
10
 
15
11
  # define/autoload project specific Commands
16
- module Commands
17
- autoload :Create, Project.project_filepath("commands/create")
18
- autoload :Push, Project.project_filepath("commands/push")
12
+ class Command < ShopifyCli::ProjectCommands
13
+ hidden_feature(feature_set: :script_project)
14
+ subcommand :Create, "create", Project.project_filepath("commands/create")
15
+ subcommand :Push, "push", Project.project_filepath("commands/push")
19
16
  end
17
+ ShopifyCli::Commands.register("Script::Command", "script")
20
18
 
21
19
  # define/autoload project specific Forms
22
20
  module Forms
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Script
4
- module Commands
4
+ class Command
5
5
  class Create < ShopifyCli::SubCommand
6
+ prerequisite_task :ensure_authenticated
7
+
6
8
  options do |parser, flags|
7
9
  parser.on("--name=NAME") { |name| flags[:name] = name }
8
10
  parser.on("--extension_point=EP_NAME") { |ep_name| flags[:extension_point] = ep_name }
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Script
4
- module Commands
5
- class Push < ShopifyCli::Command
4
+ class Command
5
+ class Push < ShopifyCli::SubCommand
6
+ prerequisite_task ensure_project_type: :script
7
+
6
8
  options do |parser, flags|
7
9
  parser.on("--force") { |t| flags[:force] = t }
8
10
  end
@@ -4,22 +4,28 @@ module Script
4
4
  module Messages
5
5
  MESSAGES = {
6
6
  script: {
7
+ help: <<~HELP,
8
+ Suite of commands for developing script applications. See {{command:%1$s script <command> --help}} for usage of each command.
9
+ Usage: {{command:%1$s script [ %2$s ]}}
10
+ HELP
11
+
7
12
  error: {
8
- deprecated_ep: "This project uses an extension point %s which has been deprecated. "\
9
- "This Script will no longer function in production.",
10
- deprecated_ep_cause: "Try using a different extension point.",
13
+ deprecated_ep: "This project uses a Script API (%s) that has been deprecated. "\
14
+ "This Script won't work in production.",
15
+ deprecated_ep_cause: "Try using a different Script API.",
11
16
  generic: "{{red:{{x}} Error}}",
12
17
  eacces_cause: "You don't have permission to write to this directory.",
13
- eacces_help: "Change your directory permissions and try again.",
18
+ eacces_help: "Try again and choose a different directory.",
14
19
 
15
- enospc_cause: "You don't have enough disk space to perform this action.",
20
+ enospc_cause: "You don't have enough disk space to do this action.",
16
21
  enospc_help: "Free up some space and try again.",
17
22
 
18
23
  oauth_cause: "Something went wrong while authenticating your account with the Partner Dashboard.",
19
24
  oauth_help: "Try again.",
20
25
 
21
- invalid_context_cause: "Your .shopify-cli.yml file is not correct.",
22
- invalid_context_help: "See https://help.shopify.com",
26
+ invalid_context_cause: "Your .shopify-cli.yml file is not correct. Values are missing for "\
27
+ "extension_point_type or script_name.",
28
+ invalid_context_help: "Add these values and try again.",
23
29
 
24
30
  invalid_config_props_cause: "{{command:--config-props}} is formatted incorrectly.",
25
31
  invalid_config_props_help: "Try again using this format: "\
@@ -29,27 +35,27 @@ module Script
29
35
  invalid_script_name_help: "Replace or remove unsupported characters. Valid characters "\
30
36
  "are numbers, letters, hyphens, or underscores.",
31
37
 
32
- no_existing_apps_cause: "You don't have any apps.",
33
- no_existing_apps_help: "Create an app with {{command:shopify create}} or "\
34
- "visit https://partners.shopify.com/.",
38
+ no_existing_apps_cause: "You don't have any apps in your Partner Dashboard.",
39
+ no_existing_apps_help: "Create an app with {{command:shopify [node|rails] create}}" \
40
+ " or visit https://partners.shopify.com/.",
35
41
 
36
42
  no_existing_orgs_cause: "You don't have any partner organizations.",
37
43
  no_existing_orgs_help: "Visit https://partners.shopify.com/ to create a partners account.",
38
44
 
39
- no_existing_stores_cause: "You don't have any stores.",
45
+ no_existing_stores_cause: "You don't have any stores in your Partner Dashboard.",
40
46
  no_existing_stores_help: "Visit https://partners.shopify.com/%{organization_id}/stores/ to create one.",
41
47
 
42
- project_exists_cause: "Directory with the same name as the script already exists.",
43
- project_exists_help: "Use different script name and try again.",
48
+ project_exists_cause: "A directory with this same name already exists.",
49
+ project_exists_help: "Try again and enter a different name for the script.",
44
50
 
45
- invalid_extension_cause: "Invalid extension point %s.",
51
+ invalid_extension_cause: "Invalid Script API %s.",
46
52
  invalid_extension_help: "Allowed values: %s.",
47
53
 
48
54
  invalid_language_cause: "Invalid language %s.",
49
55
  invalid_language_help: "Allowed values: %s.",
50
56
 
51
57
  invalid_config: "Can't change the configuration values because %1$s is missing or "\
52
- "it is not formatted properly.",
58
+ "it isn't formatted properly.",
53
59
 
54
60
  missing_script_json_field_cause: "The script.json file is missing the required %s field.",
55
61
  missing_script_json_field_help: "Add the field and try again.",
@@ -57,43 +63,44 @@ module Script
57
63
  invalid_script_json_definition_cause: "The script.json file contains invalid JSON.",
58
64
  invalid_script_json_definition_help: "Fix the errors and try again.",
59
65
 
60
- no_script_json_file_cause: "You are missing the required script.json file.",
66
+ no_script_json_file_cause: "The script.json file is missing.",
61
67
  no_script_json_file_help: "Create this file and try again.",
62
68
 
63
- configuration_syntax_error_cause: "The script.json configuration schema is not formatted properly.",
69
+ configuration_syntax_error_cause: "The script.json is not formatted properly.",
64
70
  configuration_syntax_error_help: "Fix the errors and try again.",
65
71
 
66
- configuration_missing_keys_error_cause: "The script.json configuration schema is missing required keys: "\
72
+ configuration_missing_keys_error_cause: "The script.json file is missing required keys: "\
67
73
  "%{missing_keys}.",
68
74
  configuration_missing_keys_error_help: "Add the keys and try again.",
69
75
 
70
76
  configuration_invalid_value_error_cause: "The script.json configuration only accepts "\
71
- "one of the following types(s): %{valid_input_modes}.",
77
+ "one of the following types(s): %{valid_input_modes}.",
72
78
  configuration_invalid_value_error_help: "Change the type and try again.",
73
79
 
74
- configuration_schema_field_missing_keys_error_cause: "A field entry in the script.json configuration "\
75
- "schema is missing required keys: %{missing_keys}.",
80
+ configuration_schema_field_missing_keys_error_cause: "A configuration entry in the script.json file "\
81
+ "is missing required keys: %{missing_keys}.",
76
82
  configuration_definition_schema_field_missing_keys_error_help: "Add the keys and try again.",
77
83
 
78
- configuration_schema_field_invalid_value_error_cause: "The script.json configuration schema fields only "\
79
- "accept one of the following type(s): %{valid_types}.",
84
+ configuration_schema_field_invalid_value_error_cause: "The configuration entries in the "\
85
+ "script.json file only accept one of the following "\
86
+ "type(s): %{valid_types}.",
80
87
  configuration_schema_field_invalid_value_error_help: "Change the types and try again.",
81
88
 
82
- script_not_found_cause: "Couldn't find script %s for extension point %s",
89
+ script_not_found_cause: "Couldn't find a script %s for the Script API %s",
83
90
 
84
91
  system_call_failure_cause: "An error was returned while running {{command:%{cmd}}}.",
85
92
  system_call_failure_help: "Review the following error and try again.\n{{red:%{out}}}",
86
93
 
87
- metadata_validation_cause: "Invalid script extension metadata.",
94
+ metadata_validation_cause: "Invalid Script API metadata.",
88
95
  metadata_validation_help: "Ensure the 'shopify/scripts-toolchain-as' package is up to date.",
89
96
 
90
- metadata_schema_versions_missing: "Invalid script metadata:" \
97
+ metadata_schema_versions_missing: "Invalid Script metadata:" \
91
98
  " 'schemaVersions' field is missing",
92
- metadata_schema_versions_single_key: "Invalid script extension metadata:" \
93
- " 'schemaVersions' can have only one extension point name.",
94
- metadata_schema_versions_missing_major: "Invalid script extension metadata:" \
99
+ metadata_schema_versions_single_key: "Invalid Script API metadata:" \
100
+ " 'schemaVersions' can have only one Script API name.",
101
+ metadata_schema_versions_missing_major: "Invalid Script API metadata:" \
95
102
  " 'schemaVersions' is missing the 'major' field",
96
- metadata_schema_versions_missing_minor: "Invalid script extension metadata:" \
103
+ metadata_schema_versions_missing_minor: "Invalid Script API metadata:" \
97
104
  " 'schemaVersions' is missing the 'minor' field",
98
105
 
99
106
  metadata_not_found_cause: "Script version file (%s) cannot be found.",
@@ -105,7 +112,7 @@ module Script
105
112
  build_error_cause: "Something went wrong while building the script.",
106
113
  build_error_help: "Correct the errors and try again.",
107
114
 
108
- dependency_install_cause: "Something went wrong while installing the dependencies that are needed.",
115
+ dependency_install_cause: "Something went wrong while installing the needed dependencies.",
109
116
  dependency_install_help: "Correct the errors and try again.",
110
117
 
111
118
  failed_api_request_cause: "Something went wrong while communicating with Shopify.",
@@ -116,7 +123,7 @@ module Script
116
123
  graphql_error_cause: "An error was returned: %s.",
117
124
  graphql_error_help: "\nReview the error and try again.",
118
125
 
119
- script_repush_cause: "A script with this UUID already exists (UUID: %s).",
126
+ script_repush_cause: "A version of this script already exists on the app.",
120
127
  script_repush_help: "Use {{cyan:--force}} to replace the existing script.",
121
128
 
122
129
  shop_auth_cause: "Unable to authenticate with the store.",
@@ -138,12 +145,12 @@ module Script
138
145
 
139
146
  create: {
140
147
  help: <<~HELP,
141
- {{command:%1$s create script}}: Creates a script project.
142
- Usage: {{command:%1$s create script}}
143
- Options:
144
- {{command:--name=NAME}} Script project name. Use any string.
145
- {{command:--extension-point=TYPE}} Extension point name. Allowed values: %2$s.
146
- {{command:--no-config-ui}} Specify this option if you don’t want Scripts to render an interface in the Shopify admin.
148
+ {{command:%1$s script create}}: Creates a script project.
149
+ Usage: {{command:%1$s script create}}
150
+ Options:
151
+ {{command:--name=NAME}} Script project name. Use any string.
152
+ {{command:--extension-point=TYPE}} Script API name. Allowed values: %2$s.
153
+ {{command:--no-config-ui}} Specify this option when you don’t want your script to render an interface in Shopify admin.
147
154
  HELP
148
155
 
149
156
  error: {
@@ -157,10 +164,10 @@ module Script
157
164
 
158
165
  push: {
159
166
  help: <<~HELP,
160
- Build the script and put it into production. If you've already pushed a script with the same extension point, use --force to replace the current script with the newest one.
161
- Usage: {{command:%s push}}
162
- Options:
163
- {{command:[--force]}} Forces the script to be overwritten if an instance of it already exists.
167
+ Build the script, upload it to Shopify, and register it to an app. If you've already pushed the script to this app, then use --force to replace the existing version on the app.
168
+ Usage: {{command:%s script push}}
169
+ Options:
170
+ {{command:[--force]}} Replaces the existing script on the app with this version.
164
171
  HELP
165
172
 
166
173
  error: {
@@ -180,9 +187,9 @@ module Script
180
187
 
181
188
  forms: {
182
189
  create: {
183
- select_extension_point: "Which extension point do you want to use?",
190
+ select_extension_point: "Which Script API do you want to use?",
184
191
  select_language: "Which language do you want to use?",
185
- script_name: "Script Name",
192
+ script_name: "Script name",
186
193
  },
187
194
  },
188
195
 
@@ -202,7 +209,7 @@ module Script
202
209
  app: "Script will be pushed to app {{green:%s}}.",
203
210
  app_select: "Which app do you want to push this script to?",
204
211
  ask_connect_to_existing_script: "The selected app has some scripts. Do you want to replace any of the "\
205
- "existing scripts with the current script?",
212
+ "existing scripts on the app with this script?",
206
213
  ask_which_script_to_connect_to: "Which script do you want to replace?",
207
214
  },
208
215
  },