shopify-cli 1.12.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) 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/PULL_REQUEST_TEMPLATE.md +1 -1
  6. data/.github/workflows/build.yml +1 -1
  7. data/.gitignore +3 -0
  8. data/.rubocop.yml +3 -1
  9. data/.ruby-version +1 -1
  10. data/CHANGELOG.md +52 -21
  11. data/Gemfile +4 -0
  12. data/Gemfile.lock +32 -0
  13. data/LICENSE +4 -1
  14. data/README.md +92 -26
  15. data/RELEASING.md +31 -7
  16. data/Rakefile +2 -2
  17. data/SECURITY.md +1 -1
  18. data/bin/load_shopify.rb +1 -1
  19. data/bin/shopify +3 -3
  20. data/dev.yml +1 -1
  21. data/docs/app/node/index.md +1 -1
  22. data/docs/app/rails/index.md +1 -1
  23. data/docs/core/index.md +1 -1
  24. data/docs/getting-started/index.md +1 -1
  25. data/docs/getting-started/install/index.md +1 -1
  26. data/docs/getting-started/migrate/index.md +1 -1
  27. data/docs/getting-started/uninstall/index.md +1 -1
  28. data/docs/getting-started/upgrade/index.md +1 -1
  29. data/docs/help/start-app/index.md +1 -1
  30. data/docs/index.md +1 -1
  31. data/ext/shopify-cli/extconf.rb +17 -5
  32. data/install.sh +1 -1
  33. data/lib/docgen/index_template.md.erb +2 -2
  34. data/lib/graphql/all_orgs_with_extensions.graphql +37 -0
  35. data/lib/graphql/find_organization.graphql +2 -1
  36. data/lib/project_types/extension/cli.rb +18 -15
  37. data/lib/project_types/extension/commands/build.rb +4 -5
  38. data/lib/project_types/extension/commands/connect.rb +35 -0
  39. data/lib/project_types/extension/commands/create.rb +12 -16
  40. data/lib/project_types/extension/commands/extension_command.rb +2 -2
  41. data/lib/project_types/extension/commands/info.rb +86 -0
  42. data/lib/project_types/extension/commands/push.rb +8 -7
  43. data/lib/project_types/extension/commands/register.rb +4 -5
  44. data/lib/project_types/extension/commands/serve.rb +5 -8
  45. data/lib/project_types/extension/commands/tunnel.rb +3 -1
  46. data/lib/project_types/extension/errors.rb +9 -0
  47. data/lib/project_types/extension/extension_project.rb +5 -0
  48. data/lib/project_types/extension/features/argo.rb +6 -6
  49. data/lib/project_types/extension/features/argo_runtime.rb +22 -59
  50. data/lib/project_types/extension/features/argo_serve.rb +25 -21
  51. data/lib/project_types/extension/forms/connect.rb +42 -0
  52. data/lib/project_types/extension/forms/questions/ask_name.rb +14 -6
  53. data/lib/project_types/extension/forms/questions/ask_registration.rb +51 -0
  54. data/lib/project_types/extension/messages/messages.rb +75 -11
  55. data/lib/project_types/extension/models/specification.rb +1 -0
  56. data/lib/project_types/extension/models/specification_handlers/{checkout_argo_extension.rb → checkout_ui_extension.rb} +3 -1
  57. data/lib/project_types/extension/models/specification_handlers/default.rb +13 -13
  58. data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +89 -0
  59. data/lib/project_types/extension/models/specifications.rb +1 -0
  60. data/lib/project_types/extension/tasks/configure_features.rb +6 -7
  61. data/lib/project_types/extension/tasks/configure_options.rb +20 -0
  62. data/lib/project_types/extension/tasks/get_extensions.rb +32 -0
  63. data/lib/project_types/node/cli.rb +9 -21
  64. data/lib/project_types/node/commands/connect.rb +8 -2
  65. data/lib/project_types/node/commands/create.rb +9 -5
  66. data/lib/project_types/node/commands/deploy.rb +15 -5
  67. data/lib/project_types/node/commands/deploy/heroku.rb +29 -29
  68. data/lib/project_types/node/commands/generate.rb +4 -2
  69. data/lib/project_types/node/commands/open.rb +4 -2
  70. data/lib/project_types/node/commands/serve.rb +3 -2
  71. data/lib/project_types/node/commands/tunnel.rb +4 -2
  72. data/lib/project_types/node/messages/messages.rb +46 -89
  73. data/lib/project_types/rails/cli.rb +9 -21
  74. data/lib/project_types/rails/commands/connect.rb +8 -2
  75. data/lib/project_types/rails/commands/create.rb +10 -6
  76. data/lib/project_types/rails/commands/deploy.rb +15 -5
  77. data/lib/project_types/rails/commands/deploy/heroku.rb +84 -82
  78. data/lib/project_types/rails/commands/generate.rb +15 -5
  79. data/lib/project_types/rails/commands/generate/webhook.rb +28 -26
  80. data/lib/project_types/rails/commands/open.rb +4 -2
  81. data/lib/project_types/rails/commands/serve.rb +3 -2
  82. data/lib/project_types/rails/commands/tunnel.rb +4 -2
  83. data/lib/project_types/rails/messages/messages.rb +54 -101
  84. data/lib/project_types/script/cli.rb +18 -20
  85. data/lib/project_types/script/commands/create.rb +3 -1
  86. data/lib/project_types/script/commands/push.rb +12 -5
  87. data/lib/project_types/script/config/extension_points.yml +0 -3
  88. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +9 -3
  89. data/lib/project_types/script/layers/application/create_script.rb +6 -5
  90. data/lib/project_types/script/layers/application/push_script.rb +2 -1
  91. data/lib/project_types/script/layers/domain/errors.rb +6 -11
  92. data/lib/project_types/script/layers/domain/push_package.rb +4 -8
  93. data/lib/project_types/script/layers/domain/script_json.rb +32 -0
  94. data/lib/project_types/script/layers/domain/script_project.rb +1 -1
  95. data/lib/project_types/script/layers/infrastructure/errors.rb +14 -18
  96. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_project_creator.rb +105 -0
  97. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +103 -0
  98. data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +26 -0
  99. data/lib/project_types/script/layers/infrastructure/languages/rust_project_creator.rb +73 -0
  100. data/lib/project_types/script/layers/infrastructure/languages/rust_task_runner.rb +60 -0
  101. data/lib/project_types/script/layers/infrastructure/languages/task_runner.rb +21 -0
  102. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +2 -4
  103. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +45 -34
  104. data/lib/project_types/script/layers/infrastructure/script_service.rb +37 -16
  105. data/lib/project_types/script/messages/messages.rb +66 -55
  106. data/lib/project_types/script/tasks/ensure_env.rb +22 -1
  107. data/lib/project_types/script/ui/error_handler.rb +32 -32
  108. data/lib/project_types/theme/cli.rb +16 -27
  109. data/lib/project_types/theme/commands/check.rb +33 -0
  110. data/lib/project_types/theme/commands/delete.rb +64 -0
  111. data/lib/project_types/theme/commands/init.rb +42 -0
  112. data/lib/project_types/theme/commands/language_server.rb +16 -0
  113. data/lib/project_types/theme/commands/package.rb +55 -0
  114. data/lib/project_types/theme/commands/publish.rb +43 -0
  115. data/lib/project_types/theme/commands/pull.rb +51 -0
  116. data/lib/project_types/theme/commands/push.rb +58 -32
  117. data/lib/project_types/theme/commands/serve.rb +8 -16
  118. data/lib/project_types/theme/forms/confirm_store.rb +15 -0
  119. data/lib/project_types/theme/forms/select.rb +59 -0
  120. data/lib/project_types/theme/messages/messages.rb +117 -102
  121. data/lib/project_types/theme/ui/sync_progress_bar.rb +20 -0
  122. data/lib/shopify-cli/admin_api.rb +53 -35
  123. data/lib/shopify-cli/admin_api/populate_resource_command.rb +6 -14
  124. data/lib/shopify-cli/admin_api/schema.rb +1 -10
  125. data/lib/shopify-cli/api.rb +29 -14
  126. data/lib/shopify-cli/command.rb +15 -3
  127. data/lib/shopify-cli/commands.rb +7 -2
  128. data/lib/shopify-cli/commands/help.rb +2 -29
  129. data/lib/shopify-cli/commands/login.rb +95 -0
  130. data/lib/shopify-cli/commands/logout.rb +24 -8
  131. data/lib/shopify-cli/commands/populate.rb +23 -0
  132. data/lib/{project_types/node → shopify-cli}/commands/populate/customer.rb +2 -8
  133. data/lib/{project_types/node → shopify-cli}/commands/populate/draft_order.rb +2 -2
  134. data/lib/{project_types/node → shopify-cli}/commands/populate/product.rb +2 -8
  135. data/lib/shopify-cli/commands/store.rb +15 -0
  136. data/lib/shopify-cli/commands/switch.rb +39 -0
  137. data/lib/shopify-cli/commands/system.rb +12 -0
  138. data/lib/shopify-cli/commands/whoami.rb +28 -0
  139. data/lib/shopify-cli/connect.rb +32 -0
  140. data/lib/shopify-cli/context.rb +65 -4
  141. data/lib/shopify-cli/core/entry_point.rb +3 -22
  142. data/lib/shopify-cli/db.rb +4 -4
  143. data/lib/shopify-cli/http_request.rb +16 -0
  144. data/lib/shopify-cli/identity_auth.rb +282 -0
  145. data/lib/shopify-cli/{oauth → identity_auth}/servlet.rb +11 -12
  146. data/lib/shopify-cli/messages/messages.rb +133 -39
  147. data/lib/shopify-cli/partners_api.rb +21 -41
  148. data/lib/shopify-cli/partners_api/organizations.rb +8 -0
  149. data/lib/shopify-cli/project_commands.rb +16 -0
  150. data/lib/shopify-cli/project_type.rb +0 -31
  151. data/lib/shopify-cli/resources/env_file.rb +1 -1
  152. data/lib/shopify-cli/shopifolk.rb +8 -11
  153. data/lib/shopify-cli/sub_command.rb +1 -0
  154. data/lib/shopify-cli/tasks.rb +3 -0
  155. data/lib/shopify-cli/tasks/confirm_store.rb +18 -0
  156. data/lib/shopify-cli/tasks/create_api_client.rb +2 -2
  157. data/lib/shopify-cli/tasks/ensure_authenticated.rb +13 -0
  158. data/lib/shopify-cli/tasks/ensure_loopback_url.rb +1 -1
  159. data/lib/shopify-cli/tasks/ensure_project_type.rb +12 -0
  160. data/lib/shopify-cli/tasks/select_org_and_shop.rb +0 -3
  161. data/lib/shopify-cli/theme/dev_server.rb +98 -0
  162. data/lib/shopify-cli/theme/dev_server/certificate_manager.rb +79 -0
  163. data/lib/shopify-cli/theme/dev_server/header_hash.rb +94 -0
  164. data/lib/shopify-cli/theme/dev_server/hot-reload.js +93 -0
  165. data/lib/shopify-cli/theme/dev_server/hot_reload.rb +76 -0
  166. data/lib/shopify-cli/theme/dev_server/local_assets.rb +87 -0
  167. data/lib/shopify-cli/theme/dev_server/proxy.rb +205 -0
  168. data/lib/shopify-cli/theme/dev_server/sse.rb +75 -0
  169. data/lib/shopify-cli/theme/dev_server/watcher.rb +59 -0
  170. data/lib/shopify-cli/theme/dev_server/web_server.rb +140 -0
  171. data/lib/shopify-cli/theme/development_theme.rb +69 -0
  172. data/lib/shopify-cli/theme/file.rb +112 -0
  173. data/lib/shopify-cli/theme/ignore_filter.rb +109 -0
  174. data/lib/shopify-cli/theme/mime_type.rb +34 -0
  175. data/lib/shopify-cli/theme/syncer.rb +328 -0
  176. data/lib/shopify-cli/theme/theme.rb +204 -0
  177. data/lib/shopify-cli/version.rb +1 -1
  178. data/lib/shopify_cli.rb +18 -11
  179. data/shopify-cli.gemspec +12 -5
  180. data/shopify.fish +1 -1
  181. data/shopify.sh +1 -1
  182. metadata +96 -41
  183. data/.github/workflows/release.yml +0 -61
  184. data/lib/project_types/extension/features/argo_serve_options.rb +0 -41
  185. data/lib/project_types/node/commands/populate.rb +0 -23
  186. data/lib/project_types/rails/commands/populate.rb +0 -23
  187. data/lib/project_types/rails/commands/populate/customer.rb +0 -31
  188. data/lib/project_types/rails/commands/populate/draft_order.rb +0 -28
  189. data/lib/project_types/rails/commands/populate/product.rb +0 -30
  190. data/lib/project_types/script/layers/domain/config_ui.rb +0 -16
  191. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +0 -95
  192. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +0 -101
  193. data/lib/project_types/script/layers/infrastructure/project_creator.rb +0 -24
  194. data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +0 -71
  195. data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +0 -58
  196. data/lib/project_types/script/layers/infrastructure/task_runner.rb +0 -19
  197. data/lib/project_types/theme/commands/connect.rb +0 -54
  198. data/lib/project_types/theme/commands/create.rb +0 -48
  199. data/lib/project_types/theme/commands/deploy.rb +0 -38
  200. data/lib/project_types/theme/commands/generate.rb +0 -20
  201. data/lib/project_types/theme/commands/generate/env.rb +0 -79
  202. data/lib/project_types/theme/forms/connect.rb +0 -34
  203. data/lib/project_types/theme/forms/create.rb +0 -22
  204. data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +0 -78
  205. data/lib/project_types/theme/themekit.rb +0 -113
  206. data/lib/shopify-cli/commands/connect.rb +0 -64
  207. data/lib/shopify-cli/commands/create.rb +0 -50
  208. 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
@@ -39,32 +37,32 @@ module Script
39
37
 
40
38
  module Domain
41
39
  autoload :Errors, Project.project_filepath("layers/domain/errors")
42
- autoload :ConfigUi, Project.project_filepath("layers/domain/config_ui")
43
40
  autoload :PushPackage, Project.project_filepath("layers/domain/push_package")
44
41
  autoload :Metadata, Project.project_filepath("layers/domain/metadata")
45
42
  autoload :ExtensionPoint, Project.project_filepath("layers/domain/extension_point")
43
+ autoload :ScriptJson, Project.project_filepath("layers/domain/script_json")
46
44
  autoload :ScriptProject, Project.project_filepath("layers/domain/script_project")
47
45
  end
48
46
 
49
47
  module Infrastructure
50
48
  autoload :Errors, Project.project_filepath("layers/infrastructure/errors")
51
- autoload :AssemblyScriptDependencyManager,
52
- Project.project_filepath("layers/infrastructure/assemblyscript_dependency_manager")
53
- autoload :AssemblyScriptProjectCreator,
54
- Project.project_filepath("layers/infrastructure/assemblyscript_project_creator")
55
- autoload :AssemblyScriptTaskRunner, Project.project_filepath("layers/infrastructure/assemblyscript_task_runner")
56
- autoload :AssemblyScriptTsConfig, Project.project_filepath("layers/infrastructure/assemblyscript_tsconfig")
57
49
  autoload :CommandRunner, Project.project_filepath("layers/infrastructure/command_runner")
58
- autoload :RustProjectCreator,
59
- Project.project_filepath("layers/infrastructure/rust_project_creator.rb")
60
- autoload :RustTaskRunner, Project.project_filepath("layers/infrastructure/rust_task_runner")
61
-
62
50
  autoload :PushPackageRepository, Project.project_filepath("layers/infrastructure/push_package_repository")
63
51
  autoload :ExtensionPointRepository, Project.project_filepath("layers/infrastructure/extension_point_repository")
64
- autoload :ProjectCreator, Project.project_filepath("layers/infrastructure/project_creator")
65
52
  autoload :ScriptProjectRepository, Project.project_filepath("layers/infrastructure/script_project_repository")
66
53
  autoload :ScriptService, Project.project_filepath("layers/infrastructure/script_service")
67
- autoload :TaskRunner, Project.project_filepath("layers/infrastructure/task_runner")
54
+
55
+ module Languages
56
+ autoload :AssemblyScriptProjectCreator,
57
+ Project.project_filepath("layers/infrastructure/languages/assemblyscript_project_creator")
58
+ autoload :AssemblyScriptTaskRunner,
59
+ Project.project_filepath("layers/infrastructure/languages/assemblyscript_task_runner")
60
+ autoload :ProjectCreator, Project.project_filepath("layers/infrastructure/languages/project_creator")
61
+ autoload :RustProjectCreator,
62
+ Project.project_filepath("layers/infrastructure/languages/rust_project_creator.rb")
63
+ autoload :RustTaskRunner, Project.project_filepath("layers/infrastructure/languages/rust_task_runner")
64
+ autoload :TaskRunner, Project.project_filepath("layers/infrastructure/languages/task_runner")
65
+ end
68
66
  end
69
67
  end
70
68
 
@@ -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,22 +1,29 @@
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
9
11
 
10
12
  def call(_args, _name)
11
- Tasks::EnsureEnv.call(@ctx)
13
+ fresh_env = Tasks::EnsureEnv.call(@ctx)
14
+ force = options.flags.key?(:force) || !!fresh_env
12
15
 
13
16
  api_key = Layers::Infrastructure::ScriptProjectRepository.new(ctx: @ctx).get.api_key
14
17
  return @ctx.puts(self.class.help) unless api_key
15
18
 
16
- Layers::Application::PushScript.call(ctx: @ctx, force: options.flags.key?(:force))
19
+ Layers::Application::PushScript.call(ctx: @ctx, force: force)
17
20
  @ctx.puts(@ctx.message("script.push.script_pushed", api_key: api_key))
18
21
  rescue StandardError => e
19
- msg = @ctx.message("script.push.error.operation_failed", api_key: api_key)
22
+ msg = if api_key
23
+ @ctx.message("script.push.error.operation_failed_with_api_key", api_key: api_key)
24
+ else
25
+ @ctx.message("script.push.error.operation_failed_no_api_key")
26
+ end
20
27
  UI::ErrorHandler.pretty_print_and_raise(e, failed_op: msg)
21
28
  end
22
29
 
@@ -36,11 +36,8 @@ payment_methods:
36
36
  assemblyscript:
37
37
  package: "@shopify/scripts-checkout-apis"
38
38
  toolchain-version: "^5.0.0"
39
- sdk-version: "^9.0.0"
40
39
  shipping_methods:
41
40
  domain: 'checkout'
42
41
  assemblyscript:
43
42
  package: "@shopify/scripts-checkout-apis"
44
- sdk-version: "^9.0.0"
45
43
  toolchain-version: "^5.0.0"
46
-
@@ -1,19 +1,22 @@
1
1
  mutation AppScriptUpdateOrCreate(
2
2
  $extensionPointName: ExtensionPointName!,
3
3
  $title: String,
4
- $configUi: String,
4
+ $description: String,
5
5
  $sourceCode: String,
6
6
  $language: String,
7
7
  $force: Boolean,
8
8
  $schemaMajorVersion: String,
9
9
  $schemaMinorVersion: String,
10
10
  $useMsgpack: Boolean,
11
- $uuid: String
11
+ $uuid: String,
12
+ $configurationUi: Boolean,
13
+ $scriptJsonVersion: String,
14
+ $configurationDefinition: String,
12
15
  ) {
13
16
  appScriptUpdateOrCreate(
14
17
  extensionPointName: $extensionPointName
15
18
  title: $title
16
- configUi: $configUi
19
+ description: $description
17
20
  sourceCode: $sourceCode
18
21
  language: $language
19
22
  force: $force
@@ -21,6 +24,9 @@ mutation AppScriptUpdateOrCreate(
21
24
  schemaMinorVersion: $schemaMinorVersion
22
25
  useMsgpack: $useMsgpack,
23
26
  uuid: $uuid
27
+ configurationUi: $configurationUi
28
+ scriptJsonVersion: $scriptJsonVersion
29
+ configurationDefinition: $configurationDefinition
24
30
  ) {
25
31
  userErrors {
26
32
  field
@@ -12,16 +12,17 @@ module Script
12
12
 
13
13
  in_new_directory_context(ctx, script_name) do
14
14
  extension_point = ExtensionPoints.get(type: extension_point_type)
15
- project = Infrastructure::ScriptProjectRepository.new(ctx: ctx).create(
15
+ script_project_repo = Infrastructure::ScriptProjectRepository.new(ctx: ctx)
16
+ project = script_project_repo.create(
16
17
  script_name: script_name,
17
18
  extension_point_type: extension_point_type,
18
- language: language,
19
- no_config_ui: no_config_ui
19
+ language: language
20
20
  )
21
- project_creator = Infrastructure::ProjectCreator
21
+ project_creator = Infrastructure::Languages::ProjectCreator
22
22
  .for(ctx, language, extension_point, script_name, project.id)
23
23
  install_dependencies(ctx, language, script_name, project_creator)
24
24
  bootstrap(ctx, project_creator)
25
+ script_project_repo.update_or_create_script_json(title: script_name, configuration_ui: !no_config_ui)
25
26
  project
26
27
  end
27
28
  end
@@ -29,7 +30,7 @@ module Script
29
30
  private
30
31
 
31
32
  def install_dependencies(ctx, language, script_name, project_creator)
32
- task_runner = Infrastructure::TaskRunner.for(ctx, language, script_name)
33
+ task_runner = Infrastructure::Languages::TaskRunner.for(ctx, language, script_name)
33
34
  project_creator.setup_dependencies
34
35
  ProjectDependencies.install(ctx: ctx, task_runner: task_runner)
35
36
  end