shopify-cli 1.14.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -1
- data/.github/CONTRIBUTING.md +7 -7
- data/.github/DESIGN.md +3 -3
- data/.github/workflows/build.yml +1 -1
- data/.gitignore +3 -0
- data/.rubocop.yml +3 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +35 -29
- data/Gemfile +4 -0
- data/Gemfile.lock +32 -0
- data/LICENSE +4 -1
- data/README.md +92 -26
- data/RELEASING.md +29 -7
- data/Rakefile +2 -2
- data/SECURITY.md +1 -1
- data/bin/load_shopify.rb +1 -1
- data/bin/shopify +3 -3
- data/dev.yml +1 -1
- data/docs/app/node/index.md +1 -1
- data/docs/app/rails/index.md +1 -1
- data/docs/core/index.md +1 -1
- data/docs/getting-started/index.md +1 -1
- data/docs/getting-started/install/index.md +1 -1
- data/docs/getting-started/migrate/index.md +1 -1
- data/docs/getting-started/uninstall/index.md +1 -1
- data/docs/getting-started/upgrade/index.md +1 -1
- data/docs/help/start-app/index.md +1 -1
- data/docs/index.md +1 -1
- data/ext/shopify-cli/extconf.rb +17 -5
- data/install.sh +1 -1
- data/lib/docgen/index_template.md.erb +2 -2
- data/lib/graphql/all_orgs_with_extensions.graphql +37 -0
- data/lib/graphql/find_organization.graphql +2 -1
- data/lib/project_types/extension/cli.rb +18 -15
- data/lib/project_types/extension/commands/build.rb +4 -5
- data/lib/project_types/extension/commands/connect.rb +35 -0
- data/lib/project_types/extension/commands/create.rb +12 -16
- data/lib/project_types/extension/commands/extension_command.rb +2 -2
- data/lib/project_types/extension/commands/info.rb +86 -0
- data/lib/project_types/extension/commands/push.rb +8 -7
- data/lib/project_types/extension/commands/register.rb +4 -5
- data/lib/project_types/extension/commands/serve.rb +5 -8
- data/lib/project_types/extension/commands/tunnel.rb +3 -1
- data/lib/project_types/extension/errors.rb +9 -0
- data/lib/project_types/extension/extension_project.rb +5 -0
- data/lib/project_types/extension/features/argo.rb +6 -6
- data/lib/project_types/extension/features/argo_runtime.rb +22 -66
- data/lib/project_types/extension/features/argo_serve.rb +25 -18
- data/lib/project_types/extension/forms/connect.rb +42 -0
- data/lib/project_types/extension/forms/questions/ask_name.rb +14 -6
- data/lib/project_types/extension/forms/questions/ask_registration.rb +51 -0
- data/lib/project_types/extension/messages/messages.rb +75 -11
- data/lib/project_types/extension/models/specification.rb +1 -0
- data/lib/project_types/extension/models/specification_handlers/{checkout_argo_extension.rb → checkout_ui_extension.rb} +3 -1
- data/lib/project_types/extension/models/specification_handlers/default.rb +13 -3
- data/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +86 -0
- data/lib/project_types/extension/models/specifications.rb +1 -0
- data/lib/project_types/extension/tasks/configure_features.rb +6 -7
- data/lib/project_types/extension/tasks/configure_options.rb +20 -0
- data/lib/project_types/extension/tasks/get_extensions.rb +32 -0
- data/lib/project_types/node/cli.rb +9 -21
- data/lib/project_types/node/commands/connect.rb +8 -2
- data/lib/project_types/node/commands/create.rb +9 -5
- data/lib/project_types/node/commands/deploy.rb +15 -5
- data/lib/project_types/node/commands/deploy/heroku.rb +29 -29
- data/lib/project_types/node/commands/generate.rb +4 -2
- data/lib/project_types/node/commands/open.rb +4 -2
- data/lib/project_types/node/commands/serve.rb +3 -2
- data/lib/project_types/node/commands/tunnel.rb +4 -2
- data/lib/project_types/node/messages/messages.rb +46 -89
- data/lib/project_types/rails/cli.rb +9 -21
- data/lib/project_types/rails/commands/connect.rb +8 -2
- data/lib/project_types/rails/commands/create.rb +10 -6
- data/lib/project_types/rails/commands/deploy.rb +15 -5
- data/lib/project_types/rails/commands/deploy/heroku.rb +84 -82
- data/lib/project_types/rails/commands/generate.rb +15 -5
- data/lib/project_types/rails/commands/generate/webhook.rb +28 -26
- data/lib/project_types/rails/commands/open.rb +4 -2
- data/lib/project_types/rails/commands/serve.rb +3 -2
- data/lib/project_types/rails/commands/tunnel.rb +4 -2
- data/lib/project_types/rails/messages/messages.rb +54 -101
- data/lib/project_types/script/cli.rb +5 -7
- data/lib/project_types/script/commands/create.rb +3 -1
- data/lib/project_types/script/commands/push.rb +4 -2
- data/lib/project_types/script/messages/messages.rb +52 -45
- data/lib/project_types/script/ui/error_handler.rb +2 -2
- data/lib/project_types/theme/cli.rb +15 -27
- data/lib/project_types/theme/commands/check.rb +33 -0
- data/lib/project_types/theme/commands/delete.rb +64 -0
- data/lib/project_types/theme/commands/language_server.rb +16 -0
- data/lib/project_types/theme/commands/package.rb +55 -0
- data/lib/project_types/theme/commands/publish.rb +43 -0
- data/lib/project_types/theme/commands/pull.rb +51 -0
- data/lib/project_types/theme/commands/push.rb +58 -32
- data/lib/project_types/theme/commands/serve.rb +7 -17
- data/lib/project_types/theme/forms/confirm_store.rb +15 -0
- data/lib/project_types/theme/forms/select.rb +59 -0
- data/lib/project_types/theme/messages/messages.rb +110 -106
- data/lib/project_types/theme/ui/sync_progress_bar.rb +20 -0
- data/lib/shopify-cli/admin_api.rb +53 -38
- data/lib/shopify-cli/admin_api/populate_resource_command.rb +6 -14
- data/lib/shopify-cli/admin_api/schema.rb +1 -10
- data/lib/shopify-cli/api.rb +29 -14
- data/lib/shopify-cli/command.rb +15 -3
- data/lib/shopify-cli/commands.rb +7 -2
- data/lib/shopify-cli/commands/help.rb +2 -29
- data/lib/shopify-cli/commands/login.rb +95 -0
- data/lib/shopify-cli/commands/logout.rb +24 -8
- data/lib/shopify-cli/commands/populate.rb +23 -0
- data/lib/{project_types/node → shopify-cli}/commands/populate/customer.rb +2 -8
- data/lib/{project_types/node → shopify-cli}/commands/populate/draft_order.rb +2 -2
- data/lib/{project_types/node → shopify-cli}/commands/populate/product.rb +2 -8
- data/lib/shopify-cli/commands/store.rb +15 -0
- data/lib/shopify-cli/commands/switch.rb +39 -0
- data/lib/shopify-cli/commands/system.rb +12 -0
- data/lib/shopify-cli/commands/whoami.rb +28 -0
- data/lib/shopify-cli/connect.rb +32 -0
- data/lib/shopify-cli/context.rb +52 -4
- data/lib/shopify-cli/core/entry_point.rb +3 -22
- data/lib/shopify-cli/db.rb +4 -4
- data/lib/shopify-cli/http_request.rb +10 -0
- data/lib/shopify-cli/identity_auth.rb +282 -0
- data/lib/shopify-cli/{oauth → identity_auth}/servlet.rb +11 -12
- data/lib/shopify-cli/messages/messages.rb +132 -39
- data/lib/shopify-cli/partners_api.rb +21 -44
- data/lib/shopify-cli/partners_api/organizations.rb +8 -0
- data/lib/shopify-cli/project_commands.rb +16 -0
- data/lib/shopify-cli/project_type.rb +0 -31
- data/lib/shopify-cli/shopifolk.rb +8 -11
- data/lib/shopify-cli/sub_command.rb +1 -0
- data/lib/shopify-cli/tasks.rb +3 -0
- data/lib/shopify-cli/tasks/confirm_store.rb +18 -0
- data/lib/shopify-cli/tasks/create_api_client.rb +2 -2
- data/lib/shopify-cli/tasks/ensure_authenticated.rb +13 -0
- data/lib/shopify-cli/tasks/ensure_loopback_url.rb +1 -1
- data/lib/shopify-cli/tasks/ensure_project_type.rb +12 -0
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +0 -3
- data/lib/shopify-cli/theme/dev_server.rb +98 -0
- data/lib/shopify-cli/theme/dev_server/certificate_manager.rb +79 -0
- data/lib/shopify-cli/theme/dev_server/header_hash.rb +94 -0
- data/lib/shopify-cli/theme/dev_server/hot-reload.js +93 -0
- data/lib/shopify-cli/theme/dev_server/hot_reload.rb +76 -0
- data/lib/shopify-cli/theme/dev_server/local_assets.rb +87 -0
- data/lib/shopify-cli/theme/dev_server/proxy.rb +205 -0
- data/lib/shopify-cli/theme/dev_server/sse.rb +75 -0
- data/lib/shopify-cli/theme/dev_server/watcher.rb +59 -0
- data/lib/shopify-cli/theme/dev_server/web_server.rb +140 -0
- data/lib/shopify-cli/theme/development_theme.rb +69 -0
- data/lib/shopify-cli/theme/file.rb +112 -0
- data/lib/shopify-cli/theme/ignore_filter.rb +109 -0
- data/lib/shopify-cli/theme/mime_type.rb +34 -0
- data/lib/shopify-cli/theme/syncer.rb +328 -0
- data/lib/shopify-cli/theme/theme.rb +204 -0
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +18 -11
- data/shopify-cli.gemspec +12 -5
- data/shopify.fish +1 -1
- data/shopify.sh +1 -1
- metadata +88 -34
- data/.github/workflows/release.yml +0 -59
- data/lib/project_types/extension/features/argo_serve_options.rb +0 -42
- data/lib/project_types/node/commands/populate.rb +0 -23
- data/lib/project_types/rails/commands/populate.rb +0 -23
- data/lib/project_types/rails/commands/populate/customer.rb +0 -31
- data/lib/project_types/rails/commands/populate/draft_order.rb +0 -28
- data/lib/project_types/rails/commands/populate/product.rb +0 -30
- data/lib/project_types/theme/commands/connect.rb +0 -54
- data/lib/project_types/theme/commands/create.rb +0 -48
- data/lib/project_types/theme/commands/deploy.rb +0 -38
- data/lib/project_types/theme/commands/generate.rb +0 -20
- data/lib/project_types/theme/commands/generate/env.rb +0 -79
- data/lib/project_types/theme/forms/connect.rb +0 -34
- data/lib/project_types/theme/forms/create.rb +0 -22
- data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +0 -78
- data/lib/project_types/theme/themekit.rb +0 -113
- data/lib/shopify-cli/commands/connect.rb +0 -64
- data/lib/shopify-cli/commands/create.rb +0 -50
- data/lib/shopify-cli/oauth.rb +0 -198
@@ -3,10 +3,12 @@
|
|
3
3
|
require "shopify_cli"
|
4
4
|
|
5
5
|
module Rails
|
6
|
-
|
7
|
-
class Tunnel < ShopifyCli::
|
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
|
-
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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:
|
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
|
-
|
75
|
-
|
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
|
-
|
79
|
-
|
80
|
-
|
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
|
-
|
86
|
-
|
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
|
-
|
104
|
-
|
105
|
-
|
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
|
-
|
130
|
-
|
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
|
-
|
134
|
-
|
135
|
-
|
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
|
-
|
146
|
-
|
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
|
-
|
157
|
-
|
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
|
-
|
215
|
-
|
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
|
-
|
219
|
-
|
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
|
-
|
236
|
-
|
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
|
-
|
192
|
+
{{bold:Subcommands:}}
|
240
193
|
|
241
|
-
|
242
|
-
|
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
|
-
|
245
|
-
|
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
|
-
|
248
|
-
|
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
|
-
|
274
|
-
|
275
|
-
|
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
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
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
|
-
|
5
|
-
class Push < ShopifyCli::
|
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
|
9
|
-
"This Script
|
10
|
-
deprecated_ep_cause: "Try using a different
|
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: "
|
18
|
+
eacces_help: "Try again and choose a different directory.",
|
14
19
|
|
15
|
-
enospc_cause: "You don't have enough disk space to
|
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
|
-
|
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}}
|
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: "
|
43
|
-
project_exists_help: "
|
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
|
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
|
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: "
|
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
|
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
|
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
|
-
|
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
|
75
|
-
"
|
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
|
79
|
-
"accept one of the following
|
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
|
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
|
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
|
97
|
+
metadata_schema_versions_missing: "Invalid Script metadata:" \
|
91
98
|
" 'schemaVersions' field is missing",
|
92
|
-
metadata_schema_versions_single_key: "Invalid
|
93
|
-
" 'schemaVersions' can have only one
|
94
|
-
metadata_schema_versions_missing_major: "Invalid
|
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
|
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
|
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
|
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
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
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
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
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
|
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
|
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
|
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
|
},
|