shopify-cli 1.0.5 → 1.3.0
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/.github/CONTRIBUTING.md +1 -1
- data/CHANGELOG.md +20 -0
- data/bin/load_shopify.rb +3 -1
- data/bin/shopify +2 -0
- data/docs/core/index.md +16 -0
- data/docs/getting-started/index.md +3 -2
- data/docs/getting-started/install/index.md +55 -9
- data/docs/getting-started/uninstall/index.md +1 -1
- data/docs/getting-started/upgrade/index.md +8 -4
- data/ext/shopify-cli/extconf.rb +40 -20
- data/lib/project_types/extension/cli.rb +6 -1
- data/lib/project_types/extension/commands/register.rb +1 -1
- data/lib/project_types/extension/features/argo/admin.rb +20 -0
- data/lib/project_types/extension/features/argo/base.rb +129 -0
- data/lib/project_types/extension/features/argo/checkout.rb +20 -0
- data/lib/project_types/extension/features/argo_config.rb +60 -0
- data/lib/project_types/extension/messages/messages.rb +11 -2
- data/lib/project_types/extension/models/type.rb +4 -0
- data/lib/project_types/extension/models/types/checkout_post_purchase.rb +6 -3
- data/lib/project_types/extension/models/types/product_subscription.rb +24 -0
- data/lib/project_types/node/commands/create.rb +4 -4
- data/lib/project_types/node/commands/deploy/heroku.rb +6 -1
- data/lib/project_types/node/commands/generate/billing.rb +7 -5
- data/lib/project_types/node/commands/generate/page.rb +9 -5
- data/lib/project_types/node/commands/generate/webhook.rb +5 -1
- data/lib/project_types/node/commands/serve.rb +5 -5
- data/lib/project_types/node/messages/messages.rb +5 -1
- data/lib/project_types/rails/commands/create.rb +56 -5
- data/lib/project_types/rails/commands/generate.rb +1 -0
- data/lib/project_types/rails/commands/generate/webhook.rb +3 -2
- data/lib/project_types/rails/commands/serve.rb +11 -7
- data/lib/project_types/rails/gem.rb +61 -6
- data/lib/project_types/rails/messages/messages.rb +32 -12
- data/lib/project_types/script/config/extension_points.yml +4 -4
- data/lib/project_types/script/forms/create.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +36 -1
- data/lib/project_types/script/layers/infrastructure/errors.rb +7 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +6 -2
- data/lib/project_types/script/messages/messages.rb +12 -37
- data/lib/project_types/script/ui/error_handler.rb +13 -5
- data/lib/rubygems_plugin.rb +18 -10
- data/lib/shopify-cli/admin_api/populate_resource_command.rb +1 -1
- data/lib/shopify-cli/commands/config.rb +33 -1
- data/lib/shopify-cli/commands/connect.rb +1 -1
- data/lib/shopify-cli/commands/system.rb +9 -8
- data/lib/shopify-cli/context.rb +68 -0
- data/lib/shopify-cli/core/entry_point.rb +3 -0
- data/lib/shopify-cli/git.rb +1 -1
- data/lib/shopify-cli/heroku.rb +18 -2
- data/lib/shopify-cli/js_deps.rb +2 -2
- data/lib/shopify-cli/js_system.rb +24 -7
- data/lib/shopify-cli/messages/messages.rb +39 -11
- data/lib/shopify-cli/process_supervision.rb +52 -15
- data/lib/shopify-cli/project.rb +17 -9
- data/lib/shopify-cli/tunnel.rb +19 -4
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +6 -2
- data/shopify-cli.gemspec +4 -1
- data/vendor/deps/cli-kit/REVISION +1 -1
- data/vendor/deps/cli-kit/lib/cli/kit.rb +1 -1
- data/vendor/deps/cli-kit/lib/cli/kit/autocall.rb +2 -2
- data/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +12 -6
- data/vendor/deps/cli-kit/lib/cli/kit/executor.rb +9 -11
- data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +8 -2
- data/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +7 -7
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +48 -17
- data/vendor/deps/cli-ui/REVISION +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui.rb +5 -4
- data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +9 -3
- data/vendor/deps/cli-ui/lib/cli/ui/color.rb +1 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -2
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +13 -5
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +29 -2
- data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +21 -10
- data/vendor/deps/cli-ui/lib/cli/ui/os.rb +63 -0
- data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +11 -2
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +1 -0
- data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -3
- data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +6 -8
- data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +2 -0
- data/vendor/gen/lib/gen.rb +39 -0
- data/vendor/gen/lib/gen/commands.rb +18 -0
- data/vendor/gen/lib/gen/commands/help.rb +20 -0
- data/vendor/gen/lib/gen/commands/new.rb +21 -0
- data/vendor/gen/lib/gen/entry_point.rb +10 -0
- data/vendor/gen/lib/gen/generator.rb +165 -0
- data/vendor/gen/template/.gitignore +2 -0
- data/vendor/gen/template/Gemfile +10 -0
- data/vendor/gen/template/README.md +1 -0
- data/vendor/gen/template/bin/testunit +23 -0
- data/vendor/gen/template/bin/update-deps +97 -0
- data/vendor/gen/template/dev-gems.yml +3 -0
- data/vendor/gen/template/dev-vendor.yml +4 -0
- data/vendor/gen/template/exe/__app__-gems +17 -0
- data/vendor/gen/template/exe/__app__-vendor +18 -0
- data/vendor/gen/template/lib/__app__.rb +33 -0
- data/vendor/gen/template/lib/__app__/commands.rb +18 -0
- data/vendor/gen/template/lib/__app__/commands/example.rb +19 -0
- data/vendor/gen/template/lib/__app__/commands/help.rb +21 -0
- data/vendor/gen/template/lib/__app__/entry_point.rb +10 -0
- data/vendor/gen/template/test/example_test.rb +17 -0
- data/vendor/gen/template/test/test_helper.rb +22 -0
- metadata +30 -6
- data/Vagrantfile +0 -17
- data/lib/project_types/extension/features/argo.rb +0 -48
- data/lib/project_types/extension/models/types/subscription_management.rb +0 -20
- data/lib/project_types/script/forms/script_form.rb +0 -69
|
@@ -15,30 +15,65 @@ module Rails
|
|
|
15
15
|
version = args.shift
|
|
16
16
|
gem = new(ctx: ctx, name: name, version: version)
|
|
17
17
|
ctx.debug(ctx.message('rails.gem.installed_debug', name, gem.installed?))
|
|
18
|
-
gem.
|
|
18
|
+
gem.installed? ? true : gem.install!
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def binary_path_for(ctx, binary)
|
|
22
|
-
File.join(gem_home(ctx), 'bin', binary)
|
|
22
|
+
path_to_binary = File.join(gem_home(ctx), 'bin', binary)
|
|
23
|
+
File.exist?(path_to_binary) ? path_to_binary : binary
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
def gem_home(ctx)
|
|
26
27
|
ctx.getenv('GEM_HOME') || apply_gem_home(ctx)
|
|
27
28
|
end
|
|
28
29
|
|
|
30
|
+
def gem_path(ctx)
|
|
31
|
+
ctx.getenv('GEM_PATH') || apply_gem_path(ctx)
|
|
32
|
+
end
|
|
33
|
+
|
|
29
34
|
private
|
|
30
35
|
|
|
31
36
|
def apply_gem_home(ctx)
|
|
32
|
-
path =
|
|
37
|
+
path = ''
|
|
38
|
+
# extract GEM_HOME from `gem environment home` command
|
|
39
|
+
out, stat = ctx.capture2e('gem', 'environment', 'home')
|
|
40
|
+
path = out&.empty? ? '' : out.strip if stat.success?
|
|
41
|
+
# fallback if return from `gem environment home` is empty (somewhat unlikely)
|
|
42
|
+
path = fallback_gem_home_path(ctx) if path.empty?
|
|
43
|
+
# fallback if path isn't writable (if using a system installed ruby)
|
|
44
|
+
path = fallback_gem_home_path(ctx) unless File.writable?(path)
|
|
33
45
|
ctx.mkdir_p(path) unless Dir.exist?(path)
|
|
46
|
+
ctx.debug(ctx.message('rails.gem.setting_gem_home', path))
|
|
34
47
|
ctx.setenv('GEM_HOME', path)
|
|
35
48
|
end
|
|
49
|
+
|
|
50
|
+
def apply_gem_path(ctx)
|
|
51
|
+
path = ''
|
|
52
|
+
out, stat = ctx.capture2e('gem', 'environment', 'path')
|
|
53
|
+
path = out&.empty? ? '' : out.strip if stat.success?
|
|
54
|
+
# usually GEM_PATH already contains GEM_HOME
|
|
55
|
+
# if gem_home() falls back to our fallback path, we need to add it
|
|
56
|
+
path = gem_home(ctx) + File::PATH_SEPARATOR + path unless path.include?(gem_home(ctx))
|
|
57
|
+
ctx.debug(ctx.message('rails.gem.setting_gem_path', path))
|
|
58
|
+
ctx.setenv('GEM_PATH', path)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def fallback_gem_home_path(ctx)
|
|
62
|
+
File.join(ctx.getenv('HOME'), '.gem', 'ruby', RUBY_VERSION)
|
|
63
|
+
end
|
|
36
64
|
end
|
|
37
65
|
|
|
38
66
|
def installed?
|
|
39
|
-
|
|
40
|
-
|
|
67
|
+
found = false
|
|
68
|
+
paths = self.class.gem_path(ctx).split(File::PATH_SEPARATOR)
|
|
69
|
+
paths.each do |path|
|
|
70
|
+
ctx.debug(ctx.message('rails.gem.checking_installation_path', "#{path}/gems/", name))
|
|
71
|
+
found = !!Dir.glob("#{path}/gems/#{name}-*").detect do |f|
|
|
72
|
+
gem_satisfies_version?(f)
|
|
73
|
+
end
|
|
74
|
+
break if found
|
|
41
75
|
end
|
|
76
|
+
found
|
|
42
77
|
end
|
|
43
78
|
|
|
44
79
|
def install!
|
|
@@ -46,11 +81,31 @@ module Rails
|
|
|
46
81
|
spin.add(ctx.message('rails.gem.installing', name)) do |spinner|
|
|
47
82
|
args = %w(gem install)
|
|
48
83
|
args.push(name)
|
|
49
|
-
|
|
84
|
+
unless version.nil?
|
|
85
|
+
if ctx.windows? && version.include?('~')
|
|
86
|
+
args.push('-v', "\"#{version}\"")
|
|
87
|
+
else
|
|
88
|
+
args.push('-v', version)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
50
91
|
ctx.system(*args)
|
|
51
92
|
spinner.update_title(ctx.message('rails.gem.installed', name))
|
|
52
93
|
end
|
|
53
94
|
spin.wait
|
|
54
95
|
end
|
|
96
|
+
|
|
97
|
+
def gem_satisfies_version?(path)
|
|
98
|
+
if version
|
|
99
|
+
# there was a specific version given during new(), so
|
|
100
|
+
# check version of gem found to determine match
|
|
101
|
+
require 'semantic/semantic'
|
|
102
|
+
found_version, _ = path.match(%r{/#{Regexp.quote(name)}-([\d\.]+)})&.captures
|
|
103
|
+
found_version.nil? ? false : Semantic::Version.new(found_version).satisfies?(version)
|
|
104
|
+
else
|
|
105
|
+
# otherwise ignore the actual version number,
|
|
106
|
+
# just check there's an initial digit
|
|
107
|
+
%r{/#{Regexp.quote(name)}-\d}.match?(path)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
55
110
|
end
|
|
56
111
|
end
|
|
@@ -9,9 +9,12 @@ module Rails
|
|
|
9
9
|
},
|
|
10
10
|
|
|
11
11
|
gem: {
|
|
12
|
+
checking_installation_path: "Checking path %s for gem %s",
|
|
13
|
+
installed: "Installed %s gem",
|
|
12
14
|
installed_debug: "%s installed: %s",
|
|
13
15
|
installing: "Installing %s gem...",
|
|
14
|
-
|
|
16
|
+
setting_gem_home: "GEM_HOME being set to %s",
|
|
17
|
+
setting_gem_path: "GEM_PATH being set to %s",
|
|
15
18
|
},
|
|
16
19
|
|
|
17
20
|
create: {
|
|
@@ -33,6 +36,15 @@ module Rails
|
|
|
33
36
|
See {{underline:https://github.com/Shopify/shopify-app-cli/blob/master/docs/installing-ruby.md}}
|
|
34
37
|
for our recommended method of installing ruby.
|
|
35
38
|
MSG
|
|
39
|
+
dir_exists: "Project directory %s already exists. Please use a different name.",
|
|
40
|
+
install_failure: "Error installing %s gem",
|
|
41
|
+
node_required: "node is required to create a rails project. Download at https://nodejs.org/en/download.",
|
|
42
|
+
node_version_failure: "Failed to get the current node version. Please make sure it is installed as " \
|
|
43
|
+
"per the instructions at https://nodejs.org/en.",
|
|
44
|
+
yarn_required: "yarn is required to create a rails project. Download at " \
|
|
45
|
+
"https://classic.yarnpkg.com/en/docs/install.",
|
|
46
|
+
yarn_version_failure: "Failed to get the current yarn version. Please make sure it is installed as per " \
|
|
47
|
+
"the instructions at https://classic.yarnpkg.com/en/docs/install.",
|
|
36
48
|
},
|
|
37
49
|
|
|
38
50
|
info: {
|
|
@@ -40,13 +52,18 @@ module Rails
|
|
|
40
52
|
serve: "{{*}} Change directories to your new project folder {{green:%s}} and run {{command:%s serve}} " \
|
|
41
53
|
"to start a local server",
|
|
42
54
|
install: "{{*}} Then, visit {{underline:%s/test}} to install {{green:%s}} on your Dev Store",
|
|
55
|
+
open_new_shell: "{{*}} {{yellow:After installing %s, please open a new Command Prompt or PowerShell " \
|
|
56
|
+
"window to continue.}}",
|
|
43
57
|
},
|
|
44
|
-
installing_bundler: "Installing bundler
|
|
58
|
+
installing_bundler: "Installing bundler...",
|
|
45
59
|
generating_app: "Generating new rails app project in %s...",
|
|
46
|
-
adding_shopify_gem: "{{v}} Adding shopify_app gem
|
|
60
|
+
adding_shopify_gem: "{{v}} Adding shopify_app gem...",
|
|
61
|
+
node_version: "node %s",
|
|
62
|
+
yarn_version: "yarn %s",
|
|
47
63
|
running_bundle_install: "Running bundle install...",
|
|
48
64
|
running_generator: "Running shopify_app generator...",
|
|
49
|
-
running_migrations: "Running migrations
|
|
65
|
+
running_migrations: "Running migrations...",
|
|
66
|
+
running_webpacker_install: "Running webpacker:install...",
|
|
50
67
|
},
|
|
51
68
|
|
|
52
69
|
deploy: {
|
|
@@ -65,14 +82,14 @@ module Rails
|
|
|
65
82
|
Deploy the current Rails project to Heroku
|
|
66
83
|
Usage: {{command:%s deploy heroku}}
|
|
67
84
|
HELP
|
|
68
|
-
downloading: "Downloading Heroku CLI
|
|
85
|
+
downloading: "Downloading Heroku CLI...",
|
|
69
86
|
downloaded: "Downloaded Heroku CLI",
|
|
70
|
-
installing: "Installing Heroku CLI
|
|
87
|
+
installing: "Installing Heroku CLI...",
|
|
71
88
|
installed: "Installed Heroku CLI",
|
|
72
89
|
authenticated_with_account: "{{v}} Authenticated with Heroku as `%s`",
|
|
73
|
-
authenticating: "Authenticating with Heroku
|
|
90
|
+
authenticating: "Authenticating with Heroku...",
|
|
74
91
|
authenticated: "{{v}} Authenticated with Heroku",
|
|
75
|
-
deploying: "Deploying to Heroku
|
|
92
|
+
deploying: "Deploying to Heroku...",
|
|
76
93
|
deployed: "{{v}} Deployed to Heroku",
|
|
77
94
|
db_check: {
|
|
78
95
|
validating: "Validating application...",
|
|
@@ -86,7 +103,7 @@ module Rails
|
|
|
86
103
|
SQLITE
|
|
87
104
|
},
|
|
88
105
|
git: {
|
|
89
|
-
checking: "Checking git repo
|
|
106
|
+
checking: "Checking git repo...",
|
|
90
107
|
initialized: "Git repo initialized",
|
|
91
108
|
what_branch: "What branch would you like to deploy?",
|
|
92
109
|
branch_selected: "{{v}} Git branch `%s` selected for deploy",
|
|
@@ -95,10 +112,10 @@ module Rails
|
|
|
95
112
|
no_apps_found: "No existing Heroku app found. What would you like to do?",
|
|
96
113
|
name: "What is your Heroku app’s name?",
|
|
97
114
|
select: "Specify an existing Heroku app",
|
|
98
|
-
selecting: "Selecting Heroku app `%s
|
|
115
|
+
selecting: "Selecting Heroku app `%s`...",
|
|
99
116
|
selected: "{{v}} Heroku app `%s` selected",
|
|
100
117
|
create: "Create a new Heroku app",
|
|
101
|
-
creating: "Creating new Heroku app
|
|
118
|
+
creating: "Creating new Heroku app...",
|
|
102
119
|
created: "{{v}} New Heroku app created",
|
|
103
120
|
},
|
|
104
121
|
},
|
|
@@ -203,7 +220,10 @@ module Rails
|
|
|
203
220
|
host_must_be_https: "{{red:HOST must be a HTTPS url.}}",
|
|
204
221
|
},
|
|
205
222
|
|
|
206
|
-
open_info:
|
|
223
|
+
open_info: <<~MESSAGE,
|
|
224
|
+
{{*}} To install and start using your app, open this URL in your browser:
|
|
225
|
+
{{green:%s}}
|
|
226
|
+
MESSAGE
|
|
207
227
|
running_server: "Running server...",
|
|
208
228
|
},
|
|
209
229
|
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
discount:
|
|
2
2
|
assemblyscript:
|
|
3
3
|
package: "@shopify/extension-point-as-discount"
|
|
4
|
-
version: "^0.2.
|
|
4
|
+
version: "^0.2.10"
|
|
5
5
|
sdk-version: "^6.0.0"
|
|
6
6
|
toolchain-version: "^1.1.0"
|
|
7
7
|
unit_limit_per_order:
|
|
8
8
|
assemblyscript:
|
|
9
9
|
package: "@shopify/extension-point-as-unit-limit-per-order"
|
|
10
|
-
version: "^0.1.
|
|
10
|
+
version: "^0.1.12"
|
|
11
11
|
sdk-version: "^6.0.0"
|
|
12
12
|
toolchain-version: "^1.1.0"
|
|
13
13
|
payment_filter:
|
|
14
14
|
assemblyscript:
|
|
15
15
|
package: "@shopify/extension-point-as-payment-filter"
|
|
16
|
-
version: "^0.2.
|
|
16
|
+
version: "^0.2.8"
|
|
17
17
|
sdk-version: "^6.0.0"
|
|
18
18
|
toolchain-version: "^1.1.0"
|
|
19
19
|
shipping_filter:
|
|
20
20
|
assemblyscript:
|
|
21
21
|
package: "@shopify/extension-point-as-shipping-filter"
|
|
22
|
-
version: "^0.2.
|
|
22
|
+
version: "^0.2.10"
|
|
23
23
|
sdk-version: "^6.0.0"
|
|
24
24
|
toolchain-version: "^1.1.0"
|
|
@@ -34,7 +34,9 @@ module Script
|
|
|
34
34
|
|
|
35
35
|
def dependencies_installed?
|
|
36
36
|
# Assuming if node_modules folder exist at root of script folder, all deps are installed
|
|
37
|
-
ctx.dir_exist?("node_modules")
|
|
37
|
+
return false unless ctx.dir_exist?("node_modules")
|
|
38
|
+
check_if_ep_dependencies_up_to_date!
|
|
39
|
+
true
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
private
|
|
@@ -58,6 +60,39 @@ module Script
|
|
|
58
60
|
def bytecode
|
|
59
61
|
File.read(format(BYTECODE_FILE, name: script_name))
|
|
60
62
|
end
|
|
63
|
+
|
|
64
|
+
def check_if_ep_dependencies_up_to_date!
|
|
65
|
+
return true if ENV['SHOPIFY_CLI_SCRIPTS_IGNORE_OUTDATED']
|
|
66
|
+
|
|
67
|
+
# ignore exit code since it will not be 0 unless every package is up to date which they probably won't be
|
|
68
|
+
out, _ = ctx.capture2e("npm", "outdated", "--json", "--depth", "0")
|
|
69
|
+
parsed_outdated_check = JSON.parse(out)
|
|
70
|
+
outdated_ep_packages = parsed_outdated_check
|
|
71
|
+
.select { |package_name, _| package_name.start_with?('@shopify/extension-point-as-') }
|
|
72
|
+
.select { |_, version_info| !package_is_up_to_date?(version_info) }
|
|
73
|
+
.keys
|
|
74
|
+
raise Errors::PackagesOutdatedError.new(outdated_ep_packages),
|
|
75
|
+
"NPM packages out of date: #{outdated_ep_packages.join(', ')}" unless outdated_ep_packages.empty?
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def package_is_up_to_date?(version_info)
|
|
79
|
+
require 'semantic/semantic'
|
|
80
|
+
current_version = version_info['current']
|
|
81
|
+
latest_version = version_info['latest']
|
|
82
|
+
|
|
83
|
+
# making an assumption that the script developer knows what they're doing if they're not referencing a
|
|
84
|
+
# semver version
|
|
85
|
+
begin
|
|
86
|
+
current_version = ::Semantic::Version.new(current_version)
|
|
87
|
+
latest_version = ::Semantic::Version.new(latest_version)
|
|
88
|
+
rescue ArgumentError
|
|
89
|
+
return true
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
return false if current_version.major < latest_version.major
|
|
93
|
+
return false if latest_version.major == 0 && current_version.minor < latest_version.minor
|
|
94
|
+
true
|
|
95
|
+
end
|
|
61
96
|
end
|
|
62
97
|
end
|
|
63
98
|
end
|
|
@@ -34,6 +34,13 @@ module Script
|
|
|
34
34
|
class ShopScriptConflictError < ScriptProjectError; end
|
|
35
35
|
class ShopScriptUndefinedError < ScriptProjectError; end
|
|
36
36
|
class TaskRunnerNotFoundError < ScriptProjectError; end
|
|
37
|
+
class PackagesOutdatedError < ScriptProjectError
|
|
38
|
+
attr_reader :outdated_packages
|
|
39
|
+
def initialize(outdated_packages)
|
|
40
|
+
super("EP packages are outdated and need to be updated: #{outdated_packages.join(', ')}")
|
|
41
|
+
@outdated_packages = outdated_packages
|
|
42
|
+
end
|
|
43
|
+
end
|
|
37
44
|
end
|
|
38
45
|
end
|
|
39
46
|
end
|
|
@@ -49,7 +49,7 @@ module Script
|
|
|
49
49
|
resp_hash = script_service_request(
|
|
50
50
|
query_name: query_name,
|
|
51
51
|
api_key: api_key,
|
|
52
|
-
shop_domain: shop_domain,
|
|
52
|
+
shop_domain: format_shop_domain(shop_domain),
|
|
53
53
|
variables: variables,
|
|
54
54
|
)
|
|
55
55
|
user_errors = resp_hash["data"]["shopScriptUpdateOrCreate"]["userErrors"]
|
|
@@ -76,7 +76,7 @@ module Script
|
|
|
76
76
|
resp_hash = script_service_request(
|
|
77
77
|
query_name: query_name,
|
|
78
78
|
api_key: api_key,
|
|
79
|
-
shop_domain: shop_domain,
|
|
79
|
+
shop_domain: format_shop_domain(shop_domain),
|
|
80
80
|
variables: variables,
|
|
81
81
|
)
|
|
82
82
|
user_errors = resp_hash["data"]["shopScriptDelete"]["userErrors"]
|
|
@@ -91,6 +91,10 @@ module Script
|
|
|
91
91
|
|
|
92
92
|
private
|
|
93
93
|
|
|
94
|
+
def format_shop_domain(shop_domain)
|
|
95
|
+
shop_domain.delete_suffix("/")
|
|
96
|
+
end
|
|
97
|
+
|
|
94
98
|
class ScriptServiceAPI < ShopifyCli::API
|
|
95
99
|
property(:api_key, accepts: String)
|
|
96
100
|
property(:shop_id, accepts: Integer)
|
|
@@ -29,7 +29,7 @@ module Script
|
|
|
29
29
|
no_existing_orgs_cause: "You don't have any partner organizations.",
|
|
30
30
|
no_existing_orgs_help: "Please visit https://partners.shopify.com/ to create a partners account.",
|
|
31
31
|
|
|
32
|
-
no_existing_stores_cause: "You don't have any
|
|
32
|
+
no_existing_stores_cause: "You don't have any stores.",
|
|
33
33
|
no_existing_stores_help: "Visit https://partners.shopify.com/%{organization_id}/stores/ to create one.",
|
|
34
34
|
|
|
35
35
|
project_exists_cause: "Directory with the same name as the script already exists.",
|
|
@@ -43,11 +43,9 @@ module Script
|
|
|
43
43
|
|
|
44
44
|
script_not_found_cause: "Couldn't find script %s for extension point %s",
|
|
45
45
|
|
|
46
|
-
app_not_installed_cause: "App not installed on
|
|
46
|
+
app_not_installed_cause: "App not installed on store.",
|
|
47
47
|
|
|
48
|
-
app_script_not_pushed_help: "
|
|
49
|
-
|
|
50
|
-
app_script_undefined_help: "Push script to app.",
|
|
48
|
+
app_script_not_pushed_help: "Script isn't on the app. Run {{command:shopify push}}, and then try again.",
|
|
51
49
|
|
|
52
50
|
build_error_cause: "Something went wrong while building the script.",
|
|
53
51
|
build_error_help: "Correct the errors and try again.",
|
|
@@ -70,7 +68,10 @@ module Script
|
|
|
70
68
|
"on this extension point.",
|
|
71
69
|
shop_script_conflict_help: "Disable that script or uninstall that app and try again.",
|
|
72
70
|
|
|
73
|
-
shop_script_undefined_cause: "Script is already turned off in
|
|
71
|
+
shop_script_undefined_cause: "Script is already turned off in store.",
|
|
72
|
+
|
|
73
|
+
packages_outdated_cause: "The following npm packages are out of date: %s.",
|
|
74
|
+
packages_outdated_help: "Update them by running {{cyan:npm install --save-dev %s}}.",
|
|
74
75
|
},
|
|
75
76
|
|
|
76
77
|
create: {
|
|
@@ -100,7 +101,7 @@ module Script
|
|
|
100
101
|
HELP
|
|
101
102
|
|
|
102
103
|
error: {
|
|
103
|
-
operation_failed: "
|
|
104
|
+
operation_failed: "Couldn't push script to app.",
|
|
104
105
|
},
|
|
105
106
|
|
|
106
107
|
script_pushed: "{{v}} Script pushed to app (API key: %{api_key}).",
|
|
@@ -108,21 +109,20 @@ module Script
|
|
|
108
109
|
|
|
109
110
|
disable: {
|
|
110
111
|
help: <<~HELP,
|
|
111
|
-
Turn off script in
|
|
112
|
+
Turn off script in store.
|
|
112
113
|
Usage: {{command:%s disable}}
|
|
113
114
|
HELP
|
|
114
115
|
|
|
115
116
|
error: {
|
|
116
117
|
operation_failed: "Can't disable script.",
|
|
117
|
-
not_pushed_to_app: "Can't disable the script because it hasn't been pushed to the app.",
|
|
118
118
|
},
|
|
119
119
|
|
|
120
|
-
script_disabled: "{{v}} Script disabled. Script is turned off in
|
|
120
|
+
script_disabled: "{{v}} Script disabled. Script is turned off in store.",
|
|
121
121
|
},
|
|
122
122
|
|
|
123
123
|
enable: {
|
|
124
124
|
help: <<~HELP,
|
|
125
|
-
Turn on script in
|
|
125
|
+
Turn on script in store.
|
|
126
126
|
Usage: {{command:%s enable}}
|
|
127
127
|
Options:
|
|
128
128
|
{{command:--config_props='name1:value1, name2:value2'}} Optional. Define the configuration of your script by passing individual name and value pairs. If used with --config_file, then matching values in --config_props will override those set in the file.
|
|
@@ -135,11 +135,10 @@ module Script
|
|
|
135
135
|
|
|
136
136
|
error: {
|
|
137
137
|
operation_failed: "Can't enable script.",
|
|
138
|
-
not_pushed_to_app: "Can't enable the script because it hasn't been pushed to the app.",
|
|
139
138
|
},
|
|
140
139
|
|
|
141
140
|
script_enabled: "{{v}} Script enabled. %{type} script %{title} in app (API key: %{api_key}) "\
|
|
142
|
-
"is turned on in
|
|
141
|
+
"is turned on in store {{green:%{shop_domain}}}",
|
|
143
142
|
},
|
|
144
143
|
|
|
145
144
|
project_deps: {
|
|
@@ -149,35 +148,11 @@ module Script
|
|
|
149
148
|
installed: "Missing dependencies installed",
|
|
150
149
|
},
|
|
151
150
|
|
|
152
|
-
test: {
|
|
153
|
-
help: <<~HELP,
|
|
154
|
-
Runs unit tests on your script.
|
|
155
|
-
Usage: {{command:%s test}}
|
|
156
|
-
HELP
|
|
157
|
-
|
|
158
|
-
error: {
|
|
159
|
-
operation_failed: "Tests didn't run or they ran with failures.",
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
running: "Running tests",
|
|
163
|
-
success: "{{v}} Tests finished.",
|
|
164
|
-
},
|
|
165
|
-
|
|
166
151
|
forms: {
|
|
167
152
|
create: {
|
|
168
153
|
select_extension_point: "Which extension point do you want to use?",
|
|
169
154
|
script_name: "Script Name",
|
|
170
155
|
},
|
|
171
|
-
script_form: {
|
|
172
|
-
ask_app_api_key_default: "Which app do you want this script to belong to?",
|
|
173
|
-
ask_shop_domain_default: "Select a development store",
|
|
174
|
-
fetching_organizations: "Fetching partner organizations",
|
|
175
|
-
fetched_organizations: "Fetched partner organizations",
|
|
176
|
-
select_organization: "Select partner organization.",
|
|
177
|
-
using_app: "Using app {{green:%{title} (%{api_key})}}.",
|
|
178
|
-
using_development_store: "Using development store {{green:%{domain}}}",
|
|
179
|
-
using_organization: "Partner organization {{green:%s}}.",
|
|
180
|
-
},
|
|
181
156
|
},
|
|
182
157
|
|
|
183
158
|
application: {
|