shopify-cli 1.13.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) 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 +57 -24
  10. data/Gemfile +4 -0
  11. data/Gemfile.lock +32 -0
  12. data/LICENSE +4 -1
  13. data/README.md +94 -26
  14. data/RELEASING.md +31 -7
  15. data/Rakefile +2 -2
  16. data/SECURITY.md +1 -1
  17. data/THEMEKIT_MIGRATION.md +18 -0
  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/api_versions.graphql +1 -1
  36. data/lib/graphql/find_organization.graphql +2 -1
  37. data/lib/project_types/extension/cli.rb +18 -15
  38. data/lib/project_types/extension/commands/build.rb +4 -5
  39. data/lib/project_types/extension/commands/connect.rb +35 -0
  40. data/lib/project_types/extension/commands/create.rb +12 -16
  41. data/lib/project_types/extension/commands/extension_command.rb +2 -2
  42. data/lib/project_types/extension/commands/info.rb +86 -0
  43. data/lib/project_types/extension/commands/push.rb +8 -7
  44. data/lib/project_types/extension/commands/register.rb +4 -5
  45. data/lib/project_types/extension/commands/serve.rb +5 -8
  46. data/lib/project_types/extension/commands/tunnel.rb +3 -1
  47. data/lib/project_types/extension/errors.rb +9 -0
  48. data/lib/project_types/extension/extension_project.rb +17 -1
  49. data/lib/project_types/extension/extension_project_keys.rb +1 -0
  50. data/lib/project_types/extension/features/argo.rb +6 -6
  51. data/lib/project_types/extension/features/argo_runtime.rb +22 -56
  52. data/lib/project_types/extension/features/argo_serve.rb +25 -18
  53. data/lib/project_types/extension/forms/connect.rb +42 -0
  54. data/lib/project_types/extension/forms/questions/ask_name.rb +14 -6
  55. data/lib/project_types/extension/forms/questions/ask_registration.rb +51 -0
  56. data/lib/project_types/extension/messages/messages.rb +80 -16
  57. data/lib/project_types/extension/models/specification.rb +1 -0
  58. data/lib/project_types/extension/models/specification_handlers/{checkout_argo_extension.rb → checkout_ui_extension.rb} +3 -1
  59. data/lib/project_types/extension/models/specification_handlers/default.rb +13 -3
  60. data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +89 -0
  61. data/lib/project_types/extension/models/specifications.rb +1 -0
  62. data/lib/project_types/extension/tasks/configure_features.rb +6 -7
  63. data/lib/project_types/extension/tasks/configure_options.rb +20 -0
  64. data/lib/project_types/extension/tasks/get_extensions.rb +32 -0
  65. data/lib/project_types/node/cli.rb +9 -21
  66. data/lib/project_types/node/commands/connect.rb +8 -2
  67. data/lib/project_types/node/commands/create.rb +9 -5
  68. data/lib/project_types/node/commands/deploy.rb +15 -5
  69. data/lib/project_types/node/commands/deploy/heroku.rb +29 -29
  70. data/lib/project_types/node/commands/generate.rb +4 -2
  71. data/lib/project_types/node/commands/open.rb +4 -2
  72. data/lib/project_types/node/commands/serve.rb +3 -2
  73. data/lib/project_types/node/commands/tunnel.rb +4 -2
  74. data/lib/project_types/node/messages/messages.rb +47 -90
  75. data/lib/project_types/rails/cli.rb +9 -21
  76. data/lib/project_types/rails/commands/connect.rb +8 -2
  77. data/lib/project_types/rails/commands/create.rb +10 -6
  78. data/lib/project_types/rails/commands/deploy.rb +15 -5
  79. data/lib/project_types/rails/commands/deploy/heroku.rb +84 -82
  80. data/lib/project_types/rails/commands/generate.rb +15 -5
  81. data/lib/project_types/rails/commands/generate/webhook.rb +28 -26
  82. data/lib/project_types/rails/commands/open.rb +4 -2
  83. data/lib/project_types/rails/commands/serve.rb +3 -2
  84. data/lib/project_types/rails/commands/tunnel.rb +4 -2
  85. data/lib/project_types/rails/messages/messages.rb +72 -119
  86. data/lib/project_types/script/cli.rb +6 -8
  87. data/lib/project_types/script/commands/create.rb +3 -1
  88. data/lib/project_types/script/commands/push.rb +12 -5
  89. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +9 -3
  90. data/lib/project_types/script/layers/application/create_script.rb +4 -3
  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 +13 -17
  96. data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_project_creator.rb +29 -21
  97. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +2 -4
  98. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +45 -34
  99. data/lib/project_types/script/layers/infrastructure/script_service.rb +37 -16
  100. data/lib/project_types/script/messages/messages.rb +66 -55
  101. data/lib/project_types/script/tasks/ensure_env.rb +22 -1
  102. data/lib/project_types/script/ui/error_handler.rb +32 -32
  103. data/lib/project_types/theme/cli.rb +16 -27
  104. data/lib/project_types/theme/commands/check.rb +33 -0
  105. data/lib/project_types/theme/commands/delete.rb +64 -0
  106. data/lib/project_types/theme/commands/init.rb +42 -0
  107. data/lib/project_types/theme/commands/language_server.rb +16 -0
  108. data/lib/project_types/theme/commands/package.rb +55 -0
  109. data/lib/project_types/theme/commands/publish.rb +43 -0
  110. data/lib/project_types/theme/commands/pull.rb +51 -0
  111. data/lib/project_types/theme/commands/push.rb +58 -32
  112. data/lib/project_types/theme/commands/serve.rb +8 -16
  113. data/lib/project_types/theme/forms/confirm_store.rb +15 -0
  114. data/lib/project_types/theme/forms/select.rb +59 -0
  115. data/lib/project_types/theme/messages/messages.rb +118 -103
  116. data/lib/project_types/theme/ui/sync_progress_bar.rb +20 -0
  117. data/lib/shopify-cli/admin_api.rb +57 -38
  118. data/lib/shopify-cli/admin_api/populate_resource_command.rb +6 -14
  119. data/lib/shopify-cli/admin_api/schema.rb +1 -10
  120. data/lib/shopify-cli/api.rb +29 -14
  121. data/lib/shopify-cli/command.rb +15 -3
  122. data/lib/shopify-cli/commands.rb +7 -2
  123. data/lib/shopify-cli/commands/help.rb +2 -29
  124. data/lib/shopify-cli/commands/login.rb +95 -0
  125. data/lib/shopify-cli/commands/logout.rb +24 -8
  126. data/lib/shopify-cli/commands/populate.rb +23 -0
  127. data/lib/{project_types/node → shopify-cli}/commands/populate/customer.rb +2 -8
  128. data/lib/{project_types/node → shopify-cli}/commands/populate/draft_order.rb +2 -2
  129. data/lib/{project_types/node → shopify-cli}/commands/populate/product.rb +2 -8
  130. data/lib/shopify-cli/commands/store.rb +15 -0
  131. data/lib/shopify-cli/commands/switch.rb +39 -0
  132. data/lib/shopify-cli/commands/system.rb +12 -0
  133. data/lib/shopify-cli/commands/whoami.rb +28 -0
  134. data/lib/shopify-cli/connect.rb +32 -0
  135. data/lib/shopify-cli/context.rb +65 -4
  136. data/lib/shopify-cli/core/entry_point.rb +3 -22
  137. data/lib/shopify-cli/core/monorail.rb +6 -2
  138. data/lib/shopify-cli/db.rb +4 -4
  139. data/lib/shopify-cli/http_request.rb +16 -0
  140. data/lib/shopify-cli/identity_auth.rb +282 -0
  141. data/lib/shopify-cli/{oauth → identity_auth}/servlet.rb +11 -12
  142. data/lib/shopify-cli/messages/messages.rb +140 -46
  143. data/lib/shopify-cli/packager.rb +5 -5
  144. data/lib/shopify-cli/partners_api.rb +21 -44
  145. data/lib/shopify-cli/partners_api/organizations.rb +8 -0
  146. data/lib/shopify-cli/project_commands.rb +16 -0
  147. data/lib/shopify-cli/project_type.rb +0 -31
  148. data/lib/shopify-cli/shopifolk.rb +8 -11
  149. data/lib/shopify-cli/sub_command.rb +1 -0
  150. data/lib/shopify-cli/tasks.rb +3 -0
  151. data/lib/shopify-cli/tasks/confirm_store.rb +18 -0
  152. data/lib/shopify-cli/tasks/create_api_client.rb +2 -2
  153. data/lib/shopify-cli/tasks/ensure_authenticated.rb +13 -0
  154. data/lib/shopify-cli/tasks/ensure_loopback_url.rb +1 -1
  155. data/lib/shopify-cli/tasks/ensure_project_type.rb +12 -0
  156. data/lib/shopify-cli/tasks/select_org_and_shop.rb +0 -3
  157. data/lib/shopify-cli/theme/dev_server.rb +98 -0
  158. data/lib/shopify-cli/theme/dev_server/certificate_manager.rb +79 -0
  159. data/lib/shopify-cli/theme/dev_server/header_hash.rb +94 -0
  160. data/lib/shopify-cli/theme/dev_server/hot-reload.js +93 -0
  161. data/lib/shopify-cli/theme/dev_server/hot_reload.rb +76 -0
  162. data/lib/shopify-cli/theme/dev_server/local_assets.rb +87 -0
  163. data/lib/shopify-cli/theme/dev_server/proxy.rb +205 -0
  164. data/lib/shopify-cli/theme/dev_server/sse.rb +75 -0
  165. data/lib/shopify-cli/theme/dev_server/watcher.rb +59 -0
  166. data/lib/shopify-cli/theme/dev_server/web_server.rb +140 -0
  167. data/lib/shopify-cli/theme/development_theme.rb +69 -0
  168. data/lib/shopify-cli/theme/file.rb +112 -0
  169. data/lib/shopify-cli/theme/ignore_filter.rb +109 -0
  170. data/lib/shopify-cli/theme/mime_type.rb +34 -0
  171. data/lib/shopify-cli/theme/syncer.rb +332 -0
  172. data/lib/shopify-cli/theme/theme.rb +204 -0
  173. data/lib/shopify-cli/tunnel.rb +1 -1
  174. data/lib/shopify-cli/version.rb +1 -1
  175. data/lib/shopify_cli.rb +18 -11
  176. data/shopify-cli.gemspec +12 -5
  177. data/shopify.fish +1 -1
  178. data/shopify.sh +1 -1
  179. metadata +91 -35
  180. data/.github/workflows/release.yml +0 -59
  181. data/lib/project_types/extension/features/argo_serve_options.rb +0 -41
  182. data/lib/project_types/node/commands/populate.rb +0 -23
  183. data/lib/project_types/rails/commands/populate.rb +0 -23
  184. data/lib/project_types/rails/commands/populate/customer.rb +0 -31
  185. data/lib/project_types/rails/commands/populate/draft_order.rb +0 -28
  186. data/lib/project_types/rails/commands/populate/product.rb +0 -30
  187. data/lib/project_types/script/layers/domain/config_ui.rb +0 -16
  188. data/lib/project_types/theme/commands/connect.rb +0 -54
  189. data/lib/project_types/theme/commands/create.rb +0 -48
  190. data/lib/project_types/theme/commands/deploy.rb +0 -38
  191. data/lib/project_types/theme/commands/generate.rb +0 -20
  192. data/lib/project_types/theme/commands/generate/env.rb +0 -79
  193. data/lib/project_types/theme/forms/connect.rb +0 -34
  194. data/lib/project_types/theme/forms/create.rb +0 -22
  195. data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +0 -78
  196. data/lib/project_types/theme/themekit.rb +0 -113
  197. data/lib/shopify-cli/commands/connect.rb +0 -64
  198. data/lib/shopify-cli/commands/create.rb +0 -50
  199. 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
  },
@@ -12,37 +17,36 @@ module Rails
12
17
  checking_installation_path: "Checking path %s for gem %s",
13
18
  installed: "Installed %s gem",
14
19
  installed_debug: "%s installed: %s",
15
- installing: "Installing %s gem...",
20
+ installing: "Installing %s gem",
16
21
  setting_gem_home: "GEM_HOME being set to %s",
17
22
  setting_gem_path: "GEM_PATH being set to %s",
18
23
  },
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.",
@@ -58,55 +62,55 @@ module Rails
58
62
  open_new_shell: "{{*}} {{yellow:After installing %s, please open a new Command Prompt or PowerShell " \
59
63
  "window to continue.}}",
60
64
  },
61
- installing_bundler: "Installing bundler...",
62
- generating_app: "Generating new rails app project in %s...",
63
- adding_shopify_gem: "{{v}} Adding shopify_app gem...",
65
+ installing_bundler: "Installing bundler",
66
+ generating_app: "Generating new rails app project in %s",
67
+ adding_shopify_gem: "{{v}} Adding shopify_app gem",
64
68
  node_version: "node %s",
65
69
  yarn_version: "yarn %s",
66
- running_bundle_install: "Running bundle install...",
67
- running_generator: "Running shopify_app generator...",
68
- running_migrations: "Running migrations...",
69
- running_webpacker_install: "Running webpacker:install...",
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",
70
74
  },
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
- downloading: "Downloading Heroku CLI...",
92
+ downloading: "Downloading Heroku CLI",
89
93
  downloaded: "Downloaded Heroku CLI",
90
- installing: "Installing Heroku CLI...",
94
+ installing: "Installing Heroku CLI",
91
95
  installed: "Installed Heroku CLI",
92
96
  authenticated_with_account: "{{v}} Authenticated with Heroku as {{green:%s}}",
93
- authenticating: "Authenticating with Heroku...",
97
+ authenticating: "Authenticating with Heroku",
94
98
  authenticated: "{{v}} Authenticated with Heroku",
95
- deploying: "Deploying to Heroku...",
99
+ deploying: "Deploying to Heroku",
96
100
  deployed: "{{v}} Deployed to Heroku",
97
101
  db_check: {
98
- validating: "Validating application...",
99
- checking: "Checking database type...",
102
+ validating: "Validating application",
103
+ checking: "Checking database type",
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: {
109
- checking: "Checking git repo...",
113
+ checking: "Checking git repo",
110
114
  initialized: "Git repo initialized",
111
115
  what_branch: "What branch would you like to deploy?",
112
116
  branch_selected: "{{v}} Git branch {{green:%s}} selected for deploy",
@@ -115,10 +119,10 @@ module Rails
115
119
  no_apps_found: "No existing Heroku app found. What would you like to do?",
116
120
  name: "What is your Heroku app’s name?",
117
121
  select: "Specify an existing Heroku app",
118
- selecting: "Selecting Heroku app %s...",
122
+ selecting: "Selecting Heroku app %s",
119
123
  selected: "{{v}} Heroku app {{green:%s}} selected",
120
124
  create: "Create a new Heroku app",
121
- creating: "Creating new Heroku app...",
125
+ creating: "Creating new Heroku app",
122
126
  created: "{{v}} New Heroku app created",
123
127
  },
124
128
  },
@@ -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: {
@@ -227,25 +180,25 @@ module Rails
227
180
  {{*}} To install and start using your app, open this URL in your browser:
228
181
  {{green:%s}}
229
182
  MESSAGE
230
- running_server: "Running server...",
183
+ running_server: "Running server",
231
184
  },
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,10 +37,10 @@ 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
 
@@ -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
 
@@ -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
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