shopify-cli 2.9.0 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.yaml +117 -0
- data/.github/ISSUE_TEMPLATE/enhancement.yaml +38 -0
- data/.github/ISSUE_TEMPLATE/feature.yaml +47 -0
- data/.github/ISSUE_TEMPLATE.md +18 -0
- data/CHANGELOG.md +38 -5
- data/Gemfile.lock +1 -1
- data/dev.yml +3 -0
- data/lib/project_types/extension/commands/build.rb +3 -0
- data/lib/project_types/extension/commands/check.rb +3 -0
- data/lib/project_types/extension/commands/create.rb +3 -0
- data/lib/project_types/extension/commands/push.rb +3 -0
- data/lib/project_types/extension/commands/serve.rb +3 -0
- data/lib/project_types/extension/models/specification_handlers/default.rb +1 -1
- data/lib/project_types/extension/tasks/convert_server_config.rb +3 -1
- data/lib/project_types/script/cli.rb +5 -0
- data/lib/project_types/script/commands/connect.rb +3 -1
- data/lib/project_types/script/commands/create.rb +2 -0
- data/lib/project_types/script/commands/push.rb +6 -0
- data/lib/project_types/script/config/extension_points.yml +12 -0
- data/lib/project_types/script/graphql/app_script_set.graphql +2 -0
- data/lib/project_types/script/graphql/module_upload_url_generate.graphql +5 -1
- data/lib/project_types/script/layers/application/build_script.rb +6 -3
- data/lib/project_types/script/layers/application/project_dependencies.rb +1 -1
- data/lib/project_types/script/layers/application/push_script.rb +38 -30
- data/lib/project_types/script/layers/domain/errors.rb +10 -3
- data/lib/project_types/script/layers/domain/extension_point.rb +2 -2
- data/lib/project_types/script/layers/domain/push_package.rb +0 -3
- data/lib/project_types/script/layers/domain/script_config.rb +6 -4
- data/lib/project_types/script/layers/domain/script_project.rb +1 -0
- data/lib/project_types/script/layers/infrastructure/errors.rb +47 -24
- data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +2 -12
- data/lib/project_types/script/layers/infrastructure/languages/project_creator.rb +1 -0
- data/lib/project_types/script/layers/infrastructure/languages/task_runner.rb +1 -0
- data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +2 -12
- data/lib/project_types/script/layers/infrastructure/languages/wasm_project_creator.rb +15 -0
- data/lib/project_types/script/layers/infrastructure/languages/wasm_task_runner.rb +36 -0
- data/lib/project_types/script/layers/infrastructure/metadata_repository.rb +18 -0
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +7 -8
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +45 -54
- data/lib/project_types/script/layers/infrastructure/script_service.rb +35 -12
- data/lib/project_types/script/layers/infrastructure/script_uploader.rb +22 -9
- data/lib/project_types/script/loaders/project.rb +2 -1
- data/lib/project_types/script/messages/messages.rb +94 -88
- data/lib/project_types/script/ui/error_handler.rb +75 -38
- data/lib/project_types/theme/commands/check.rb +3 -0
- data/lib/project_types/theme/commands/delete.rb +3 -0
- data/lib/project_types/theme/commands/init.rb +3 -0
- data/lib/project_types/theme/commands/language_server.rb +3 -0
- data/lib/project_types/theme/commands/package.rb +3 -0
- data/lib/project_types/theme/commands/publish.rb +3 -0
- data/lib/project_types/theme/commands/pull.rb +12 -1
- data/lib/project_types/theme/commands/push.rb +12 -1
- data/lib/project_types/theme/commands/serve.rb +3 -0
- data/lib/project_types/theme/messages/messages.rb +4 -0
- data/lib/shopify_cli/command/sub_command.rb +2 -0
- data/lib/shopify_cli/command.rb +66 -0
- data/lib/shopify_cli/commands/app/create/node.rb +3 -0
- data/lib/shopify_cli/commands/app/create/rails.rb +3 -0
- data/lib/shopify_cli/commands/app/create.rb +3 -0
- data/lib/shopify_cli/commands/app/deploy.rb +3 -0
- data/lib/shopify_cli/commands/app/serve.rb +3 -0
- data/lib/shopify_cli/commands/login.rb +4 -10
- data/lib/shopify_cli/constants.rb +18 -2
- data/lib/shopify_cli/core/executor.rb +4 -4
- data/lib/shopify_cli/environment.rb +61 -16
- data/lib/shopify_cli/exception_reporter.rb +9 -0
- data/lib/shopify_cli/github/issue_url_generator.rb +19 -8
- data/lib/shopify_cli/identity_auth/env_auth_token.rb +34 -0
- data/lib/shopify_cli/identity_auth.rb +36 -18
- data/lib/shopify_cli/messages/messages.rb +2 -2
- data/lib/shopify_cli/method_object.rb +21 -9
- data/lib/shopify_cli/partners_api.rb +7 -2
- data/lib/shopify_cli/result.rb +61 -59
- data/lib/shopify_cli/services/app/create/rails_service.rb +37 -13
- data/lib/shopify_cli/task.rb +5 -3
- data/lib/shopify_cli/theme/file.rb +2 -2
- data/lib/shopify_cli/theme/filter/path_matcher.rb +38 -0
- data/lib/shopify_cli/theme/ignore_filter.rb +14 -18
- data/lib/shopify_cli/theme/include_filter.rb +65 -0
- data/lib/shopify_cli/theme/syncer.rb +17 -2
- data/lib/shopify_cli/utilities.rb +7 -0
- data/lib/shopify_cli/version.rb +1 -1
- data/lib/shopify_cli.rb +3 -1
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +11 -6
- data/vendor/deps/cli-kit/lib/cli/kit/util.rb +5 -1
- data/vendor/deps/cli-ui/lib/cli/ui/os.rb +6 -4
- data/vendor/deps/ruby2_keywords/LICENSE +22 -0
- data/vendor/deps/ruby2_keywords/README.md +67 -0
- data/vendor/deps/ruby2_keywords/Rakefile +54 -0
- data/vendor/deps/ruby2_keywords/lib/ruby2_keywords.rb +57 -0
- data/vendor/deps/ruby2_keywords/ruby2_keywords.gemspec +18 -0
- data/vendor/deps/ruby2_keywords/test/test_keyword.rb +41 -0
- data/vendor/lib/semantic/version.rb +0 -1
- metadata +18 -3
- data/lib/project_types/rails/commands/create.rb +0 -210
@@ -5,90 +5,91 @@ module Script
|
|
5
5
|
MESSAGES = {
|
6
6
|
script: {
|
7
7
|
help: <<~HELP,
|
8
|
-
Suite of commands for developing script applications.
|
8
|
+
Suite of commands for developing script applications. Run {{command:%1$s script <command> --help}} for usage of each command.
|
9
9
|
Usage: {{command:%1$s script [ %2$s ]}}
|
10
10
|
HELP
|
11
11
|
|
12
12
|
error: {
|
13
|
-
deprecated_ep: "This
|
14
|
-
"
|
15
|
-
deprecated_ep_cause: "
|
13
|
+
deprecated_ep: "This script won't run in a store because "\
|
14
|
+
"it uses a deprecated Script API (%s).",
|
15
|
+
deprecated_ep_cause: "Recreate this script using a supported Script API.",
|
16
16
|
generic: "{{red:{{x}} Error}}",
|
17
17
|
eacces_cause: "You don't have permission to write to this directory.",
|
18
|
-
eacces_help: "
|
18
|
+
eacces_help: "Get permission for this directory or choose a different one.",
|
19
19
|
|
20
20
|
enospc_cause: "You don't have enough disk space to do this action.",
|
21
|
-
enospc_help: "Free up
|
21
|
+
enospc_help: "Free up more space.",
|
22
22
|
|
23
23
|
oauth_cause: "Something went wrong while authenticating your account with the Partner Dashboard.",
|
24
|
-
oauth_help: "
|
24
|
+
oauth_help: "Wait a few minutes and try again.",
|
25
25
|
|
26
|
-
invalid_context_cause: "Your .shopify-cli.yml
|
26
|
+
invalid_context_cause: "Your .shopify-cli.yml is formatted incorrectly. It's missing values for "\
|
27
27
|
"extension_point_type or script_name.",
|
28
|
-
invalid_context_help: "Add these values
|
28
|
+
invalid_context_help: "Add these values.",
|
29
29
|
|
30
|
-
invalid_script_name_cause: "
|
31
|
-
invalid_script_name_help: "
|
32
|
-
"are numbers, letters, hyphens, or underscores.",
|
30
|
+
invalid_script_name_cause: "Script name contains unsupported characters.",
|
31
|
+
invalid_script_name_help: "Use only numbers, letters, hyphens, or underscores.",
|
33
32
|
|
34
|
-
no_existing_apps_cause: "
|
35
|
-
|
36
|
-
|
33
|
+
no_existing_apps_cause: "Your script can't be pushed to an app because your Partner account "\
|
34
|
+
"doesn't have any apps.",
|
35
|
+
no_existing_apps_help: "Create an app.",
|
37
36
|
|
38
|
-
no_existing_orgs_cause: "
|
39
|
-
no_existing_orgs_help: "Visit https://partners.shopify.com/ to create
|
37
|
+
no_existing_orgs_cause: "Your account doesn't belong to a Partner Organization.",
|
38
|
+
no_existing_orgs_help: "Visit https://partners.shopify.com/ to create an account.",
|
40
39
|
|
41
40
|
project_exists_cause: "A directory with this same name already exists.",
|
42
|
-
project_exists_help: "
|
41
|
+
project_exists_help: "Choose a different name for your script.",
|
43
42
|
|
44
|
-
invalid_extension_cause: "
|
45
|
-
invalid_extension_help: "
|
43
|
+
invalid_extension_cause: "The name of the Script API is incorrect: %s.",
|
44
|
+
invalid_extension_help: "Choose a supported API: %s.",
|
46
45
|
|
47
|
-
invalid_language_cause: "
|
48
|
-
invalid_language_help: "
|
46
|
+
invalid_language_cause: "The language is not supported: %s.",
|
47
|
+
invalid_language_help: "Choose a supported language: %s.",
|
49
48
|
|
50
|
-
|
51
|
-
|
49
|
+
missing_script_config_field_cause: "The %{filename} file is missing the required %{field} field.",
|
50
|
+
missing_script_config_field_help: "Add the field.",
|
52
51
|
|
53
|
-
|
54
|
-
|
52
|
+
script_config_parse_error_cause: "The %{filename} file contains incorrect %{serialization_format}.",
|
53
|
+
script_config_parse_error_help: "Correct the errors.",
|
55
54
|
|
56
|
-
|
57
|
-
|
55
|
+
no_script_config_file_cause: "The %{filename} file is missing.",
|
56
|
+
no_script_config_file_help: "Create this file.",
|
58
57
|
|
59
|
-
|
60
|
-
|
58
|
+
app_not_connected_cause: "The script is not connected to an app.",
|
59
|
+
app_not_connected_help: "Run {{command:%{tool_name} script connect}}.",
|
61
60
|
|
62
|
-
|
63
|
-
|
61
|
+
configuration_definition_error_cause: "In %{filename} there is a problem with the "\
|
62
|
+
"configuration. %{message}",
|
63
|
+
configuration_definition_error_help: "Fix the error.",
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
configuration_definition_errors_cause: "In %{filename}, there are %{error_count} problems with "\
|
66
|
+
"the configuration:\n%{concatenated_messages}\n",
|
67
|
+
configuration_definition_errors_help: "Correct the errors.",
|
67
68
|
|
68
|
-
configuration_syntax_error_cause: "The
|
69
|
-
configuration_syntax_error_help: "Fix the errors
|
69
|
+
configuration_syntax_error_cause: "The %{filename} is not formatted correctly.",
|
70
|
+
configuration_syntax_error_help: "Fix the errors.",
|
70
71
|
|
71
|
-
configuration_missing_keys_error_cause: "The
|
72
|
+
configuration_missing_keys_error_cause: "The %{filename} is missing required keys: "\
|
72
73
|
"%{missing_keys}.",
|
73
|
-
configuration_missing_keys_error_help: "Add the keys
|
74
|
+
configuration_missing_keys_error_help: "Add the keys.",
|
74
75
|
|
75
|
-
configuration_invalid_value_error_cause: "The
|
76
|
+
configuration_invalid_value_error_cause: "The %{filename} configuration accepts "\
|
76
77
|
"one of the following types(s): %{valid_input_modes}.",
|
77
|
-
configuration_invalid_value_error_help: "Change the
|
78
|
+
configuration_invalid_value_error_help: "Change the value of the type.",
|
78
79
|
|
79
|
-
configuration_schema_field_missing_keys_error_cause: "A configuration entry in the
|
80
|
+
configuration_schema_field_missing_keys_error_cause: "A configuration entry in the %{filename} file "\
|
80
81
|
"is missing required keys: %{missing_keys}.",
|
81
|
-
configuration_definition_schema_field_missing_keys_error_help: "Add the keys
|
82
|
+
configuration_definition_schema_field_missing_keys_error_help: "Add the keys.",
|
82
83
|
|
83
84
|
configuration_schema_field_invalid_value_error_cause: "The configuration entries in the "\
|
84
|
-
"
|
85
|
+
"%{filename} file accept one of the following "\
|
85
86
|
"type(s): %{valid_types}.",
|
86
|
-
configuration_schema_field_invalid_value_error_help: "Change the
|
87
|
+
configuration_schema_field_invalid_value_error_help: "Change the value of the type.",
|
87
88
|
|
88
|
-
script_not_found_cause: "
|
89
|
+
script_not_found_cause: "Can't find script %s for Script API %s",
|
89
90
|
|
90
|
-
system_call_failure_cause: "
|
91
|
-
system_call_failure_help: "
|
91
|
+
system_call_failure_cause: "Something went wrong while running: {{command:%{cmd}}}.",
|
92
|
+
system_call_failure_help: "Correct the error.\n{{red:%{out}}}",
|
92
93
|
|
93
94
|
metadata_validation_cause: "The Script API metadata is incorrect.",
|
94
95
|
metadata_validation_help: "The 'schemaVersions.major' field contains an unsupported version.",
|
@@ -102,57 +103,58 @@ module Script
|
|
102
103
|
metadata_schema_versions_missing_minor: "Invalid Script API metadata:" \
|
103
104
|
" 'schemaVersions' is missing the 'minor' field",
|
104
105
|
|
105
|
-
metadata_not_found_cause: "
|
106
|
-
metadata_not_found_help: "
|
107
|
-
|
108
|
-
"'--metadata build/metadata.json' argument",
|
106
|
+
metadata_not_found_cause: "Can't find the script version file (%{filename}).",
|
107
|
+
metadata_not_found_help: "Make sure your project is up-to-date and a script metadata file " \
|
108
|
+
"is accessible at %{filename}.",
|
109
109
|
|
110
110
|
build_error_cause: "Something went wrong while building the script.",
|
111
|
-
build_error_help: "Correct the errors
|
111
|
+
build_error_help: "Correct the errors.",
|
112
112
|
|
113
113
|
dependency_install_cause: "Something went wrong while installing the needed dependencies.",
|
114
|
-
dependency_install_help: "Correct the errors
|
114
|
+
dependency_install_help: "Correct the errors.",
|
115
115
|
|
116
116
|
failed_api_request_cause: "Something went wrong while communicating with Shopify.",
|
117
117
|
failed_api_request_help: "Try again.",
|
118
118
|
|
119
|
-
forbidden_error_cause: "You
|
119
|
+
forbidden_error_cause: "You don't have permission to do this action.",
|
120
120
|
|
121
121
|
graphql_error_cause: "An error was returned: %s.",
|
122
|
-
graphql_error_help: "\
|
122
|
+
graphql_error_help: "\nCorrect the error.",
|
123
123
|
|
124
|
-
script_repush_cause: "
|
124
|
+
script_repush_cause: "Can’t push the script because a version of this script already exists on the app.",
|
125
125
|
script_repush_help: "Use {{cyan:--force}} to replace the existing script.",
|
126
126
|
|
127
127
|
build_script_not_found: "The root package.json is missing the build command that " \
|
128
|
-
"is needed to compile your script to
|
128
|
+
"is needed to compile your script to Wasm.",
|
129
129
|
# rubocop:disable Layout/LineLength
|
130
130
|
build_script_suggestion: "\n\nFor example, your package.json needs the following command:" \
|
131
131
|
"\nbuild: npx shopify-scripts-toolchain-as build --src src/shopify_main.ts --binary build/<script_name>.wasm --metadata build/metadata.json -- --lib node_modules --optimize --use Date=",
|
132
132
|
|
133
|
-
web_assembly_binary_not_found: "
|
134
|
-
web_assembly_binary_not_found_suggestion: "
|
135
|
-
|
136
|
-
"Generated binary should match the script name: <script_name>.wasm",
|
133
|
+
web_assembly_binary_not_found: "Wasm binary not found.",
|
134
|
+
web_assembly_binary_not_found_suggestion: "Check that there is a valid Wasm binary in the root directory" \
|
135
|
+
"Your Wasm binary should match the script name: <script_name>.wasm",
|
137
136
|
|
138
137
|
project_config_not_found: "Internal error - Script can't be created because the project's config file is missing from the repository.",
|
139
138
|
|
140
139
|
invalid_project_config: "Internal error - Script can't be created because the project's config file is invalid in the repository.",
|
141
140
|
|
142
|
-
script_upload_cause: "
|
141
|
+
script_upload_cause: "Something went wrong and your script couldn't be pushed.",
|
143
142
|
script_upload_help: "Try again.",
|
144
143
|
|
144
|
+
script_too_large_cause: "The size of your Wasm binary file is too large.",
|
145
|
+
script_too_large_help: "It must be less than %{max_size}.",
|
146
|
+
|
145
147
|
api_library_not_found_cause: "Script can't be created because API library %{library_name} is missing from the dependencies",
|
146
|
-
api_library_not_found_help: "This
|
148
|
+
api_library_not_found_help: "This can occur because the API library was removed from your system or there is a problem with dependencies in the repository.",
|
147
149
|
|
148
150
|
language_library_for_api_not_found_cause: "Script can’t be pushed because the %{language} library for API %{api} is missing.",
|
149
151
|
language_library_for_api_not_found_help: "Make sure extension_point.yml contains the correct API library.",
|
150
|
-
no_scripts_found_in_app: "The selected apps have no scripts.
|
152
|
+
no_scripts_found_in_app: "The selected apps have no scripts. Create them first on the partners' dashboard.",
|
151
153
|
missing_env_file_variables: "The following variables are missing in the .env file: %s."\
|
152
|
-
"
|
154
|
+
" This can occur when the script hasn't been connected to an app."\
|
153
155
|
" To connect the script to an app, run {{command:%s script connect}}",
|
154
|
-
missing_push_options: "The following options are
|
155
|
-
"
|
156
|
+
missing_push_options: "The following options are missing from .env: %s."\
|
157
|
+
" Run {{command:%s script connect}} to connect the script to an app and generate these options.",
|
156
158
|
},
|
157
159
|
|
158
160
|
create: {
|
@@ -160,26 +162,29 @@ module Script
|
|
160
162
|
{{command:%1$s script create}}: Creates a script project.
|
161
163
|
Usage: {{command:%1$s script create}}
|
162
164
|
Options:
|
163
|
-
{{command:--name=NAME}} Script project name.
|
164
|
-
{{command:--api=TYPE}} Script API name.
|
165
|
-
{{command:--language=LANGUAGE}} Programming language.
|
165
|
+
{{command:--name=NAME}} Script project name.
|
166
|
+
{{command:--api=TYPE}} Script API name. Supported values: %2$s.
|
167
|
+
{{command:--language=LANGUAGE}} Programming language. Supported values: %3$s.
|
166
168
|
HELP
|
167
169
|
|
168
170
|
error: {
|
169
|
-
operation_failed: "
|
171
|
+
operation_failed: "Something went wrong and the script wasn't created.",
|
170
172
|
},
|
171
173
|
|
172
|
-
change_directory_notice: "{{*}} Change directories to {{green:%s}} to run script commands",
|
173
|
-
creating: "Creating script",
|
174
|
-
created: "Created script",
|
174
|
+
change_directory_notice: "{{*}} Change directories to {{green:%s}} to run script commands.",
|
175
|
+
creating: "Creating script.",
|
176
|
+
created: "Created script.",
|
177
|
+
preparing_project: "Preparing script project structure.",
|
178
|
+
creating_wasm: "Creating configuration files.",
|
179
|
+
created_wasm: "Configuration files created.",
|
175
180
|
},
|
176
181
|
|
177
182
|
push: {
|
178
183
|
help: <<~HELP,
|
179
|
-
Build the script, upload it to Shopify, and register it to an app.
|
184
|
+
Build the script, upload it to Shopify, and register it to an app.
|
180
185
|
Usage: {{command:%s script push}}
|
181
186
|
Options:
|
182
|
-
{{command:[--force]}}
|
187
|
+
{{command:[--force]}} Replace the existing script with this version.
|
183
188
|
{{command:[--api-key=API_KEY]}} The API key used to register an app with the script. This can be found on the app page on Partners Dashboard. Overrides the value in the .env file, if present.
|
184
189
|
{{command:[--api-secret=API_SECRET]}} The API secret of the app the script is registered with. Overrides the value in the .env file, if present.
|
185
190
|
{{command:[--uuid=UUID]}} The uuid of the script. Overrides the value in the .env file, if present.
|
@@ -202,34 +207,34 @@ module Script
|
|
202
207
|
error: {
|
203
208
|
operation_failed: "Couldn't connect script to app.",
|
204
209
|
missing_env_file_variables: "The following variables are missing in the .env file: %s."\
|
205
|
-
" To connect the script to an app,
|
210
|
+
" To connect the script to an app, enter the value into the .env file or delete the .env file, and then run {{command:%s script connect}}",
|
206
211
|
},
|
207
212
|
},
|
208
213
|
javy: {
|
209
214
|
help: <<~HELP,
|
210
|
-
Compile the JavaScript code into
|
215
|
+
Compile the JavaScript code into Wasm.
|
211
216
|
Usage: {{command:%s script javy}}
|
212
217
|
Options:
|
213
218
|
{{command:--in}} The name of the JavaScript file that will be compiled.
|
214
|
-
{{command:--out}} The name of the file that the
|
219
|
+
{{command:--out}} The name of the file that the Wasm should be written to.
|
215
220
|
HELP
|
216
221
|
errors: {
|
217
|
-
invalid_arguments: "Javy was run with invalid arguments. Run {{command: %s script javy --help}}
|
222
|
+
invalid_arguments: "Javy was run with invalid arguments. Run {{command: %s script javy --help}}.",
|
218
223
|
},
|
219
224
|
},
|
220
225
|
|
221
226
|
project_deps: {
|
222
|
-
none_required: "{{v}}
|
223
|
-
|
224
|
-
installing: "
|
225
|
-
installed: "
|
227
|
+
none_required: "{{v}} Dependencies are up to date.",
|
228
|
+
checking: "Checking dependencies.",
|
229
|
+
installing: "Installing dependencies.",
|
230
|
+
installed: "Installed missing dependencies.",
|
226
231
|
},
|
227
232
|
|
228
233
|
forms: {
|
229
234
|
create: {
|
230
235
|
select_extension_point: "Which Script API do you want to use?",
|
231
236
|
select_language: "Which language do you want to use?",
|
232
|
-
script_name: "
|
237
|
+
script_name: "What do you want to name your script?",
|
233
238
|
},
|
234
239
|
},
|
235
240
|
|
@@ -238,14 +243,15 @@ module Script
|
|
238
243
|
building_script: "Building script",
|
239
244
|
built: "Built",
|
240
245
|
pushing: "Pushing",
|
246
|
+
pushing_script: "Pushing script",
|
241
247
|
pushed: "Pushed",
|
242
248
|
ensure_env: {
|
243
249
|
organization: "Partner organization {{green:%s (%s)}}.",
|
244
250
|
organization_select: "Which partner organization do you want to use?",
|
245
|
-
app: "
|
251
|
+
app: "Push script to app {{green:%s}}.",
|
246
252
|
app_select: "Which app do you want to push this script to?",
|
247
|
-
ask_connect_to_existing_script: "
|
248
|
-
"existing
|
253
|
+
ask_connect_to_existing_script: "This app contains scripts. Do you want to replace an "\
|
254
|
+
"existing script on the app with this script?",
|
249
255
|
ask_which_script_to_connect_to: "Which script do you want to replace?",
|
250
256
|
},
|
251
257
|
},
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "cli/ui"
|
2
4
|
|
3
5
|
module Script
|
@@ -5,9 +7,9 @@ module Script
|
|
5
7
|
module ErrorHandler
|
6
8
|
def self.display(failed_op:, cause_of_error:, help_suggestion:)
|
7
9
|
$stderr.puts(CLI::UI.fmt(ShopifyCLI::Context.message("script.error.generic")))
|
8
|
-
full_msg = failed_op ? failed_op.dup :
|
9
|
-
full_msg
|
10
|
-
full_msg
|
10
|
+
full_msg = failed_op ? failed_op.dup : String.new
|
11
|
+
append_msg(full_msg, cause_of_error) if cause_of_error
|
12
|
+
append_msg(full_msg, help_suggestion) if help_suggestion
|
11
13
|
$stderr.puts(CLI::UI.fmt(full_msg.strip))
|
12
14
|
end
|
13
15
|
|
@@ -22,6 +24,11 @@ module Script
|
|
22
24
|
display_and_raise(failed_op: failed_op, **messages)
|
23
25
|
end
|
24
26
|
|
27
|
+
private_class_method def self.append_msg(full_msg, msg_to_append)
|
28
|
+
full_msg << " " unless /\s$/.match?(full_msg)
|
29
|
+
full_msg << msg_to_append
|
30
|
+
end
|
31
|
+
|
25
32
|
def self.error_messages(e)
|
26
33
|
case e
|
27
34
|
when Errno::EACCES
|
@@ -100,59 +107,81 @@ module Script
|
|
100
107
|
}
|
101
108
|
when Layers::Domain::Errors::MetadataNotFoundError
|
102
109
|
{
|
103
|
-
cause_of_error: ShopifyCLI::Context.message("script.error.metadata_not_found_cause"),
|
104
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.metadata_not_found_help"),
|
110
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.metadata_not_found_cause", filename: e.filename),
|
111
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.metadata_not_found_help", filename: e.filename),
|
112
|
+
}
|
113
|
+
when Layers::Domain::Errors::MissingScriptConfigFieldError
|
114
|
+
{
|
115
|
+
cause_of_error: ShopifyCLI::Context.message(
|
116
|
+
"script.error.missing_script_config_field_cause",
|
117
|
+
field: e.field,
|
118
|
+
filename: e.filename,
|
119
|
+
),
|
120
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.missing_script_config_field_help"),
|
105
121
|
}
|
106
122
|
when Layers::Infrastructure::Errors::BuildError
|
107
123
|
{
|
108
124
|
cause_of_error: ShopifyCLI::Context.message("script.error.build_error_cause"),
|
109
125
|
help_suggestion: ShopifyCLI::Context.message("script.error.build_error_help"),
|
110
126
|
}
|
111
|
-
when Layers::Infrastructure::Errors::
|
112
|
-
{
|
113
|
-
cause_of_error: ShopifyCLI::Context.message("script.error.invalid_script_config_yml_definition_cause"),
|
114
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.invalid_script_config_yml_definition_help"),
|
115
|
-
}
|
116
|
-
when Layers::Infrastructure::Errors::InvalidScriptJsonDefinitionError
|
117
|
-
{
|
118
|
-
cause_of_error: ShopifyCLI::Context.message("script.error.invalid_script_json_definition_cause"),
|
119
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.invalid_script_json_definition_help"),
|
120
|
-
}
|
121
|
-
when Layers::Infrastructure::Errors::MissingScriptConfigYmlFieldError
|
122
|
-
{
|
123
|
-
cause_of_error: ShopifyCLI::Context.message("script.error.missing_script_config_yml_field_cause", e.field),
|
124
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.missing_script_config_yml_field_help"),
|
125
|
-
}
|
126
|
-
when Layers::Infrastructure::Errors::MissingScriptConfigYmlFieldError
|
127
|
+
when Layers::Infrastructure::Errors::ScriptConfigParseError
|
127
128
|
{
|
128
|
-
cause_of_error: ShopifyCLI::Context.message(
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.missing_script_json_field_help"),
|
129
|
+
cause_of_error: ShopifyCLI::Context.message(
|
130
|
+
"script.error.script_config_parse_error_cause",
|
131
|
+
filename: e.filename,
|
132
|
+
serialization_format: e.serialization_format,
|
133
|
+
),
|
134
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.script_config_parse_error_help"),
|
135
135
|
}
|
136
|
-
when Layers::Infrastructure::Errors::
|
136
|
+
when Layers::Infrastructure::Errors::NoScriptConfigFileError
|
137
137
|
{
|
138
|
-
cause_of_error: ShopifyCLI::Context.message(
|
139
|
-
|
140
|
-
|
138
|
+
cause_of_error: ShopifyCLI::Context.message(
|
139
|
+
"script.error.no_script_config_file_cause",
|
140
|
+
filename: e.filename,
|
141
|
+
),
|
142
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.no_script_config_file_help"),
|
143
|
+
}
|
144
|
+
when Layers::Infrastructure::Errors::ScriptConfigurationDefinitionError
|
145
|
+
if e.messages.count == 1
|
146
|
+
{
|
147
|
+
cause_of_error: ShopifyCLI::Context.message(
|
148
|
+
"script.error.configuration_definition_error_cause",
|
149
|
+
message: e.messages.fetch(0),
|
150
|
+
filename: e.filename,
|
151
|
+
),
|
152
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.configuration_definition_error_help"),
|
153
|
+
}
|
154
|
+
else
|
155
|
+
{
|
156
|
+
cause_of_error: ShopifyCLI::Context.message(
|
157
|
+
"script.error.configuration_definition_errors_cause",
|
158
|
+
concatenated_messages: e.messages.map { |m| "{{x}} #{m}" }.join("\n"),
|
159
|
+
filename: e.filename,
|
160
|
+
error_count: e.messages.count,
|
161
|
+
),
|
162
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.configuration_definition_errors_help"),
|
163
|
+
}
|
164
|
+
end
|
141
165
|
when Layers::Infrastructure::Errors::ScriptConfigSyntaxError
|
142
166
|
{
|
143
|
-
cause_of_error: ShopifyCLI::Context.message(
|
167
|
+
cause_of_error: ShopifyCLI::Context.message(
|
168
|
+
"script.error.configuration_syntax_error_cause",
|
169
|
+
filename: e.filename,
|
170
|
+
),
|
144
171
|
help_suggestion: ShopifyCLI::Context.message("script.error.configuration_syntax_error_help"),
|
145
172
|
}
|
146
173
|
when Layers::Infrastructure::Errors::ScriptEnvAppNotConnectedError
|
147
174
|
{
|
148
175
|
cause_of_error: ShopifyCLI::Context.message("script.error.app_not_connected_cause"),
|
149
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.app_not_connected_help"
|
176
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.app_not_connected_help",
|
177
|
+
tool_name: ShopifyCLI::TOOL_NAME),
|
150
178
|
}
|
151
179
|
when Layers::Infrastructure::Errors::ScriptConfigMissingKeysError
|
152
180
|
{
|
153
181
|
cause_of_error: ShopifyCLI::Context.message(
|
154
182
|
"script.error.configuration_missing_keys_error_cause",
|
155
|
-
missing_keys: e.missing_keys
|
183
|
+
missing_keys: e.missing_keys,
|
184
|
+
filename: e.filename,
|
156
185
|
),
|
157
186
|
help_suggestion: ShopifyCLI::Context.message("script.error.configuration_missing_keys_error_help"),
|
158
187
|
}
|
@@ -160,7 +189,8 @@ module Script
|
|
160
189
|
{
|
161
190
|
cause_of_error: ShopifyCLI::Context.message(
|
162
191
|
"script.error.configuration_invalid_value_error_cause",
|
163
|
-
valid_input_modes: e.valid_input_modes
|
192
|
+
valid_input_modes: e.valid_input_modes,
|
193
|
+
filename: e.filename,
|
164
194
|
),
|
165
195
|
help_suggestion: ShopifyCLI::Context.message("script.error.configuration_invalid_value_error_help"),
|
166
196
|
}
|
@@ -168,7 +198,8 @@ module Script
|
|
168
198
|
{
|
169
199
|
cause_of_error: ShopifyCLI::Context.message(
|
170
200
|
"script.error.configuration_schema_field_missing_keys_error_cause",
|
171
|
-
missing_keys: e.missing_keys
|
201
|
+
missing_keys: e.missing_keys,
|
202
|
+
filename: e.filename,
|
172
203
|
),
|
173
204
|
help_suggestion: ShopifyCLI::Context.message(
|
174
205
|
"script.error.configuration_definition_schema_field_missing_keys_error_help"
|
@@ -178,7 +209,8 @@ module Script
|
|
178
209
|
{
|
179
210
|
cause_of_error: ShopifyCLI::Context.message(
|
180
211
|
"script.error.configuration_schema_field_invalid_value_error_cause",
|
181
|
-
valid_types: e.valid_types
|
212
|
+
valid_types: e.valid_types,
|
213
|
+
filename: e.filename,
|
182
214
|
),
|
183
215
|
help_suggestion: ShopifyCLI::Context.message(
|
184
216
|
"script.error.configuration_schema_field_invalid_value_error_help"
|
@@ -239,6 +271,11 @@ module Script
|
|
239
271
|
cause_of_error: ShopifyCLI::Context.message("script.error.script_upload_cause"),
|
240
272
|
help_suggestion: ShopifyCLI::Context.message("script.error.script_upload_help"),
|
241
273
|
}
|
274
|
+
when Layers::Infrastructure::Errors::ScriptTooLargeError
|
275
|
+
{
|
276
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.script_too_large_cause"),
|
277
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.script_too_large_help", max_size: e.max_size),
|
278
|
+
}
|
242
279
|
when Layers::Infrastructure::Errors::APILibraryNotFoundError
|
243
280
|
{
|
244
281
|
cause_of_error: ShopifyCLI::Context
|
@@ -5,6 +5,9 @@ require "shopify_cli/theme/development_theme"
|
|
5
5
|
module Theme
|
6
6
|
class Command
|
7
7
|
class Delete < ShopifyCLI::Command::SubCommand
|
8
|
+
recommend_default_node_range
|
9
|
+
recommend_default_ruby_range
|
10
|
+
|
8
11
|
options do |parser, flags|
|
9
12
|
parser.on("-d", "--development") { flags[:development] = true }
|
10
13
|
parser.on("-a", "--show-all") { flags[:show_all] = true }
|
@@ -4,6 +4,9 @@ require "shopify_cli/theme/theme"
|
|
4
4
|
module Theme
|
5
5
|
class Command
|
6
6
|
class Publish < ShopifyCLI::Command::SubCommand
|
7
|
+
recommend_default_node_range
|
8
|
+
recommend_default_ruby_range
|
9
|
+
|
7
10
|
options do |parser, flags|
|
8
11
|
parser.on("-f", "--force") { flags[:force] = true }
|
9
12
|
end
|
@@ -1,17 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require "shopify_cli/theme/theme"
|
3
3
|
require "shopify_cli/theme/ignore_filter"
|
4
|
+
require "shopify_cli/theme/include_filter"
|
4
5
|
require "shopify_cli/theme/syncer"
|
5
6
|
|
6
7
|
module Theme
|
7
8
|
class Command
|
8
9
|
class Pull < ShopifyCLI::Command::SubCommand
|
10
|
+
recommend_default_node_range
|
11
|
+
recommend_default_ruby_range
|
12
|
+
|
9
13
|
options do |parser, flags|
|
10
14
|
parser.on("-n", "--nodelete") { flags[:nodelete] = true }
|
11
15
|
parser.on("-i", "--themeid=ID") { |theme_id| flags[:theme_id] = theme_id }
|
12
16
|
parser.on("-t", "--theme=NAME_OR_ID") { |theme| flags[:theme] = theme }
|
13
17
|
parser.on("-l", "--live") { flags[:live] = true }
|
14
18
|
parser.on("-d", "--development") { flags[:development] = true }
|
19
|
+
parser.on("-o", "--only=PATTERN") do |pattern|
|
20
|
+
flags[:includes] ||= []
|
21
|
+
flags[:includes] << pattern
|
22
|
+
end
|
15
23
|
parser.on("-x", "--ignore=PATTERN") do |pattern|
|
16
24
|
flags[:ignores] ||= []
|
17
25
|
flags[:ignores] << pattern
|
@@ -24,10 +32,13 @@ module Theme
|
|
24
32
|
theme = find_theme(root, **options.flags)
|
25
33
|
return if theme.nil?
|
26
34
|
|
35
|
+
include_filter = ShopifyCLI::Theme::IncludeFilter.new(options.flags[:includes])
|
27
36
|
ignore_filter = ShopifyCLI::Theme::IgnoreFilter.from_path(root)
|
28
37
|
ignore_filter.add_patterns(options.flags[:ignores]) if options.flags[:ignores]
|
29
38
|
|
30
|
-
syncer = ShopifyCLI::Theme::Syncer.new(@ctx, theme: theme,
|
39
|
+
syncer = ShopifyCLI::Theme::Syncer.new(@ctx, theme: theme,
|
40
|
+
include_filter: include_filter,
|
41
|
+
ignore_filter: ignore_filter)
|
31
42
|
begin
|
32
43
|
syncer.start_threads
|
33
44
|
CLI::UI::Frame.open(@ctx.message("theme.pull.pulling", theme.name, theme.id, theme.shop)) do
|