shopify-cli 2.6.6 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.devcontainer.json +5 -0
- data/.github/CODEOWNERS +2 -2
- data/.github/DESIGN.md +1 -1
- data/.github/ISSUE_TEMPLATE.md +7 -0
- data/.github/workflows/shopify.yml +1 -1
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/.vscode/extensions.json +5 -0
- data/.vscode/settings.json +9 -0
- data/CHANGELOG.md +44 -4
- data/CONTRIBUTING.md +1 -29
- data/{Dockerfile → Codespace.dockerfile} +2 -2
- data/Gemfile.lock +5 -5
- data/README.md +20 -99
- data/Rakefile +27 -0
- data/Tests.dockerfile +35 -0
- data/assets/logo.png +0 -0
- data/dev.yml +1 -4
- data/docs/README.md +13 -0
- data/docs/contributors/testing.md +27 -0
- data/docs/users/installation.md +46 -0
- data/{THEMEKIT_MIGRATION.md → docs/users/migrate-from-themekit.md} +1 -1
- data/ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256 +1 -0
- data/ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256 +1 -0
- data/ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256 +1 -0
- data/ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256 +1 -0
- data/ext/javy/javy.rb +205 -0
- data/ext/javy/version +1 -0
- data/lib/project_types/extension/cli.rb +6 -3
- data/lib/project_types/extension/commands/build.rb +4 -8
- data/lib/project_types/extension/commands/create.rb +2 -5
- data/lib/project_types/extension/commands/extension_command.rb +1 -1
- data/lib/project_types/extension/features/argo_serve.rb +9 -23
- data/lib/project_types/extension/forms/questions/ask_template.rb +1 -5
- data/lib/project_types/extension/messages/messages.rb +0 -2
- data/lib/project_types/extension/models/development_server.rb +2 -2
- data/lib/project_types/extension/models/development_server_requirements.rb +2 -3
- data/lib/project_types/extension/models/server_config/app.rb +13 -0
- data/lib/project_types/extension/models/server_config/development.rb +5 -4
- data/lib/project_types/extension/models/server_config/development_renderer.rb +1 -1
- data/lib/project_types/extension/models/server_config/development_resource.rb +13 -0
- data/lib/project_types/extension/models/server_config/extension.rb +3 -1
- data/lib/project_types/extension/models/server_config/root.rb +4 -1
- data/lib/project_types/extension/tasks/convert_server_config.rb +65 -0
- data/lib/project_types/extension/tasks/ensure_resource_url.rb +39 -0
- data/lib/project_types/extension/tasks/merge_server_config.rb +32 -0
- data/lib/project_types/extension/tasks/run_extension_command.rb +11 -10
- data/lib/project_types/node/cli.rb +0 -16
- data/lib/project_types/node/forms/create.rb +5 -5
- data/lib/project_types/node/messages/messages.rb +2 -144
- data/lib/project_types/php/cli.rb +0 -11
- data/lib/project_types/php/forms/create.rb +5 -6
- data/lib/project_types/php/messages/messages.rb +2 -161
- data/lib/project_types/rails/cli.rb +0 -16
- data/lib/project_types/rails/commands/create.rb +3 -5
- data/lib/project_types/rails/forms/create.rb +5 -6
- data/lib/project_types/rails/messages/messages.rb +6 -151
- data/lib/project_types/script/cli.rb +8 -2
- data/lib/project_types/script/commands/create.rb +2 -4
- data/lib/project_types/script/commands/javy.rb +29 -0
- data/lib/project_types/script/commands/push.rb +3 -2
- data/lib/project_types/script/config/extension_points.yml +12 -30
- data/lib/project_types/script/forms/ask_app.rb +32 -0
- data/lib/project_types/script/forms/ask_org.rb +30 -0
- data/lib/project_types/script/forms/ask_script_uuid.rb +22 -0
- data/lib/project_types/script/forms/run_against_shopify_org.rb +14 -0
- data/lib/project_types/script/graphql/app_script_set.graphql +2 -2
- data/lib/project_types/script/layers/application/build_script.rb +0 -1
- data/lib/project_types/script/layers/application/connect_app.rb +73 -0
- data/lib/project_types/script/layers/application/create_script.rb +1 -1
- data/lib/project_types/script/layers/application/push_script.rb +1 -1
- data/lib/project_types/script/layers/domain/errors.rb +1 -4
- data/lib/project_types/script/layers/domain/push_package.rb +3 -3
- data/lib/project_types/script/layers/domain/{script_json.rb → script_config.rb} +2 -2
- data/lib/project_types/script/layers/domain/script_project.rb +5 -1
- data/lib/project_types/script/layers/infrastructure/errors.rb +36 -7
- data/lib/project_types/script/layers/infrastructure/languages/assemblyscript_task_runner.rb +0 -4
- data/lib/project_types/script/layers/infrastructure/languages/typescript_task_runner.rb +0 -4
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +104 -27
- data/lib/project_types/script/layers/infrastructure/script_service.rb +11 -11
- data/lib/project_types/script/messages/messages.rb +21 -4
- data/lib/project_types/script/ui/error_handler.rb +31 -21
- data/lib/project_types/theme/cli.rb +1 -1
- data/lib/project_types/theme/commands/check.rb +1 -1
- data/lib/project_types/theme/commands/delete.rb +1 -1
- data/lib/project_types/theme/commands/init.rb +1 -1
- data/lib/project_types/theme/commands/language_server.rb +1 -1
- data/lib/project_types/theme/commands/package.rb +1 -1
- data/lib/project_types/theme/commands/publish.rb +1 -1
- data/lib/project_types/theme/commands/pull.rb +4 -1
- data/lib/project_types/theme/commands/push.rb +5 -1
- data/lib/project_types/theme/commands/serve.rb +9 -3
- data/lib/project_types/theme/messages/messages.rb +39 -2
- data/lib/project_types/theme/ui/sync_progress_bar.rb +2 -2
- data/lib/shopify_cli/admin_api/populate_resource_command.rb +1 -1
- data/lib/shopify_cli/api.rb +7 -2
- data/lib/shopify_cli/app_type_detector.rb +24 -20
- data/lib/shopify_cli/command/app_sub_command.rb +10 -0
- data/lib/shopify_cli/command/project_command.rb +31 -0
- data/lib/shopify_cli/command/sub_command.rb +19 -0
- data/lib/shopify_cli/command.rb +7 -2
- data/lib/shopify_cli/commands/app/connect.rb +22 -0
- data/lib/shopify_cli/commands/app/create/node.rb +36 -0
- data/lib/shopify_cli/commands/app/create/php.rb +36 -0
- data/lib/shopify_cli/commands/app/create/rails.rb +38 -0
- data/lib/shopify_cli/commands/app/create.rb +28 -0
- data/lib/shopify_cli/commands/app/deploy.rb +49 -0
- data/lib/shopify_cli/commands/app/open.rb +19 -0
- data/lib/shopify_cli/commands/app/serve.rb +49 -0
- data/lib/shopify_cli/commands/app/tunnel.rb +43 -0
- data/lib/shopify_cli/commands/app.rb +29 -0
- data/lib/shopify_cli/commands/config.rb +2 -2
- data/lib/shopify_cli/commands.rb +1 -0
- data/lib/shopify_cli/constants.rb +7 -0
- data/lib/shopify_cli/context.rb +10 -0
- data/lib/shopify_cli/environment.rb +4 -0
- data/lib/shopify_cli/exception_reporter.rb +3 -4
- data/lib/shopify_cli/git.rb +14 -1
- data/lib/shopify_cli/github/issue_url_generator.rb +19 -0
- data/lib/shopify_cli/github.rb +5 -0
- data/lib/shopify_cli/identity_auth.rb +18 -0
- data/lib/shopify_cli/messages/messages.rb +254 -9
- data/lib/shopify_cli/partners_api.rb +1 -8
- data/lib/shopify_cli/project.rb +5 -1
- data/lib/shopify_cli/project_commands.rb +1 -1
- data/lib/shopify_cli/services/app/connect_service.rb +25 -0
- data/lib/shopify_cli/services/app/create/node_service.rb +155 -0
- data/lib/shopify_cli/services/app/create/php_service.rb +152 -0
- data/lib/shopify_cli/services/app/create/rails_service.rb +215 -0
- data/lib/shopify_cli/services/app/deploy/heroku/node_service.rb +101 -0
- data/lib/shopify_cli/services/app/deploy/heroku/php_service.rb +135 -0
- data/lib/shopify_cli/services/app/deploy/heroku/rails_service.rb +120 -0
- data/lib/shopify_cli/services/app/open_service.rb +19 -0
- data/lib/shopify_cli/services/app/serve/node_service.rb +42 -0
- data/lib/shopify_cli/services/app/serve/php_service.rb +46 -0
- data/lib/shopify_cli/services/app/serve/rails_service.rb +48 -0
- data/lib/shopify_cli/services/app/tunnel/auth_service.rb +21 -0
- data/lib/shopify_cli/services/app/tunnel/start_service.rb +20 -0
- data/lib/shopify_cli/services/app/tunnel/stop_service.rb +20 -0
- data/lib/shopify_cli/services.rb +31 -0
- data/lib/shopify_cli/tasks/ensure_authenticated.rb +9 -3
- data/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +73 -0
- data/lib/shopify_cli/theme/dev_server/hot-reload.js +25 -9
- data/lib/shopify_cli/theme/dev_server/local_assets.rb +1 -1
- data/lib/shopify_cli/theme/dev_server.rb +37 -18
- data/lib/shopify_cli/theme/syncer/error_reporter.rb +45 -0
- data/lib/shopify_cli/theme/syncer/operation.rb +56 -0
- data/lib/shopify_cli/theme/syncer/standard_reporter.rb +32 -0
- data/lib/shopify_cli/theme/syncer.rb +40 -39
- data/lib/shopify_cli/theme/theme.rb +31 -19
- data/lib/shopify_cli/tunnel.rb +26 -22
- data/lib/shopify_cli/version.rb +1 -1
- data/lib/shopify_cli.rb +1 -2
- data/shopify-cli.gemspec +1 -1
- data/shopify-dev +18 -0
- data/utilities/constants.rb +7 -0
- data/utilities/docker/container.rb +10 -3
- data/utilities/docker.rb +2 -2
- data/utilities/utilities.rb +1 -0
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +1 -1
- metadata +66 -50
- data/docs/_config.yml +0 -2
- data/docs/app/node/commands/index.md +0 -4
- data/docs/app/node/index.md +0 -4
- data/docs/app/rails/commands/index.md +0 -4
- data/docs/app/rails/index.md +0 -4
- data/docs/core/index.md +0 -4
- data/docs/getting-started/index.md +0 -4
- data/docs/getting-started/install/index.md +0 -4
- data/docs/getting-started/migrate/index.md +0 -4
- data/docs/getting-started/uninstall/index.md +0 -4
- data/docs/getting-started/upgrade/index.md +0 -4
- data/docs/help/start-app/index.md +0 -4
- data/docs/index.md +0 -4
- data/install.sh +0 -7
- data/lib/project_types/extension/tasks/converters/server_config_converter.rb +0 -30
- data/lib/project_types/extension/tasks/load_server_config.rb +0 -28
- data/lib/project_types/node/commands/connect.rb +0 -21
- data/lib/project_types/node/commands/create.rb +0 -125
- data/lib/project_types/node/commands/deploy/heroku.rb +0 -96
- data/lib/project_types/node/commands/deploy.rb +0 -32
- data/lib/project_types/node/commands/generate.rb +0 -22
- data/lib/project_types/node/commands/open.rb +0 -18
- data/lib/project_types/node/commands/serve.rb +0 -45
- data/lib/project_types/node/commands/tunnel.rb +0 -41
- data/lib/project_types/php/commands/connect.rb +0 -19
- data/lib/project_types/php/commands/create.rb +0 -143
- data/lib/project_types/php/commands/deploy/heroku.rb +0 -129
- data/lib/project_types/php/commands/deploy.rb +0 -32
- data/lib/project_types/php/commands/open.rb +0 -16
- data/lib/project_types/php/commands/serve.rb +0 -48
- data/lib/project_types/php/commands/tunnel.rb +0 -37
- data/lib/project_types/rails/commands/connect.rb +0 -21
- data/lib/project_types/rails/commands/deploy/heroku.rb +0 -115
- data/lib/project_types/rails/commands/deploy.rb +0 -32
- data/lib/project_types/rails/commands/generate/webhook.rb +0 -42
- data/lib/project_types/rails/commands/generate.rb +0 -60
- data/lib/project_types/rails/commands/open.rb +0 -18
- data/lib/project_types/rails/commands/serve.rb +0 -51
- data/lib/project_types/rails/commands/tunnel.rb +0 -41
- data/lib/project_types/script/tasks/ensure_env.rb +0 -106
- data/lib/shopify_cli/sub_command.rb +0 -17
- data/shopify.fish +0 -12
- data/shopify.sh +0 -11
|
@@ -5,9 +5,9 @@ module Script
|
|
|
5
5
|
module Infrastructure
|
|
6
6
|
module Errors
|
|
7
7
|
class BuildError < ScriptProjectError; end
|
|
8
|
-
class
|
|
8
|
+
class ScriptConfigSyntaxError < ScriptProjectError; end
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class ScriptConfigMissingKeysError < ScriptProjectError
|
|
11
11
|
attr_reader :missing_keys
|
|
12
12
|
def initialize(missing_keys)
|
|
13
13
|
super()
|
|
@@ -15,7 +15,7 @@ module Script
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
class
|
|
18
|
+
class ScriptConfigInvalidValueError < ScriptProjectError
|
|
19
19
|
attr_reader :valid_input_modes
|
|
20
20
|
def initialize(valid_input_modes)
|
|
21
21
|
super()
|
|
@@ -23,7 +23,7 @@ module Script
|
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
class
|
|
26
|
+
class ScriptConfigFieldsMissingKeysError < ScriptProjectError
|
|
27
27
|
attr_reader :missing_keys
|
|
28
28
|
def initialize(missing_keys)
|
|
29
29
|
super()
|
|
@@ -31,7 +31,7 @@ module Script
|
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
class
|
|
34
|
+
class ScriptConfigFieldsInvalidValueError < ScriptProjectError
|
|
35
35
|
attr_reader :valid_types
|
|
36
36
|
def initialize(valid_types)
|
|
37
37
|
super()
|
|
@@ -39,6 +39,29 @@ module Script
|
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
class InvalidScriptConfigYmlDefinitionError < ScriptProjectError; end
|
|
43
|
+
|
|
44
|
+
class InvalidScriptJsonDefinitionError < ScriptProjectError; end
|
|
45
|
+
|
|
46
|
+
class MissingScriptConfigYmlFieldError < ScriptProjectError
|
|
47
|
+
attr_reader :field
|
|
48
|
+
def initialize(field)
|
|
49
|
+
super()
|
|
50
|
+
@field = field
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
class MissingScriptJsonFieldError < ScriptProjectError
|
|
55
|
+
attr_reader :field
|
|
56
|
+
def initialize(field)
|
|
57
|
+
super()
|
|
58
|
+
@field = field
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
class NoScriptConfigYmlFileError < ScriptProjectError; end
|
|
63
|
+
class NoScriptConfigFileError < ScriptProjectError; end
|
|
64
|
+
|
|
42
65
|
class APILibraryNotFoundError < ScriptProjectError
|
|
43
66
|
attr_reader :library_name
|
|
44
67
|
def initialize(library_name)
|
|
@@ -56,8 +79,15 @@ module Script
|
|
|
56
79
|
end
|
|
57
80
|
end
|
|
58
81
|
|
|
82
|
+
class DeprecatedEPError < ScriptProjectError
|
|
83
|
+
attr_reader(:extension_point)
|
|
84
|
+
def initialize(extension_point)
|
|
85
|
+
super()
|
|
86
|
+
@extension_point = extension_point
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
59
90
|
class DependencyInstallError < ScriptProjectError; end
|
|
60
|
-
class DeprecatedEPError < ScriptProjectError; end
|
|
61
91
|
class EmptyResponseError < ScriptProjectError; end
|
|
62
92
|
class InvalidResponseError < ScriptProjectError; end
|
|
63
93
|
class ForbiddenError < ScriptProjectError; end
|
|
@@ -102,7 +132,6 @@ module Script
|
|
|
102
132
|
class ScriptProjectAlreadyExistsError < ScriptProjectError; end
|
|
103
133
|
class TaskRunnerNotFoundError < ScriptProjectError; end
|
|
104
134
|
class BuildScriptNotFoundError < ScriptProjectError; end
|
|
105
|
-
class InvalidBuildScriptError < ScriptProjectError; end
|
|
106
135
|
|
|
107
136
|
class WebAssemblyBinaryNotFoundError < ScriptProjectError
|
|
108
137
|
def initialize
|
|
@@ -98,10 +98,6 @@ module Script
|
|
|
98
98
|
|
|
99
99
|
raise Errors::BuildScriptNotFoundError,
|
|
100
100
|
"Build script not found" if build_script.nil?
|
|
101
|
-
|
|
102
|
-
unless build_script.start_with?("shopify-scripts")
|
|
103
|
-
raise Errors::InvalidBuildScriptError, "Invalid build script"
|
|
104
|
-
end
|
|
105
101
|
end
|
|
106
102
|
|
|
107
103
|
def bytecode
|
|
@@ -100,10 +100,6 @@ module Script
|
|
|
100
100
|
|
|
101
101
|
raise Errors::BuildScriptNotFoundError,
|
|
102
102
|
"Build script not found" if build_script.nil?
|
|
103
|
-
|
|
104
|
-
unless build_script.start_with?("javy")
|
|
105
|
-
raise Errors::InvalidBuildScriptError, "Invalid build script"
|
|
106
|
-
end
|
|
107
103
|
end
|
|
108
104
|
|
|
109
105
|
def bytecode
|
|
@@ -18,7 +18,7 @@ module Script
|
|
|
18
18
|
script_content: script_content,
|
|
19
19
|
compiled_type: compiled_type,
|
|
20
20
|
metadata: metadata,
|
|
21
|
-
|
|
21
|
+
script_config: script_project.script_config,
|
|
22
22
|
library: library
|
|
23
23
|
)
|
|
24
24
|
end
|
|
@@ -34,7 +34,7 @@ module Script
|
|
|
34
34
|
extension_point_type: script_project.extension_point_type,
|
|
35
35
|
script_content: script_content,
|
|
36
36
|
metadata: metadata,
|
|
37
|
-
|
|
37
|
+
script_config: script_project.script_config,
|
|
38
38
|
library: library
|
|
39
39
|
)
|
|
40
40
|
end
|
|
@@ -7,7 +7,6 @@ module Script
|
|
|
7
7
|
include SmartProperties
|
|
8
8
|
property! :ctx, accepts: ShopifyCLI::Context
|
|
9
9
|
|
|
10
|
-
SCRIPT_JSON_FILENAME = "script.json"
|
|
11
10
|
MUTABLE_ENV_VALUES = %i(uuid)
|
|
12
11
|
|
|
13
12
|
def create(script_name:, extension_point_type:, language:)
|
|
@@ -40,7 +39,7 @@ module Script
|
|
|
40
39
|
script_name: script_name,
|
|
41
40
|
extension_point_type: extension_point_type,
|
|
42
41
|
language: language,
|
|
43
|
-
|
|
42
|
+
script_config: script_config_repository.get!
|
|
44
43
|
)
|
|
45
44
|
end
|
|
46
45
|
|
|
@@ -58,7 +57,7 @@ module Script
|
|
|
58
57
|
script_name: script_name,
|
|
59
58
|
extension_point_type: extension_point_type,
|
|
60
59
|
language: language,
|
|
61
|
-
|
|
60
|
+
script_config: script_config_repository.get!,
|
|
62
61
|
)
|
|
63
62
|
end
|
|
64
63
|
|
|
@@ -77,14 +76,12 @@ module Script
|
|
|
77
76
|
script_name: script_name,
|
|
78
77
|
extension_point_type: extension_point_type,
|
|
79
78
|
language: language,
|
|
80
|
-
|
|
79
|
+
script_config: script_config_repository.get!,
|
|
81
80
|
)
|
|
82
81
|
end
|
|
83
82
|
|
|
84
|
-
def
|
|
85
|
-
|
|
86
|
-
.new(ctx: ctx)
|
|
87
|
-
.update_or_create(title: title)
|
|
83
|
+
def update_script_config(title:)
|
|
84
|
+
script_config = script_config_repository.update!(title: title)
|
|
88
85
|
|
|
89
86
|
Domain::ScriptProject.new(
|
|
90
87
|
id: ctx.root,
|
|
@@ -92,7 +89,7 @@ module Script
|
|
|
92
89
|
script_name: script_name,
|
|
93
90
|
extension_point_type: extension_point_type,
|
|
94
91
|
language: language,
|
|
95
|
-
|
|
92
|
+
script_config: script_config,
|
|
96
93
|
)
|
|
97
94
|
end
|
|
98
95
|
|
|
@@ -140,40 +137,120 @@ module Script
|
|
|
140
137
|
end
|
|
141
138
|
end
|
|
142
139
|
|
|
143
|
-
|
|
140
|
+
def script_config_repository
|
|
141
|
+
@script_config_repository ||= begin
|
|
142
|
+
supported_repos = [
|
|
143
|
+
ScriptConfigYmlRepository.new(ctx: ctx),
|
|
144
|
+
ScriptJsonRepository.new(ctx: ctx),
|
|
145
|
+
]
|
|
146
|
+
repo = supported_repos.find(&:active?)
|
|
147
|
+
raise Infrastructure::Errors::NoScriptConfigYmlFileError if repo.nil?
|
|
148
|
+
repo
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
class ScriptConfigRepository
|
|
144
153
|
include SmartProperties
|
|
145
154
|
property! :ctx, accepts: ShopifyCLI::Context
|
|
146
155
|
|
|
147
|
-
def
|
|
148
|
-
|
|
156
|
+
def active?
|
|
157
|
+
ctx.file_exist?(filename)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def get!
|
|
161
|
+
raise Infrastructure::Errors::NoScriptConfigFileError unless active?
|
|
162
|
+
|
|
163
|
+
content = ctx.read(filename)
|
|
164
|
+
hash = file_content_to_hash(content)
|
|
165
|
+
|
|
166
|
+
from_h(hash)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def update!(title:)
|
|
170
|
+
hash = get!.content
|
|
171
|
+
update_hash(hash: hash, title: title)
|
|
172
|
+
|
|
173
|
+
ctx.write(filename, hash_to_file_content(hash))
|
|
174
|
+
|
|
175
|
+
from_h(hash)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
private
|
|
179
|
+
|
|
180
|
+
def update_hash(hash:, title:)
|
|
181
|
+
hash["version"] ||= "2"
|
|
182
|
+
hash["title"] = title
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def from_h(hash)
|
|
186
|
+
Domain::ScriptConfig.new(content: hash)
|
|
187
|
+
rescue Domain::Errors::MissingScriptConfigFieldError => e
|
|
188
|
+
raise missing_field_error, e.field
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# to be implemented by subclasses
|
|
192
|
+
def filename
|
|
193
|
+
raise NotImplementedError
|
|
149
194
|
end
|
|
150
195
|
|
|
151
|
-
def
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
json["title"] = title
|
|
196
|
+
def file_content_to_hash(file_content)
|
|
197
|
+
raise NotImplementedError
|
|
198
|
+
end
|
|
155
199
|
|
|
156
|
-
|
|
200
|
+
def hash_to_file_content(hash)
|
|
201
|
+
raise NotImplementedError
|
|
202
|
+
end
|
|
157
203
|
|
|
158
|
-
|
|
204
|
+
def missing_field_error
|
|
205
|
+
raise NotImplementedError
|
|
159
206
|
end
|
|
207
|
+
end
|
|
160
208
|
|
|
209
|
+
class ScriptConfigYmlRepository < ScriptConfigRepository
|
|
161
210
|
private
|
|
162
211
|
|
|
163
|
-
def
|
|
164
|
-
|
|
212
|
+
def filename
|
|
213
|
+
"script.config.yml"
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def file_content_to_hash(file_content)
|
|
217
|
+
begin
|
|
218
|
+
hash = YAML.load(file_content)
|
|
219
|
+
rescue Psych::SyntaxError
|
|
220
|
+
raise Errors::InvalidScriptConfigYmlDefinitionError
|
|
221
|
+
end
|
|
222
|
+
raise Errors::InvalidScriptConfigYmlDefinitionError unless hash.is_a?(Hash)
|
|
223
|
+
hash
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def hash_to_file_content(hash)
|
|
227
|
+
YAML.dump(hash)
|
|
228
|
+
end
|
|
165
229
|
|
|
166
|
-
|
|
167
|
-
|
|
230
|
+
def missing_field_error
|
|
231
|
+
Errors::MissingScriptConfigYmlFieldError
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
class ScriptJsonRepository < ScriptConfigRepository
|
|
236
|
+
private
|
|
168
237
|
|
|
169
|
-
|
|
238
|
+
def filename
|
|
239
|
+
"script.json"
|
|
170
240
|
end
|
|
171
241
|
|
|
172
|
-
def
|
|
173
|
-
JSON.parse(
|
|
174
|
-
true
|
|
242
|
+
def file_content_to_hash(file_content)
|
|
243
|
+
JSON.parse(file_content)
|
|
175
244
|
rescue JSON::ParserError
|
|
176
|
-
|
|
245
|
+
raise Errors::InvalidScriptJsonDefinitionError
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def hash_to_file_content(hash)
|
|
249
|
+
JSON.pretty_generate(hash)
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
def missing_field_error
|
|
253
|
+
Errors::MissingScriptJsonFieldError
|
|
177
254
|
end
|
|
178
255
|
end
|
|
179
256
|
end
|
|
@@ -17,7 +17,7 @@ module Script
|
|
|
17
17
|
extension_point_type:,
|
|
18
18
|
force: false,
|
|
19
19
|
metadata:,
|
|
20
|
-
|
|
20
|
+
script_config:,
|
|
21
21
|
module_upload_url:,
|
|
22
22
|
library:
|
|
23
23
|
)
|
|
@@ -25,14 +25,14 @@ module Script
|
|
|
25
25
|
variables = {
|
|
26
26
|
uuid: uuid,
|
|
27
27
|
extensionPointName: extension_point_type.upcase,
|
|
28
|
-
title:
|
|
29
|
-
description:
|
|
28
|
+
title: script_config.title,
|
|
29
|
+
description: script_config.description,
|
|
30
30
|
force: force,
|
|
31
31
|
schemaMajorVersion: metadata.schema_major_version.to_s, # API expects string value
|
|
32
32
|
schemaMinorVersion: metadata.schema_minor_version.to_s, # API expects string value
|
|
33
|
-
|
|
34
|
-
configurationUi:
|
|
35
|
-
configurationDefinition:
|
|
33
|
+
scriptConfigVersion: script_config.version,
|
|
34
|
+
configurationUi: script_config.configuration_ui,
|
|
35
|
+
configurationDefinition: script_config.configuration&.to_json,
|
|
36
36
|
moduleUploadUrl: module_upload_url,
|
|
37
37
|
library: {
|
|
38
38
|
language: library[:language],
|
|
@@ -47,19 +47,19 @@ module Script
|
|
|
47
47
|
if user_errors.any? { |e| e["tag"] == "already_exists_error" }
|
|
48
48
|
raise Errors::ScriptRepushError, uuid
|
|
49
49
|
elsif (e = user_errors.any? { |err| err["tag"] == "configuration_definition_syntax_error" })
|
|
50
|
-
raise Errors::
|
|
50
|
+
raise Errors::ScriptConfigSyntaxError
|
|
51
51
|
elsif (e = user_errors.find { |err| err["tag"] == "configuration_definition_missing_keys_error" })
|
|
52
|
-
raise Errors::
|
|
52
|
+
raise Errors::ScriptConfigMissingKeysError, e["message"]
|
|
53
53
|
elsif (e = user_errors.find { |err| err["tag"] == "configuration_definition_invalid_value_error" })
|
|
54
|
-
raise Errors::
|
|
54
|
+
raise Errors::ScriptConfigInvalidValueError, e["message"]
|
|
55
55
|
elsif (e = user_errors.find do |err|
|
|
56
56
|
err["tag"] == "configuration_definition_schema_field_missing_keys_error"
|
|
57
57
|
end)
|
|
58
|
-
raise Errors::
|
|
58
|
+
raise Errors::ScriptConfigFieldsMissingKeysError, e["message"]
|
|
59
59
|
elsif (e = user_errors.find do |err|
|
|
60
60
|
err["tag"] == "configuration_definition_schema_field_invalid_value_error"
|
|
61
61
|
end)
|
|
62
|
-
raise Errors::
|
|
62
|
+
raise Errors::ScriptConfigFieldsInvalidValueError, e["message"]
|
|
63
63
|
elsif user_errors.find { |err| %w(not_use_msgpack_error schema_version_argument_error).include?(err["tag"]) }
|
|
64
64
|
raise Domain::Errors::MetadataValidationError
|
|
65
65
|
else
|
|
@@ -47,14 +47,20 @@ module Script
|
|
|
47
47
|
invalid_language_cause: "Invalid language %s.",
|
|
48
48
|
invalid_language_help: "Allowed values: %s.",
|
|
49
49
|
|
|
50
|
+
missing_script_config_yml_field_cause: "The script.config.yml file is missing the required %s field.",
|
|
51
|
+
missing_script_config_yml_field_help: "Add the field and try again.",
|
|
52
|
+
|
|
50
53
|
missing_script_json_field_cause: "The script.json file is missing the required %s field.",
|
|
51
54
|
missing_script_json_field_help: "Add the field and try again.",
|
|
52
55
|
|
|
53
56
|
invalid_script_json_definition_cause: "The script.json file contains invalid JSON.",
|
|
54
57
|
invalid_script_json_definition_help: "Fix the errors and try again.",
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
invalid_script_config_yml_definition_cause: "The script.config.yml file contains invalid YAML.",
|
|
60
|
+
invalid_script_config_yml_definition_help: "Fix the errors and try again.",
|
|
61
|
+
|
|
62
|
+
no_script_config_yml_file_cause: "The script.config.yml file is missing.",
|
|
63
|
+
no_script_config_yml_file_help: "Create this file and try again.",
|
|
58
64
|
|
|
59
65
|
configuration_syntax_error_cause: "The script.json is not formatted properly.",
|
|
60
66
|
configuration_syntax_error_help: "Fix the errors and try again.",
|
|
@@ -115,8 +121,6 @@ module Script
|
|
|
115
121
|
script_repush_cause: "A version of this script already exists on the app.",
|
|
116
122
|
script_repush_help: "Use {{cyan:--force}} to replace the existing script.",
|
|
117
123
|
|
|
118
|
-
invalid_build_script: "The root package.json contains an invalid build command that " \
|
|
119
|
-
"is needed to compile your script to WebAssembly.",
|
|
120
124
|
build_script_not_found: "The root package.json is missing the build command that " \
|
|
121
125
|
"is needed to compile your script to WebAssembly.",
|
|
122
126
|
# rubocop:disable Layout/LineLength
|
|
@@ -176,6 +180,19 @@ module Script
|
|
|
176
180
|
script_pushed: "{{v}} Script pushed to app (API key: %{api_key}).",
|
|
177
181
|
},
|
|
178
182
|
|
|
183
|
+
javy: {
|
|
184
|
+
help: <<~HELP,
|
|
185
|
+
Compile the JavaScript code into WebAssembly.
|
|
186
|
+
Usage: {{command:%s script javy}}
|
|
187
|
+
Options:
|
|
188
|
+
{{command:--in}} The name of the JavaScript file that will be compiled.
|
|
189
|
+
{{command:--out}} The name of the file that the WebAssembly should be written to.
|
|
190
|
+
HELP
|
|
191
|
+
errors: {
|
|
192
|
+
invalid_arguments: "Javy was run with invalid arguments. Run {{command: %s script javy --help}} for more information.",
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
|
|
179
196
|
project_deps: {
|
|
180
197
|
none_required: "{{v}} None required",
|
|
181
198
|
checking_with_npm: "Checking dependencies with npm",
|
|
@@ -74,7 +74,7 @@ module Script
|
|
|
74
74
|
}
|
|
75
75
|
when Layers::Infrastructure::Errors::DeprecatedEPError
|
|
76
76
|
{
|
|
77
|
-
cause_of_error: ShopifyCLI::Context.message("script.error.deprecated_ep", e.
|
|
77
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.deprecated_ep", e.extension_point),
|
|
78
78
|
help_suggestion: ShopifyCLI::Context.message("script.error.deprecated_ep_cause"),
|
|
79
79
|
}
|
|
80
80
|
when Layers::Domain::Errors::InvalidExtensionPointError
|
|
@@ -103,32 +103,47 @@ module Script
|
|
|
103
103
|
cause_of_error: ShopifyCLI::Context.message("script.error.metadata_not_found_cause"),
|
|
104
104
|
help_suggestion: ShopifyCLI::Context.message("script.error.metadata_not_found_help"),
|
|
105
105
|
}
|
|
106
|
-
when Layers::
|
|
106
|
+
when Layers::Infrastructure::Errors::BuildError
|
|
107
107
|
{
|
|
108
|
-
cause_of_error: ShopifyCLI::Context.message("script.error.
|
|
109
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.
|
|
108
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.build_error_cause"),
|
|
109
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.build_error_help"),
|
|
110
110
|
}
|
|
111
|
-
when Layers::
|
|
111
|
+
when Layers::Infrastructure::Errors::InvalidScriptConfigYmlDefinitionError
|
|
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
|
|
112
117
|
{
|
|
113
118
|
cause_of_error: ShopifyCLI::Context.message("script.error.invalid_script_json_definition_cause"),
|
|
114
119
|
help_suggestion: ShopifyCLI::Context.message("script.error.invalid_script_json_definition_help"),
|
|
115
120
|
}
|
|
116
|
-
when Layers::
|
|
121
|
+
when Layers::Infrastructure::Errors::MissingScriptConfigYmlFieldError
|
|
117
122
|
{
|
|
118
|
-
cause_of_error: ShopifyCLI::Context.message("script.error.
|
|
119
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.
|
|
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"),
|
|
120
125
|
}
|
|
121
|
-
when Layers::Infrastructure::Errors::
|
|
126
|
+
when Layers::Infrastructure::Errors::MissingScriptConfigYmlFieldError
|
|
122
127
|
{
|
|
123
|
-
cause_of_error: ShopifyCLI::Context.message("script.error.
|
|
124
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.
|
|
128
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.missing_script_config_yml_field_cause", e.field),
|
|
129
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.missing_script_config_yml_field_help"),
|
|
125
130
|
}
|
|
126
|
-
when Layers::Infrastructure::Errors::
|
|
131
|
+
when Layers::Infrastructure::Errors::MissingScriptJsonFieldError
|
|
132
|
+
{
|
|
133
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.missing_script_json_field_cause", e.field),
|
|
134
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.missing_script_json_field_help"),
|
|
135
|
+
}
|
|
136
|
+
when Layers::Infrastructure::Errors::NoScriptConfigYmlFileError
|
|
137
|
+
{
|
|
138
|
+
cause_of_error: ShopifyCLI::Context.message("script.error.no_script_config_yml_file_cause"),
|
|
139
|
+
help_suggestion: ShopifyCLI::Context.message("script.error.no_script_config_yml_file_help"),
|
|
140
|
+
}
|
|
141
|
+
when Layers::Infrastructure::Errors::ScriptConfigSyntaxError
|
|
127
142
|
{
|
|
128
143
|
cause_of_error: ShopifyCLI::Context.message("script.error.configuration_syntax_error_cause"),
|
|
129
144
|
help_suggestion: ShopifyCLI::Context.message("script.error.configuration_syntax_error_help"),
|
|
130
145
|
}
|
|
131
|
-
when Layers::Infrastructure::Errors::
|
|
146
|
+
when Layers::Infrastructure::Errors::ScriptConfigMissingKeysError
|
|
132
147
|
{
|
|
133
148
|
cause_of_error: ShopifyCLI::Context.message(
|
|
134
149
|
"script.error.configuration_missing_keys_error_cause",
|
|
@@ -136,7 +151,7 @@ module Script
|
|
|
136
151
|
),
|
|
137
152
|
help_suggestion: ShopifyCLI::Context.message("script.error.configuration_missing_keys_error_help"),
|
|
138
153
|
}
|
|
139
|
-
when Layers::Infrastructure::Errors::
|
|
154
|
+
when Layers::Infrastructure::Errors::ScriptConfigInvalidValueError
|
|
140
155
|
{
|
|
141
156
|
cause_of_error: ShopifyCLI::Context.message(
|
|
142
157
|
"script.error.configuration_invalid_value_error_cause",
|
|
@@ -144,7 +159,7 @@ module Script
|
|
|
144
159
|
),
|
|
145
160
|
help_suggestion: ShopifyCLI::Context.message("script.error.configuration_invalid_value_error_help"),
|
|
146
161
|
}
|
|
147
|
-
when Layers::Infrastructure::Errors::
|
|
162
|
+
when Layers::Infrastructure::Errors::ScriptConfigFieldsMissingKeysError
|
|
148
163
|
{
|
|
149
164
|
cause_of_error: ShopifyCLI::Context.message(
|
|
150
165
|
"script.error.configuration_schema_field_missing_keys_error_cause",
|
|
@@ -154,7 +169,7 @@ module Script
|
|
|
154
169
|
"script.error.configuration_definition_schema_field_missing_keys_error_help"
|
|
155
170
|
),
|
|
156
171
|
}
|
|
157
|
-
when Layers::Infrastructure::Errors::
|
|
172
|
+
when Layers::Infrastructure::Errors::ScriptConfigFieldsInvalidValueError
|
|
158
173
|
{
|
|
159
174
|
cause_of_error: ShopifyCLI::Context.message(
|
|
160
175
|
"script.error.configuration_schema_field_invalid_value_error_cause",
|
|
@@ -201,11 +216,6 @@ module Script
|
|
|
201
216
|
cause_of_error: ShopifyCLI::Context.message("script.error.build_script_not_found"),
|
|
202
217
|
help_suggestion: ShopifyCLI::Context.message("script.error.build_script_suggestion"),
|
|
203
218
|
}
|
|
204
|
-
when Layers::Infrastructure::Errors::InvalidBuildScriptError
|
|
205
|
-
{
|
|
206
|
-
cause_of_error: ShopifyCLI::Context.message("script.error.invalid_build_script"),
|
|
207
|
-
help_suggestion: ShopifyCLI::Context.message("script.error.build_script_suggestion"),
|
|
208
|
-
}
|
|
209
219
|
when Layers::Infrastructure::Errors::WebAssemblyBinaryNotFoundError
|
|
210
220
|
{
|
|
211
221
|
cause_of_error: ShopifyCLI::Context.message("script.error.web_assembly_binary_not_found"),
|
|
@@ -5,7 +5,7 @@ module Theme
|
|
|
5
5
|
register_messages(Theme::Messages::MESSAGES)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
class Command < ShopifyCLI::
|
|
8
|
+
class Command < ShopifyCLI::Command::ProjectCommand
|
|
9
9
|
subcommand :Init, "init", Project.project_filepath("commands/init")
|
|
10
10
|
subcommand :Serve, "serve", Project.project_filepath("commands/serve")
|
|
11
11
|
subcommand :Pull, "pull", Project.project_filepath("commands/pull")
|
|
@@ -4,7 +4,7 @@ require "shopify_cli/theme/development_theme"
|
|
|
4
4
|
|
|
5
5
|
module Theme
|
|
6
6
|
class Command
|
|
7
|
-
class Delete < ShopifyCLI::SubCommand
|
|
7
|
+
class Delete < ShopifyCLI::Command::SubCommand
|
|
8
8
|
options do |parser, flags|
|
|
9
9
|
parser.on("-d", "--development") { flags[:development] = true }
|
|
10
10
|
parser.on("-a", "--show-all") { flags[:show_all] = true }
|
|
@@ -5,10 +5,11 @@ require "shopify_cli/theme/syncer"
|
|
|
5
5
|
|
|
6
6
|
module Theme
|
|
7
7
|
class Command
|
|
8
|
-
class Pull < ShopifyCLI::SubCommand
|
|
8
|
+
class Pull < ShopifyCLI::Command::SubCommand
|
|
9
9
|
options do |parser, flags|
|
|
10
10
|
parser.on("-n", "--nodelete") { flags[:nodelete] = true }
|
|
11
11
|
parser.on("-i", "--themeid=ID") { |theme_id| flags[:theme_id] = theme_id }
|
|
12
|
+
parser.on("-l", "--live") { flags[:live] = true }
|
|
12
13
|
parser.on("-x", "--ignore=PATTERN") do |pattern|
|
|
13
14
|
flags[:ignores] ||= []
|
|
14
15
|
flags[:ignores] << pattern
|
|
@@ -21,6 +22,8 @@ module Theme
|
|
|
21
22
|
|
|
22
23
|
theme = if (theme_id = options.flags[:theme_id])
|
|
23
24
|
ShopifyCLI::Theme::Theme.new(@ctx, root: root, id: theme_id)
|
|
25
|
+
elsif options.flags[:live]
|
|
26
|
+
ShopifyCLI::Theme::Theme.live(@ctx, root: root)
|
|
24
27
|
else
|
|
25
28
|
form = Forms::Select.ask(
|
|
26
29
|
@ctx,
|
|
@@ -6,10 +6,11 @@ require "shopify_cli/theme/syncer"
|
|
|
6
6
|
|
|
7
7
|
module Theme
|
|
8
8
|
class Command
|
|
9
|
-
class Push < ShopifyCLI::SubCommand
|
|
9
|
+
class Push < ShopifyCLI::Command::SubCommand
|
|
10
10
|
options do |parser, flags|
|
|
11
11
|
parser.on("-n", "--nodelete") { flags[:nodelete] = true }
|
|
12
12
|
parser.on("-i", "--themeid=ID") { |theme_id| flags[:theme_id] = theme_id }
|
|
13
|
+
parser.on("-l", "--live") { flags[:live] = true }
|
|
13
14
|
parser.on("-d", "--development") { flags[:development] = true }
|
|
14
15
|
parser.on("-u", "--unpublished") { flags[:unpublished] = true }
|
|
15
16
|
parser.on("-j", "--json") { flags[:json] = true }
|
|
@@ -27,6 +28,8 @@ module Theme
|
|
|
27
28
|
|
|
28
29
|
theme = if (theme_id = options.flags[:theme_id])
|
|
29
30
|
ShopifyCLI::Theme::Theme.new(@ctx, root: root, id: theme_id)
|
|
31
|
+
elsif options.flags[:live]
|
|
32
|
+
ShopifyCLI::Theme::Theme.live(@ctx, root: root)
|
|
30
33
|
elsif options.flags[:development]
|
|
31
34
|
theme = ShopifyCLI::Theme::DevelopmentTheme.new(@ctx, root: root)
|
|
32
35
|
theme.ensure_exists!
|
|
@@ -72,6 +75,7 @@ module Theme
|
|
|
72
75
|
@ctx.done(@ctx.message("theme.push.done", theme.preview_url, theme.editor_url))
|
|
73
76
|
end
|
|
74
77
|
end
|
|
78
|
+
raise ShopifyCLI::AbortSilent if syncer.has_any_error?
|
|
75
79
|
rescue ShopifyCLI::API::APIRequestNotFoundError
|
|
76
80
|
@ctx.abort(@ctx.message("theme.push.theme_not_found", theme.id))
|
|
77
81
|
ensure
|