shopify-cli 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/project_types/extension/cli.rb +2 -0
- data/lib/project_types/extension/features/argo.rb +17 -39
- data/lib/project_types/extension/features/argo_renderer_package.rb +17 -2
- data/lib/project_types/extension/features/argo_setup.rb +1 -1
- data/lib/project_types/extension/messages/messages.rb +1 -4
- data/lib/project_types/extension/models/specification.rb +2 -2
- data/lib/project_types/extension/models/version.rb +1 -1
- data/lib/project_types/node/messages/messages.rb +4 -4
- data/lib/project_types/rails/messages/messages.rb +4 -4
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +5 -2
- data/lib/project_types/script/layers/application/push_script.rb +4 -2
- data/lib/project_types/script/layers/domain/push_package.rb +4 -0
- data/lib/project_types/script/layers/domain/script_project.rb +5 -1
- data/lib/project_types/script/layers/infrastructure/errors.rb +18 -0
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +2 -0
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +39 -5
- data/lib/project_types/script/layers/infrastructure/script_service.rb +7 -1
- data/lib/project_types/script/messages/messages.rb +8 -0
- data/lib/project_types/script/ui/error_handler.rb +18 -0
- data/lib/shopify-cli/js_system.rb +2 -2
- data/lib/shopify-cli/messages/messages.rb +3 -2
- data/lib/shopify-cli/oauth.rb +2 -2
- data/lib/shopify-cli/packager.rb +1 -1
- data/lib/shopify-cli/resolve_constant.rb +1 -1
- data/lib/shopify-cli/resources/env_file.rb +1 -1
- data/lib/shopify-cli/transform_data_structure.rb +1 -1
- data/lib/shopify-cli/version.rb +1 -1
- data/vendor/deps/smart_properties/REVISION +1 -1
- data/vendor/deps/smart_properties/lib/smart_properties/property.rb +7 -1
- data/vendor/deps/smart_properties/lib/smart_properties/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 180a4674bfed27bb04ad09499b5c128980a93288666d3ab6aa58aa6d404d61c6
|
4
|
+
data.tar.gz: 8906cecf6a5a76db71e37ef5c1f756d417a3785c63618d4e70d808e3dcad5773
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 443523c8b3e6ec1bcf3b7aef21f0e45148f6c5d1c3ebbc90b7206600bfb2ba484e87e63db423bd1e9abf21e03cda550680283d37534a5879dbcfcb93ed3a80e7
|
7
|
+
data.tar.gz: 8b0c0c59a792fdc06cb2a990bc745ba1bcc64f44ed2c7caa31ef7a1daa11ccec868eb6539b3c195302b046dd1bd7fe80501a4fac2043462dc68224e0a1506b2d
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
Unreleased
|
2
2
|
------
|
3
3
|
|
4
|
+
Version 1.9.1
|
5
|
+
-------------
|
6
|
+
* [1201](https://github.com/Shopify/shopify-app-cli/pull/1201) Determine Argo Renderer Dynamically. This fixes `shopify serve` and `shopify push` for extensions.
|
7
|
+
|
4
8
|
Version 1.9.0
|
5
9
|
-------------
|
6
10
|
* [1181](https://github.com/Shopify/shopify-app-cli/pull/1181): Remove the subcommand references of the `generate` command for node apps (fixes [1176](https://github.com/Shopify/shopify-app-cli/issues/1176))
|
@@ -14,8 +14,8 @@ module Extension
|
|
14
14
|
SCRIPT_PATH = %w(build main.js).freeze
|
15
15
|
|
16
16
|
NPM_LIST_COMMAND = %w(list).freeze
|
17
|
-
YARN_LIST_COMMAND = %w(list
|
18
|
-
NPM_LIST_PARAMETERS = %w(--prod).freeze
|
17
|
+
YARN_LIST_COMMAND = %w(list).freeze
|
18
|
+
NPM_LIST_PARAMETERS = %w(--prod --depth=1).freeze
|
19
19
|
YARN_LIST_PARAMETERS = %w(--production).freeze
|
20
20
|
private_constant :NPM_LIST_COMMAND, :YARN_LIST_COMMAND, :NPM_LIST_PARAMETERS, :YARN_LIST_PARAMETERS
|
21
21
|
|
@@ -39,7 +39,7 @@ module Extension
|
|
39
39
|
context.abort(context.message("features.argo.missing_file_error")) unless File.exist?(filepath)
|
40
40
|
begin
|
41
41
|
{
|
42
|
-
renderer_version:
|
42
|
+
renderer_version: renderer_package(context).version,
|
43
43
|
serialized_script: Base64.strict_encode64(File.read(filepath).chomp),
|
44
44
|
}
|
45
45
|
rescue StandardError
|
@@ -48,50 +48,28 @@ module Extension
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def renderer_package(context)
|
51
|
-
Features::ArgoRendererPackage.
|
52
|
-
|
53
|
-
)
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
def extract_argo_renderer_version(context)
|
59
|
-
result = run_list_command(context)
|
60
|
-
found_version = find_version_number(context, result)
|
61
|
-
context.abort(
|
62
|
-
context.message("features.argo.dependencies.argo_renderer_package_invalid_version_error")
|
63
|
-
) if found_version.nil?
|
64
|
-
::Semantic::Version.new(found_version).to_s
|
65
|
-
rescue ArgumentError
|
51
|
+
Features::ArgoRendererPackage.from_package_manager(run_list_command(context))
|
52
|
+
rescue Extension::PackageNotFound
|
66
53
|
context.abort(
|
67
|
-
context.message("features.argo.dependencies.
|
54
|
+
context.message("features.argo.dependencies.argo_missing_renderer_package_error")
|
68
55
|
)
|
69
56
|
end
|
70
57
|
|
71
|
-
|
72
|
-
packages = result.to_json.split('\n')
|
73
|
-
found_package = packages.find do |package|
|
74
|
-
package.match(/#{renderer_package_name}@/)
|
75
|
-
end
|
76
|
-
if found_package.nil?
|
77
|
-
error = "'#{renderer_package_name}' not found."
|
78
|
-
context.abort(
|
79
|
-
context.message("features.argo.dependencies.argo_missing_renderer_package_error", error)
|
80
|
-
)
|
81
|
-
end
|
82
|
-
found_package.split("@")[2]&.strip
|
83
|
-
end
|
58
|
+
private
|
84
59
|
|
85
60
|
def run_list_command(context)
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
61
|
+
yarn_list = YARN_LIST_COMMAND + YARN_LIST_PARAMETERS
|
62
|
+
npm_list = NPM_LIST_COMMAND + NPM_LIST_PARAMETERS
|
63
|
+
|
64
|
+
result, error, status = ShopifyCli::JsSystem.call(
|
65
|
+
context,
|
66
|
+
yarn: yarn_list,
|
67
|
+
npm: npm_list,
|
90
68
|
capture_response: true
|
91
69
|
)
|
92
|
-
context.abort(
|
93
|
-
|
94
|
-
) unless status.success?
|
70
|
+
# context.abort(
|
71
|
+
# context.message("features.argo.dependencies.argo_missing_renderer_package_error", error)
|
72
|
+
# ) unless status.success?
|
95
73
|
result
|
96
74
|
end
|
97
75
|
|
@@ -5,16 +5,27 @@ module Extension
|
|
5
5
|
|
6
6
|
ARGO_CHECKOUT = "@shopify/argo-checkout"
|
7
7
|
ARGO_ADMIN = "@shopify/argo-admin"
|
8
|
+
ARGO_POST_PURCHASE = "@shopify/argo-post-purchase"
|
8
9
|
|
9
10
|
PACKAGE_NAMES = [
|
10
11
|
ARGO_CHECKOUT,
|
11
12
|
ARGO_ADMIN,
|
13
|
+
ARGO_POST_PURCHASE
|
12
14
|
].freeze
|
13
15
|
MINIMUM_ARGO_VERSION = "0.9.3".freeze
|
14
16
|
|
15
17
|
property! :package_name, accepts: PACKAGE_NAMES
|
16
18
|
property! :version, accepts: String
|
17
19
|
|
20
|
+
class << self
|
21
|
+
def from_package_manager(package_manager_output)
|
22
|
+
pattern = /(?<name>#{PACKAGE_NAMES.join("|")})@(?<version>\d.*)$/
|
23
|
+
match = package_manager_output.match(pattern)
|
24
|
+
raise PackageNotFound, package_manager_output if match.nil?
|
25
|
+
return new(package_name: match[:name], version: match[:version].strip)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
18
29
|
def checkout?
|
19
30
|
package_name == ARGO_CHECKOUT
|
20
31
|
end
|
@@ -23,9 +34,13 @@ module Extension
|
|
23
34
|
package_name == ARGO_ADMIN
|
24
35
|
end
|
25
36
|
|
37
|
+
##
|
38
|
+
# Temporarily returns false in all cases as the argo webpack server is
|
39
|
+
# unable to handle the UUID flag.
|
26
40
|
def supports_uuid_flag?
|
27
|
-
return false
|
28
|
-
|
41
|
+
return false
|
42
|
+
# return false if checkout?
|
43
|
+
# Gem::Version.new(version) > Gem::Version.new(MINIMUM_ARGO_VERSION)
|
29
44
|
end
|
30
45
|
end
|
31
46
|
end
|
@@ -98,10 +98,7 @@ module Extension
|
|
98
98
|
node_not_installed: "Node must be installed to create this extension.",
|
99
99
|
version_too_low: "Your node version %s does not meet the minimum required version %s",
|
100
100
|
},
|
101
|
-
argo_missing_renderer_package_error: "
|
102
|
-
argo_renderer_package_invalid_version_error: <<~MESSAGE,
|
103
|
-
The renderer package version is not a valid SemVer Version (http://semver.org)
|
104
|
-
MESSAGE
|
101
|
+
argo_missing_renderer_package_error: "Extension template references invalid renderer package please contact Shopify for help.",
|
105
102
|
yarn_install_error: "Something went wrong while running 'yarn install'. %s.",
|
106
103
|
yarn_run_script_error: "Something went wrong while running script. %s.",
|
107
104
|
},
|
@@ -10,8 +10,8 @@ module Extension
|
|
10
10
|
property! :surface, converts: :to_str
|
11
11
|
property! :renderer_package_name, converts: :to_str
|
12
12
|
property! :git_template, converts: :to_str
|
13
|
-
property! :required_fields, accepts: Array, default: []
|
14
|
-
property! :required_shop_beta_flags, accepts: Array, default: []
|
13
|
+
property! :required_fields, accepts: Array, default: -> { [] }
|
14
|
+
property! :required_shop_beta_flags, accepts: Array, default: -> { [] }
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.build(feature_set_attributes)
|
@@ -9,7 +9,7 @@ module Extension
|
|
9
9
|
property! :last_user_interaction_at, accepts: Time
|
10
10
|
property :context, accepts: String
|
11
11
|
property :location, accepts: String
|
12
|
-
property :validation_errors, accepts: Models::ValidationError::IS_VALIDATION_ERROR_LIST, default: []
|
12
|
+
property :validation_errors, accepts: Models::ValidationError::IS_VALIDATION_ERROR_LIST, default: -> { [] }
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -59,21 +59,21 @@ module Node
|
|
59
59
|
installed: "Installed Heroku CLI",
|
60
60
|
authenticating: "Authenticating with Heroku…",
|
61
61
|
authenticated: "{{v}} Authenticated with Heroku",
|
62
|
-
authenticated_with_account: "{{v}} Authenticated with Heroku as
|
62
|
+
authenticated_with_account: "{{v}} Authenticated with Heroku as {{green:%s}}",
|
63
63
|
deploying: "Deploying to Heroku…",
|
64
64
|
deployed: "{{v}} Deployed to Heroku",
|
65
65
|
git: {
|
66
66
|
checking: "Checking git repo…",
|
67
67
|
initialized: "Git repo initialized",
|
68
68
|
what_branch: "What branch would you like to deploy?",
|
69
|
-
branch_selected: "{{v}} Git branch
|
69
|
+
branch_selected: "{{v}} Git branch {{green:%s}} selected for deploy",
|
70
70
|
},
|
71
71
|
app: {
|
72
72
|
no_apps_found: "No existing Heroku app found. What would you like to do?",
|
73
73
|
name: "What is your Heroku app’s name?",
|
74
74
|
select: "Specify an existing Heroku app",
|
75
|
-
selecting: "Selecting Heroku app
|
76
|
-
selected: "{{v}} Heroku app
|
75
|
+
selecting: "Selecting Heroku app %s…",
|
76
|
+
selected: "{{v}} Heroku app {{green:%s}} selected",
|
77
77
|
create: "Create a new Heroku app",
|
78
78
|
creating: "Creating new Heroku app…",
|
79
79
|
created: "{{v}} New Heroku app created",
|
@@ -89,7 +89,7 @@ module Rails
|
|
89
89
|
downloaded: "Downloaded Heroku CLI",
|
90
90
|
installing: "Installing Heroku CLI...",
|
91
91
|
installed: "Installed Heroku CLI",
|
92
|
-
authenticated_with_account: "{{v}} Authenticated with Heroku as
|
92
|
+
authenticated_with_account: "{{v}} Authenticated with Heroku as {{green:%s}}",
|
93
93
|
authenticating: "Authenticating with Heroku...",
|
94
94
|
authenticated: "{{v}} Authenticated with Heroku",
|
95
95
|
deploying: "Deploying to Heroku...",
|
@@ -109,14 +109,14 @@ module Rails
|
|
109
109
|
checking: "Checking git repo...",
|
110
110
|
initialized: "Git repo initialized",
|
111
111
|
what_branch: "What branch would you like to deploy?",
|
112
|
-
branch_selected: "{{v}} Git branch
|
112
|
+
branch_selected: "{{v}} Git branch {{green:%s}} selected for deploy",
|
113
113
|
},
|
114
114
|
app: {
|
115
115
|
no_apps_found: "No existing Heroku app found. What would you like to do?",
|
116
116
|
name: "What is your Heroku app’s name?",
|
117
117
|
select: "Specify an existing Heroku app",
|
118
|
-
selecting: "Selecting Heroku app
|
119
|
-
selected: "{{v}} Heroku app
|
118
|
+
selecting: "Selecting Heroku app %s...",
|
119
|
+
selected: "{{v}} Heroku app {{green:%s}} selected",
|
120
120
|
create: "Create a new Heroku app",
|
121
121
|
creating: "Creating new Heroku app...",
|
122
122
|
created: "{{v}} New Heroku app created",
|
@@ -7,7 +7,8 @@ mutation AppScriptUpdateOrCreate(
|
|
7
7
|
$force: Boolean,
|
8
8
|
$schemaMajorVersion: String,
|
9
9
|
$schemaMinorVersion: String,
|
10
|
-
$useMsgpack: Boolean
|
10
|
+
$useMsgpack: Boolean,
|
11
|
+
$uuid: String
|
11
12
|
) {
|
12
13
|
appScriptUpdateOrCreate(
|
13
14
|
extensionPointName: $extensionPointName
|
@@ -18,7 +19,8 @@ mutation AppScriptUpdateOrCreate(
|
|
18
19
|
force: $force
|
19
20
|
schemaMajorVersion: $schemaMajorVersion
|
20
21
|
schemaMinorVersion: $schemaMinorVersion
|
21
|
-
useMsgpack: $useMsgpack
|
22
|
+
useMsgpack: $useMsgpack,
|
23
|
+
uuid: $uuid
|
22
24
|
) {
|
23
25
|
userErrors {
|
24
26
|
field
|
@@ -26,6 +28,7 @@ mutation AppScriptUpdateOrCreate(
|
|
26
28
|
tag
|
27
29
|
}
|
28
30
|
appScript {
|
31
|
+
uuid
|
29
32
|
appKey
|
30
33
|
configSchema
|
31
34
|
extensionPointName
|
@@ -6,7 +6,8 @@ module Script
|
|
6
6
|
class PushScript
|
7
7
|
class << self
|
8
8
|
def call(ctx:, force:)
|
9
|
-
|
9
|
+
script_project_repo = Infrastructure::ScriptProjectRepository.new(ctx: ctx)
|
10
|
+
script_project = script_project_repo.get
|
10
11
|
task_runner = Infrastructure::TaskRunner.for(ctx, script_project.language, script_project.script_name)
|
11
12
|
|
12
13
|
ProjectDependencies.install(ctx: ctx, task_runner: task_runner)
|
@@ -18,7 +19,8 @@ module Script
|
|
18
19
|
compiled_type: task_runner.compiled_type,
|
19
20
|
metadata: task_runner.metadata,
|
20
21
|
)
|
21
|
-
package.push(Infrastructure::ScriptService.new(ctx: p_ctx), script_project.api_key, force)
|
22
|
+
uuid = package.push(Infrastructure::ScriptService.new(ctx: p_ctx), script_project.api_key, force)
|
23
|
+
script_project_repo.update_env(uuid: uuid)
|
22
24
|
spinner.update_title(p_ctx.message("script.application.pushed"))
|
23
25
|
end
|
24
26
|
end
|
@@ -5,6 +5,7 @@ module Script
|
|
5
5
|
module Domain
|
6
6
|
class PushPackage
|
7
7
|
attr_reader :id,
|
8
|
+
:uuid,
|
8
9
|
:extension_point_type,
|
9
10
|
:script_name,
|
10
11
|
:config_ui,
|
@@ -14,6 +15,7 @@ module Script
|
|
14
15
|
|
15
16
|
def initialize(
|
16
17
|
id:,
|
18
|
+
uuid:,
|
17
19
|
extension_point_type:,
|
18
20
|
script_name:,
|
19
21
|
script_content:,
|
@@ -22,6 +24,7 @@ module Script
|
|
22
24
|
config_ui:
|
23
25
|
)
|
24
26
|
@id = id
|
27
|
+
@uuid = uuid
|
25
28
|
@extension_point_type = extension_point_type
|
26
29
|
@script_name = script_name
|
27
30
|
@script_content = script_content
|
@@ -32,6 +35,7 @@ module Script
|
|
32
35
|
|
33
36
|
def push(script_service, api_key, force)
|
34
37
|
script_service.push(
|
38
|
+
uuid: @uuid,
|
35
39
|
extension_point_type: @extension_point_type,
|
36
40
|
script_name: @script_name,
|
37
41
|
script_content: @script_content,
|
@@ -17,6 +17,15 @@ module Script
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
class ConfigUiInvalidInputModeError < ScriptProjectError
|
21
|
+
attr_reader :filename, :valid_input_modes
|
22
|
+
def initialize(filename, valid_input_modes)
|
23
|
+
super()
|
24
|
+
@filename = filename
|
25
|
+
@valid_input_modes = valid_input_modes
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
20
29
|
class ConfigUiFieldsMissingKeysError < ScriptProjectError
|
21
30
|
attr_reader :filename, :missing_keys
|
22
31
|
def initialize(filename, missing_keys)
|
@@ -26,6 +35,15 @@ module Script
|
|
26
35
|
end
|
27
36
|
end
|
28
37
|
|
38
|
+
class ConfigUiFieldsInvalidTypeError < ScriptProjectError
|
39
|
+
attr_reader :filename, :valid_types
|
40
|
+
def initialize(filename, valid_types)
|
41
|
+
super()
|
42
|
+
@filename = filename
|
43
|
+
@valid_types = valid_types
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
29
47
|
class DependencyInstallError < ScriptProjectError; end
|
30
48
|
class DeprecatedEPError < ScriptProjectError; end
|
31
49
|
class EmptyResponseError < ScriptProjectError; end
|
@@ -13,6 +13,7 @@ module Script
|
|
13
13
|
|
14
14
|
Domain::PushPackage.new(
|
15
15
|
id: build_file_path,
|
16
|
+
uuid: script_project.uuid,
|
16
17
|
extension_point_type: script_project.extension_point_type,
|
17
18
|
script_name: script_project.script_name,
|
18
19
|
script_content: script_content,
|
@@ -30,6 +31,7 @@ module Script
|
|
30
31
|
|
31
32
|
Domain::PushPackage.new(
|
32
33
|
id: build_file_path,
|
34
|
+
uuid: script_project.uuid,
|
33
35
|
extension_point_type: script_project.extension_point_type,
|
34
36
|
script_name: script_project.script_name,
|
35
37
|
script_content: script_content,
|
@@ -8,6 +8,7 @@ module Script
|
|
8
8
|
property! :ctx, accepts: ShopifyCli::Context
|
9
9
|
|
10
10
|
DEFAULT_CONFIG_UI_FILENAME = "config-ui.yml"
|
11
|
+
MUTABLE_ENV_VALUES = %i(uuid)
|
11
12
|
|
12
13
|
def create(script_name:, extension_point_type:, language:, no_config_ui:)
|
13
14
|
validate_metadata!(extension_point_type, language)
|
@@ -43,11 +44,6 @@ module Script
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def get
|
46
|
-
extension_point_type = project_config_value!("extension_point_type")
|
47
|
-
script_name = project_config_value!("script_name")
|
48
|
-
config_ui_file = project_config_value("config_ui_file")
|
49
|
-
language = project_config_value("language")&.downcase || default_language
|
50
|
-
|
51
47
|
validate_metadata!(extension_point_type, language)
|
52
48
|
|
53
49
|
config_ui = ConfigUiRepository.new(ctx: ctx).get(config_ui_file)
|
@@ -62,8 +58,46 @@ module Script
|
|
62
58
|
)
|
63
59
|
end
|
64
60
|
|
61
|
+
def update_env(**args)
|
62
|
+
capture_io do
|
63
|
+
args.slice(*MUTABLE_ENV_VALUES).each do |key, value|
|
64
|
+
project.env.extra[key.to_s.upcase] = value
|
65
|
+
project.env.update(ctx, :extra, project.env.extra)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
Domain::ScriptProject.new(
|
70
|
+
id: ctx.root,
|
71
|
+
env: project.env,
|
72
|
+
script_name: script_name,
|
73
|
+
extension_point_type: extension_point_type,
|
74
|
+
language: language,
|
75
|
+
config_ui: ConfigUiRepository.new(ctx: ctx).get(config_ui_file),
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
65
79
|
private
|
66
80
|
|
81
|
+
def capture_io(&block)
|
82
|
+
CLI::UI::StdoutRouter::Capture.new(&block).run
|
83
|
+
end
|
84
|
+
|
85
|
+
def extension_point_type
|
86
|
+
project_config_value!("extension_point_type")
|
87
|
+
end
|
88
|
+
|
89
|
+
def script_name
|
90
|
+
project_config_value!("script_name")
|
91
|
+
end
|
92
|
+
|
93
|
+
def config_ui_file
|
94
|
+
project_config_value("config_ui_file")
|
95
|
+
end
|
96
|
+
|
97
|
+
def language
|
98
|
+
project_config_value("language")&.downcase || default_language
|
99
|
+
end
|
100
|
+
|
67
101
|
def project_config_value(key)
|
68
102
|
return nil unless project.config.key?(key)
|
69
103
|
project.config[key]
|
@@ -11,6 +11,7 @@ module Script
|
|
11
11
|
property! :ctx, accepts: ShopifyCli::Context
|
12
12
|
|
13
13
|
def push(
|
14
|
+
uuid:,
|
14
15
|
extension_point_type:,
|
15
16
|
script_name:,
|
16
17
|
script_content:,
|
@@ -22,6 +23,7 @@ module Script
|
|
22
23
|
)
|
23
24
|
query_name = "app_script_update_or_create"
|
24
25
|
variables = {
|
26
|
+
uuid: uuid,
|
25
27
|
extensionPointName: extension_point_type.upcase,
|
26
28
|
title: script_name,
|
27
29
|
configUi: config_ui&.content,
|
@@ -35,7 +37,7 @@ module Script
|
|
35
37
|
resp_hash = script_service_request(query_name: query_name, api_key: api_key, variables: variables)
|
36
38
|
user_errors = resp_hash["data"]["appScriptUpdateOrCreate"]["userErrors"]
|
37
39
|
|
38
|
-
return resp_hash if user_errors.empty?
|
40
|
+
return resp_hash["data"]["appScriptUpdateOrCreate"]["appScript"]["uuid"] if user_errors.empty?
|
39
41
|
|
40
42
|
if user_errors.any? { |e| e["tag"] == "already_exists_error" }
|
41
43
|
raise Errors::ScriptRepushError, api_key
|
@@ -43,8 +45,12 @@ module Script
|
|
43
45
|
raise Errors::ConfigUiSyntaxError, config_ui&.filename
|
44
46
|
elsif (e = user_errors.find { |err| err["tag"] == "config_ui_missing_keys_error" })
|
45
47
|
raise Errors::ConfigUiMissingKeysError.new(config_ui&.filename, e["message"])
|
48
|
+
elsif (e = user_errors.find { |err| err["tag"] == "config_ui_invalid_input_mode_error" })
|
49
|
+
raise Errors::ConfigUiInvalidInputModeError.new(config_ui&.filename, e["message"])
|
46
50
|
elsif (e = user_errors.find { |err| err["tag"] == "config_ui_fields_missing_keys_error" })
|
47
51
|
raise Errors::ConfigUiFieldsMissingKeysError.new(config_ui&.filename, e["message"])
|
52
|
+
elsif (e = user_errors.find { |err| err["tag"] == "config_ui_fields_invalid_type_error" })
|
53
|
+
raise Errors::ConfigUiFieldsInvalidTypeError.new(config_ui&.filename, e["message"])
|
48
54
|
elsif user_errors.find { |err| %w(not_use_msgpack_error schema_version_argument_error).include?(err["tag"]) }
|
49
55
|
raise Domain::Errors::MetadataValidationError
|
50
56
|
else
|
@@ -64,10 +64,18 @@ module Script
|
|
64
64
|
"%{missing_keys}.",
|
65
65
|
config_ui_missing_keys_error_help: "Add the keys and try again.",
|
66
66
|
|
67
|
+
config_ui_invalid_input_mode_error_cause: "The UI configuration file %{filename} only accept "\
|
68
|
+
"one of the following input mode(s): %{valid_input_modes}.",
|
69
|
+
config_ui_invalid_input_mode_error_help: "Change the input modes and try again.",
|
70
|
+
|
67
71
|
config_ui_fields_missing_keys_error_cause: "A field entry in the UI configuration file %{filename} is "\
|
68
72
|
"missing required keys: %{missing_keys}.",
|
69
73
|
config_ui_fields_missing_keys_error_help: "Add the keys and try again.",
|
70
74
|
|
75
|
+
config_ui_fields_invalid_type_error_cause: "The UI configuration file %{filename} fields only accept "\
|
76
|
+
"one of the following type(s): %{valid_types}.",
|
77
|
+
config_ui_fields_invalid_type_error_help: "Change the types and try again.",
|
78
|
+
|
71
79
|
script_not_found_cause: "Couldn't find script %s for extension point %s",
|
72
80
|
|
73
81
|
service_failure_cause: "Internal service error.",
|
@@ -163,6 +163,15 @@ module Script
|
|
163
163
|
),
|
164
164
|
help_suggestion: ShopifyCli::Context.message("script.error.config_ui_missing_keys_error_help"),
|
165
165
|
}
|
166
|
+
when Layers::Infrastructure::Errors::ConfigUiInvalidInputModeError
|
167
|
+
{
|
168
|
+
cause_of_error: ShopifyCli::Context.message(
|
169
|
+
"script.error.config_ui_invalid_input_mode_error_cause",
|
170
|
+
filename: e.filename,
|
171
|
+
valid_input_modes: e.valid_input_modes
|
172
|
+
),
|
173
|
+
help_suggestion: ShopifyCli::Context.message("script.error.config_ui_invalid_input_mode_error_help"),
|
174
|
+
}
|
166
175
|
when Layers::Infrastructure::Errors::ConfigUiFieldsMissingKeysError
|
167
176
|
{
|
168
177
|
cause_of_error: ShopifyCli::Context.message(
|
@@ -172,6 +181,15 @@ module Script
|
|
172
181
|
),
|
173
182
|
help_suggestion: ShopifyCli::Context.message("script.error.config_ui_fields_missing_keys_error_help"),
|
174
183
|
}
|
184
|
+
when Layers::Infrastructure::Errors::ConfigUiFieldsInvalidTypeError
|
185
|
+
{
|
186
|
+
cause_of_error: ShopifyCli::Context.message(
|
187
|
+
"script.error.config_ui_fields_invalid_type_error_cause",
|
188
|
+
filename: e.filename,
|
189
|
+
valid_types: e.valid_types
|
190
|
+
),
|
191
|
+
help_suggestion: ShopifyCli::Context.message("script.error.config_ui_fields_invalid_type_error_help"),
|
192
|
+
}
|
175
193
|
when Layers::Infrastructure::Errors::DependencyInstallError
|
176
194
|
{
|
177
195
|
cause_of_error: ShopifyCli::Context.message("script.error.dependency_install_cause"),
|
@@ -37,8 +37,8 @@ module ShopifyCli
|
|
37
37
|
#
|
38
38
|
# ShopifyCli::JsSystem.call(ctx, yarn: ['install', '--silent'], npm: ['install', '--no-audit'])
|
39
39
|
#
|
40
|
-
def call(ctx, yarn:, npm:)
|
41
|
-
JsSystem.new(ctx: ctx).call(yarn: yarn, npm: npm)
|
40
|
+
def call(ctx, yarn:, npm:, capture_response: false)
|
41
|
+
JsSystem.new(ctx: ctx).call(yarn: yarn, npm: npm, capture_response: capture_response)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -82,7 +82,8 @@ module ShopifyCli
|
|
82
82
|
error: {
|
83
83
|
directory_exists: "Project directory already exists. Please create a project with a new name.",
|
84
84
|
no_branches_found: "Could not find any git branches",
|
85
|
-
repo_not_initiated:
|
85
|
+
repo_not_initiated:
|
86
|
+
"Git repo is not initiated. Please run {{command:git init}} and make at least one commit.",
|
86
87
|
no_commits_made: "No git commits have been made. Please make at least one commit.",
|
87
88
|
},
|
88
89
|
|
@@ -110,7 +111,7 @@ module ShopifyCli
|
|
110
111
|
deploy: "Could not deploy to Heroku",
|
111
112
|
download: "Heroku CLI could not be downloaded",
|
112
113
|
install: "Could not install Heroku CLI",
|
113
|
-
could_not_select_app: "Heroku app
|
114
|
+
could_not_select_app: "Heroku app {{green:%s}} could not be selected",
|
114
115
|
},
|
115
116
|
},
|
116
117
|
|
data/lib/shopify-cli/oauth.rb
CHANGED
@@ -24,10 +24,10 @@ module ShopifyCli
|
|
24
24
|
property! :service, accepts: String
|
25
25
|
property! :client_id, accepts: String
|
26
26
|
property! :scopes
|
27
|
-
property :store, default: ShopifyCli::DB.new
|
27
|
+
property :store, default: -> { ShopifyCli::DB.new }
|
28
28
|
property :secret, accepts: String
|
29
29
|
property :request_exchange, accepts: String
|
30
|
-
property :options, default: {}, accepts: Hash
|
30
|
+
property :options, default: -> { {} }, accepts: Hash
|
31
31
|
property :auth_path, default: "/authorize", accepts: ->(path) { path.is_a?(String) && path.start_with?("/") }
|
32
32
|
property :token_path, default: "/token", accepts: ->(path) { path.is_a?(String) && path.start_with?("/") }
|
33
33
|
property :state_token, accepts: String, default: SecureRandom.hex(30)
|
data/lib/shopify-cli/packager.rb
CHANGED
@@ -99,7 +99,7 @@ module ShopifyCli
|
|
99
99
|
raise <<~MESSAGE
|
100
100
|
|
101
101
|
Could not find program #{program} which is required to build the package.
|
102
|
-
You can install it by running
|
102
|
+
You can install it by running #{installation_cmd}.
|
103
103
|
|
104
104
|
MESSAGE
|
105
105
|
end
|
@@ -11,7 +11,7 @@
|
|
11
11
|
module ShopifyCli
|
12
12
|
class ResolveConstant
|
13
13
|
include ShopifyCli::MethodObject
|
14
|
-
property! :namespace, accepts: ->(ns) { ns.respond_to?(:const_get) }, default: Kernel
|
14
|
+
property! :namespace, accepts: ->(ns) { ns.respond_to?(:const_get) }, default: -> { Kernel }
|
15
15
|
|
16
16
|
def call(name)
|
17
17
|
name
|
@@ -42,7 +42,7 @@ module ShopifyCli
|
|
42
42
|
property! :symbolize_keys, accepts: [true, false], default: false, reader: :symbolize_keys?
|
43
43
|
property! :associative_array_container,
|
44
44
|
accepts: ->(c) { c.respond_to?(:new) && c.method_defined?(:[]=) },
|
45
|
-
default: Hash
|
45
|
+
default: -> { Hash }
|
46
46
|
|
47
47
|
def call(object)
|
48
48
|
case object
|
data/lib/shopify-cli/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
cfe83ef361e68ba7c471af75144f2b85cf1e1ec6
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module SmartProperties
|
2
2
|
class Property
|
3
3
|
MODULE_REFERENCE = :"@_smart_properties_method_scope"
|
4
|
+
ALLOWED_DEFAULT_CLASSES = [Proc, Numeric, String, Range, TrueClass, FalseClass, NilClass, Symbol, Module].freeze
|
4
5
|
|
5
6
|
attr_reader :name
|
6
7
|
attr_reader :converter
|
@@ -27,6 +28,11 @@ module SmartProperties
|
|
27
28
|
|
28
29
|
@instance_variable_name = :"@#{name}"
|
29
30
|
|
31
|
+
unless ALLOWED_DEFAULT_CLASSES.any? { |cls| @default.is_a?(cls) }
|
32
|
+
raise ConfigurationError, "Default attribute value #{@default.inspect} cannot be specified as literal, "\
|
33
|
+
"use the syntax `default: -> { ... }` instead."
|
34
|
+
end
|
35
|
+
|
30
36
|
unless attrs.empty?
|
31
37
|
raise ConfigurationError, "SmartProperties do not support the following configuration options: #{attrs.keys.map { |m| m.to_s }.sort.join(', ')}."
|
32
38
|
end
|
@@ -66,7 +72,7 @@ module SmartProperties
|
|
66
72
|
end
|
67
73
|
|
68
74
|
def default(scope)
|
69
|
-
@default.kind_of?(Proc) ? scope.instance_exec(&@default) : @default
|
75
|
+
@default.kind_of?(Proc) ? scope.instance_exec(&@default) : @default.dup
|
70
76
|
end
|
71
77
|
|
72
78
|
def accepts?(value, scope)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|