shopify-cli 0.9.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -3
- data/docs/_config.yml +3 -0
- data/docs/_data/nav.yml +9 -0
- data/docs/getting-started/index.md +5 -40
- data/docs/getting-started/install/index.md +75 -0
- data/docs/getting-started/migrate/index.md +96 -0
- data/docs/getting-started/uninstall/index.md +37 -0
- data/docs/getting-started/upgrade/index.md +37 -0
- data/docs/index.md +5 -6
- data/lib/project_types/extension/cli.rb +3 -2
- data/lib/project_types/extension/commands/build.rb +1 -1
- data/lib/project_types/extension/commands/tunnel.rb +1 -1
- data/lib/project_types/extension/forms/register.rb +2 -3
- data/lib/project_types/extension/graphql/get_app_by_api_key.graphql +9 -0
- data/lib/project_types/extension/tasks/converters/app_converter.rb +27 -0
- data/lib/project_types/extension/tasks/get_app.rb +22 -0
- data/lib/project_types/extension/tasks/get_apps.rb +1 -6
- data/lib/project_types/node/forms/create.rb +3 -54
- data/lib/project_types/node/messages/messages.rb +3 -14
- data/lib/project_types/rails/cli.rb +0 -1
- data/lib/project_types/rails/forms/create.rb +3 -52
- data/lib/project_types/rails/messages/messages.rb +2 -13
- data/lib/project_types/script/cli.rb +5 -5
- data/lib/project_types/script/commands/create.rb +5 -4
- data/lib/project_types/script/commands/disable.rb +4 -14
- data/lib/project_types/script/commands/enable.rb +35 -11
- data/lib/project_types/script/commands/push.rb +9 -9
- data/lib/project_types/script/config/extension_points.yml +9 -3
- data/lib/project_types/script/errors.rb +1 -0
- data/lib/project_types/script/forms/create.rb +8 -4
- data/lib/project_types/script/forms/script_form.rb +5 -2
- data/lib/project_types/script/layers/application/create_script.rb +14 -20
- data/lib/project_types/script/layers/application/disable_script.rb +9 -7
- data/lib/project_types/script/layers/application/enable_script.rb +11 -9
- data/lib/project_types/script/layers/application/project_dependencies.rb +0 -5
- data/lib/project_types/script/layers/application/push_script.rb +6 -4
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +106 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/errors.rb +2 -1
- data/lib/project_types/script/layers/infrastructure/project_creator.rb +23 -0
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/script_repository.rb +1 -34
- data/lib/project_types/script/layers/infrastructure/script_service.rb +2 -0
- data/lib/project_types/script/messages/messages.rb +21 -25
- data/lib/project_types/script/script_project.rb +8 -4
- data/lib/project_types/script/templates/ts/as-pect.config.js +6 -0
- data/lib/project_types/script/templates/ts/as-pect.d.ts +1 -0
- data/lib/project_types/script/ui/error_handler.rb +9 -0
- data/lib/project_types/script/ui/printing_spinner.rb +75 -0
- data/lib/shopify-cli/admin_api.rb +1 -2
- data/lib/shopify-cli/admin_api/populate_resource_command.rb +10 -1
- data/lib/shopify-cli/admin_api/schema.rb +20 -8
- data/lib/shopify-cli/command.rb +2 -5
- data/lib/shopify-cli/commands.rb +1 -0
- data/lib/shopify-cli/commands/config.rb +44 -0
- data/lib/shopify-cli/commands/connect.rb +17 -10
- data/lib/shopify-cli/commands/create.rb +1 -1
- data/lib/shopify-cli/commands/help.rb +1 -1
- data/lib/shopify-cli/commands/system.rb +1 -1
- data/lib/shopify-cli/context.rb +10 -1
- data/lib/shopify-cli/core.rb +0 -1
- data/lib/shopify-cli/core/entry_point.rb +6 -0
- data/lib/shopify-cli/core/finalize.rb +13 -0
- data/lib/shopify-cli/feature.rb +97 -0
- data/lib/shopify-cli/messages/messages.rb +45 -2
- data/lib/shopify-cli/partners_api/organizations.rb +7 -7
- data/lib/shopify-cli/project_type.rb +2 -5
- data/lib/shopify-cli/tasks.rb +1 -0
- data/lib/shopify-cli/tasks/ensure_env.rb +0 -1
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +77 -0
- data/lib/shopify-cli/tasks/update_dashboard_urls.rb +4 -3
- data/lib/shopify-cli/tunnel.rb +66 -10
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +1 -0
- data/vendor/deps/cli-ui/REVISION +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui.rb +52 -11
- data/vendor/deps/cli-ui/lib/cli/ui/color.rb +11 -7
- data/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +34 -21
- data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +107 -149
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +99 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +119 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +158 -0
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +112 -0
- data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +9 -15
- data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +47 -0
- data/vendor/deps/cli-ui/lib/cli/ui/progress.rb +9 -7
- data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +39 -14
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +62 -44
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +7 -2
- data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +23 -3
- data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +34 -10
- data/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +12 -7
- data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +26 -16
- data/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +3 -3
- data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +75 -0
- data/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +27 -0
- data/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +61 -0
- metadata +25 -9
- data/lib/project_types/extension/features/tunnel_url.rb +0 -20
- data/lib/project_types/script/forms/enable.rb +0 -24
- data/lib/project_types/script/forms/push.rb +0 -19
- data/lib/project_types/script/layers/infrastructure/assemblyscript_dependency_manager.rb +0 -51
- data/lib/project_types/script/layers/infrastructure/dependency_manager.rb +0 -36
- data/lib/project_types/script/layers/infrastructure/test_suite_repository.rb +0 -62
- data/vendor/deps/cli-ui/lib/cli/ui/box.rb +0 -15
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'base64'
|
3
|
-
|
4
|
-
module Extension
|
5
|
-
module Features
|
6
|
-
module TunnelUrl
|
7
|
-
NGROK_TUNNELS_URI = URI.parse('http://localhost:4040/api/tunnels')
|
8
|
-
TUNNELS_FIELD = 'tunnels'
|
9
|
-
PUBLIC_URL_FIELD = 'public_url'
|
10
|
-
|
11
|
-
def self.fetch
|
12
|
-
response = Net::HTTP.get_response(NGROK_TUNNELS_URI)
|
13
|
-
json = JSON.parse(response.body)
|
14
|
-
json.dig(TUNNELS_FIELD, 0, PUBLIC_URL_FIELD)
|
15
|
-
rescue
|
16
|
-
nil
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Script
|
4
|
-
module Forms
|
5
|
-
class Enable < ScriptForm
|
6
|
-
flag_arguments :api_key, :shop_domain
|
7
|
-
|
8
|
-
def ask
|
9
|
-
self.api_key ||= ask_api_key
|
10
|
-
self.shop_domain ||= ask_shop_domain
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def ask_api_key
|
16
|
-
ask_app_api_key(organization['apps'], message: ctx.message('script.forms.enable.ask_app_api_key'))
|
17
|
-
end
|
18
|
-
|
19
|
-
def ask_shop_domain
|
20
|
-
super(organization, message: ctx.message('script.forms.enable.ask_shop_domain'))
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Script
|
4
|
-
module Forms
|
5
|
-
class Push < ScriptForm
|
6
|
-
flag_arguments :api_key, :force
|
7
|
-
|
8
|
-
def ask
|
9
|
-
self.api_key ||= ask_api_key
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
def ask_api_key
|
15
|
-
ask_app_api_key(organization['apps'])
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Script
|
4
|
-
module Layers
|
5
|
-
module Infrastructure
|
6
|
-
class AssemblyScriptDependencyManager
|
7
|
-
def initialize(ctx, language, extension_point, script_name)
|
8
|
-
@ctx = ctx
|
9
|
-
@language = language
|
10
|
-
@script_name = script_name
|
11
|
-
@extension_point = extension_point
|
12
|
-
end
|
13
|
-
|
14
|
-
def bootstrap
|
15
|
-
write_npmrc
|
16
|
-
write_package_json
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def write_npmrc
|
22
|
-
@ctx.system(
|
23
|
-
'npm', '--userconfig', './.npmrc', 'config', 'set', '@shopify:registry', 'https://registry.npmjs.com'
|
24
|
-
)
|
25
|
-
end
|
26
|
-
|
27
|
-
def write_package_json
|
28
|
-
package_json = <<~HERE
|
29
|
-
{
|
30
|
-
"name": "#{@script_name}",
|
31
|
-
"version": "1.0.0",
|
32
|
-
"devDependencies": {
|
33
|
-
"@shopify/scripts-sdk-as": "#{@extension_point.sdks[:ts].sdk_version}",
|
34
|
-
"@shopify/scripts-toolchain-as": "#{@extension_point.sdks[:ts].toolchain_version}",
|
35
|
-
"#{@extension_point.sdks[:ts].package}": "#{@extension_point.sdks[:ts].version}",
|
36
|
-
"@as-pect/cli": "4.0.0",
|
37
|
-
"as-wasi": "^0.0.1",
|
38
|
-
"assemblyscript": "^0.12.0"
|
39
|
-
},
|
40
|
-
"scripts": {
|
41
|
-
"test": "asp --config test/as-pect.config.js --summary --verbose"
|
42
|
-
}
|
43
|
-
}
|
44
|
-
HERE
|
45
|
-
|
46
|
-
File.write("package.json", package_json)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Script
|
4
|
-
module Layers
|
5
|
-
module Infrastructure
|
6
|
-
class NoopDependencyManager
|
7
|
-
def initialize(_ctx, language, _extension_point, script_name)
|
8
|
-
@language = language
|
9
|
-
@script_name = script_name
|
10
|
-
end
|
11
|
-
|
12
|
-
def bootstrap
|
13
|
-
end
|
14
|
-
|
15
|
-
def installed?
|
16
|
-
end
|
17
|
-
|
18
|
-
def install
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class DependencyManager
|
23
|
-
DEP_MANAGER = {
|
24
|
-
"ts" => AssemblyScriptDependencyManager,
|
25
|
-
"js" => NoopDependencyManager,
|
26
|
-
"json" => NoopDependencyManager,
|
27
|
-
}
|
28
|
-
|
29
|
-
def self.for(ctx, language, extension_point, script_name)
|
30
|
-
raise Errors::DependencyError, language unless DEP_MANAGER[language]
|
31
|
-
DEP_MANAGER[language].new(ctx, language, extension_point, script_name)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'pathname'
|
4
|
-
|
5
|
-
module Script
|
6
|
-
module Layers
|
7
|
-
module Infrastructure
|
8
|
-
class TestSuiteRepository
|
9
|
-
include SmartProperties
|
10
|
-
property! :ctx, accepts: ShopifyCli::Context
|
11
|
-
|
12
|
-
ASPECT_DTS_FILENAME = "as-pect.d.ts"
|
13
|
-
ASPECT_DTS_FILE_CONTENTS = "/// <reference types=\"@as-pect/assembly/types/as-pect\" />"
|
14
|
-
BOOTSTRAP_TEST = "npx --no-install shopify-scripts-bootstrap test %{test_base}"
|
15
|
-
|
16
|
-
def create_test_suite(script)
|
17
|
-
# Remove this once we have a test suite for js
|
18
|
-
return unless script.language == "ts"
|
19
|
-
|
20
|
-
ctx.mkdir_p(test_base)
|
21
|
-
ctx.cp(aspect_config_template(script.language), "#{test_base}/as-pect.config.js")
|
22
|
-
out, status = CLI::Kit::System.capture2e(format(BOOTSTRAP_TEST, test_base: test_base))
|
23
|
-
raise Domain::Errors::ServiceFailureError, out unless status.success?
|
24
|
-
|
25
|
-
write_tsconfig_file
|
26
|
-
write_aspect_type_definitions_file
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def test_dir
|
32
|
-
"test"
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_base
|
36
|
-
"#{ScriptProject.current.directory}/#{test_dir}"
|
37
|
-
end
|
38
|
-
|
39
|
-
def aspect_config_template(language)
|
40
|
-
Project.project_filepath("templates/#{language}/as-pect.config.js")
|
41
|
-
end
|
42
|
-
|
43
|
-
def write_tsconfig_file
|
44
|
-
AssemblyScriptTsConfig
|
45
|
-
.new(dir_to_write_in: test_dir)
|
46
|
-
.with_extends_assemblyscript_config(relative_path_to_node_modules: ".")
|
47
|
-
.with_module_resolution_paths(paths: { "*": ["#{relative_path_to_source_dir}/*.ts"] })
|
48
|
-
.write
|
49
|
-
end
|
50
|
-
|
51
|
-
def relative_path_to_source_dir
|
52
|
-
src_path_from_root = ScriptRepository.new(ctx: ctx).relative_path_to_src
|
53
|
-
Pathname.new(src_path_from_root).relative_path_from(test_dir)
|
54
|
-
end
|
55
|
-
|
56
|
-
def write_aspect_type_definitions_file
|
57
|
-
File.write("#{test_base}/#{ASPECT_DTS_FILENAME}", ASPECT_DTS_FILE_CONTENTS)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|