shopify-cli 0.9.1 → 1.0.2
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/CODEOWNERS +3 -0
- data/CHANGELOG.md +24 -2
- data/RELEASING.md +4 -4
- 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 +2 -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/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/push.rb +1 -0
- data/lib/project_types/script/config/extension_points.yml +3 -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/layers/application/build_script.rb +7 -10
- data/lib/project_types/script/layers/application/create_script.rb +16 -14
- data/lib/project_types/script/layers/application/project_dependencies.rb +3 -9
- data/lib/project_types/script/layers/application/push_script.rb +13 -11
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +106 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +64 -0
- data/lib/project_types/script/layers/infrastructure/errors.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/project_creator.rb +23 -0
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +6 -3
- data/lib/project_types/script/layers/infrastructure/script_repository.rb +8 -38
- data/lib/project_types/script/layers/infrastructure/task_runner.rb +18 -0
- data/lib/project_types/script/messages/messages.rb +5 -6
- data/lib/project_types/script/script_project.rb +22 -9
- data/lib/project_types/script/templates/ts/as-pect.d.ts +1 -0
- data/lib/project_types/script/ui/error_handler.rb +5 -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 +11 -1
- data/lib/shopify-cli/api.rb +2 -0
- data/lib/shopify-cli/context.rb +60 -0
- data/lib/shopify-cli/core/entry_point.rb +6 -0
- data/lib/shopify-cli/core/finalize.rb +13 -0
- data/lib/shopify-cli/git.rb +14 -10
- data/lib/shopify-cli/messages/messages.rb +22 -2
- data/lib/shopify-cli/tasks.rb +1 -0
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +77 -0
- data/lib/shopify-cli/tunnel.rb +33 -1
- data/lib/shopify-cli/version.rb +1 -1
- 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 +24 -9
- data/lib/project_types/extension/features/tunnel_url.rb +0 -20
- data/lib/project_types/script/layers/infrastructure/assemblyscript_dependency_manager.rb +0 -73
- data/lib/project_types/script/layers/infrastructure/assemblyscript_wasm_builder.rb +0 -39
- data/lib/project_types/script/layers/infrastructure/dependency_manager.rb +0 -36
- data/lib/project_types/script/layers/infrastructure/script_builder.rb +0 -34
- data/lib/project_types/script/layers/infrastructure/test_suite_repository.rb +0 -59
- 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,73 +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
|
-
def installed?
|
|
20
|
-
# Assuming if node_modules folder exist at root of script folder, all deps are installed
|
|
21
|
-
Dir.exist?("node_modules")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def install
|
|
25
|
-
check_node_version!
|
|
26
|
-
|
|
27
|
-
output, status = @ctx.capture2e("npm", "install", "--no-audit", "--no-optional", "--loglevel error")
|
|
28
|
-
raise Errors::DependencyInstallError, output unless status.success?
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
def check_node_version!
|
|
34
|
-
output, status = @ctx.capture2e("node", "--version")
|
|
35
|
-
raise Errors::DependencyInstallError, output unless status.success?
|
|
36
|
-
|
|
37
|
-
version = Semantic::Version.new(output[1..-1])
|
|
38
|
-
unless version >= Semantic::Version.new("12.16.0")
|
|
39
|
-
raise Errors::DependencyInstallError, "Node version must be >= v12.16.0 Current version: #{output}."
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def write_npmrc
|
|
44
|
-
@ctx.system(
|
|
45
|
-
'npm', '--userconfig', './.npmrc', 'config', 'set', '@shopify:registry', 'https://registry.npmjs.com'
|
|
46
|
-
)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def write_package_json
|
|
50
|
-
package_json = <<~HERE
|
|
51
|
-
{
|
|
52
|
-
"name": "#{@script_name}",
|
|
53
|
-
"version": "1.0.0",
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"@shopify/scripts-sdk-as": "#{@extension_point.sdks[:ts].sdk_version}",
|
|
56
|
-
"@shopify/scripts-toolchain-as": "#{@extension_point.sdks[:ts].toolchain_version}",
|
|
57
|
-
"#{@extension_point.sdks[:ts].package}": "#{@extension_point.sdks[:ts].version}",
|
|
58
|
-
"@as-pect/cli": "4.0.0",
|
|
59
|
-
"as-wasi": "^0.0.1",
|
|
60
|
-
"assemblyscript": "^0.12.0"
|
|
61
|
-
},
|
|
62
|
-
"scripts": {
|
|
63
|
-
"test": "asp --config test/as-pect.config.js --summary --verbose"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
HERE
|
|
67
|
-
|
|
68
|
-
File.write("package.json", package_json)
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Script
|
|
4
|
-
module Layers
|
|
5
|
-
module Infrastructure
|
|
6
|
-
class AssemblyScriptWasmBuilder
|
|
7
|
-
BYTECODE_FILE = "%{name}.wasm"
|
|
8
|
-
SCRIPT_SDK_BUILD = "npx --no-install shopify-scripts-build --src=../%{source} --binary=#{BYTECODE_FILE} "\
|
|
9
|
-
"-- --lib=../node_modules --validate --optimize"
|
|
10
|
-
|
|
11
|
-
attr_reader :script
|
|
12
|
-
|
|
13
|
-
def initialize(script)
|
|
14
|
-
@script = script
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def build
|
|
18
|
-
compile
|
|
19
|
-
bytecode
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def compiled_type
|
|
23
|
-
"wasm"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
private
|
|
27
|
-
|
|
28
|
-
def compile
|
|
29
|
-
out, status = CLI::Kit::System.capture2e(format(SCRIPT_SDK_BUILD, source: script.id, name: script.name))
|
|
30
|
-
raise Domain::Errors::ServiceFailureError, out unless status.success?
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def bytecode
|
|
34
|
-
File.read(format(BYTECODE_FILE, name: script.name))
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
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,34 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Script
|
|
4
|
-
module Layers
|
|
5
|
-
module Infrastructure
|
|
6
|
-
class NoopBuilder
|
|
7
|
-
def initialize(script)
|
|
8
|
-
@script = script
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def build
|
|
12
|
-
File.read(@script.filename)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def compiled_type
|
|
16
|
-
@script.language
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
class ScriptBuilder
|
|
21
|
-
COMPILERS = {
|
|
22
|
-
"ts" => Infrastructure::AssemblyScriptWasmBuilder,
|
|
23
|
-
"js" => Infrastructure::NoopBuilder,
|
|
24
|
-
"json" => Infrastructure::NoopBuilder,
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
def self.for(script)
|
|
28
|
-
raise Errors::BuilderNotFoundError unless COMPILERS[script.language]
|
|
29
|
-
COMPILERS[script.language].new(script)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
@@ -1,59 +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
|
-
ASPECT_DTS_FILENAME = "as-pect.d.ts"
|
|
10
|
-
ASPECT_DTS_FILE_CONTENTS = "/// <reference types=\"@as-pect/assembly/types/as-pect\" />"
|
|
11
|
-
BOOTSTRAP_TEST = "npx --no-install shopify-scripts-bootstrap test %{test_base}"
|
|
12
|
-
|
|
13
|
-
def create_test_suite(script)
|
|
14
|
-
# Remove this once we have a test suite for js
|
|
15
|
-
return unless script.language == "ts"
|
|
16
|
-
|
|
17
|
-
FileUtils.mkdir_p(test_base)
|
|
18
|
-
FileUtils.copy(aspect_config_template(script.language), "#{test_base}/as-pect.config.js")
|
|
19
|
-
out, status = CLI::Kit::System.capture2e(format(BOOTSTRAP_TEST, test_base: test_base))
|
|
20
|
-
raise Domain::Errors::ServiceFailureError, out unless status.success?
|
|
21
|
-
|
|
22
|
-
write_tsconfig_file
|
|
23
|
-
write_aspect_type_definitions_file
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
private
|
|
27
|
-
|
|
28
|
-
def test_dir
|
|
29
|
-
"test"
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def test_base
|
|
33
|
-
"#{ScriptProject.current.directory}/#{test_dir}"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def aspect_config_template(language)
|
|
37
|
-
Project.project_filepath("templates/#{language}/as-pect.config.js")
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def write_tsconfig_file
|
|
41
|
-
AssemblyScriptTsConfig
|
|
42
|
-
.new(dir_to_write_in: test_dir)
|
|
43
|
-
.with_extends_assemblyscript_config(relative_path_to_node_modules: ".")
|
|
44
|
-
.with_module_resolution_paths(paths: { "*": ["#{relative_path_to_source_dir}/*.ts"] })
|
|
45
|
-
.write
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def relative_path_to_source_dir
|
|
49
|
-
src_path_from_root = ScriptRepository.new.relative_path_to_src
|
|
50
|
-
Pathname.new(src_path_from_root).relative_path_from(test_dir)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def write_aspect_type_definitions_file
|
|
54
|
-
File.write("#{test_base}/#{ASPECT_DTS_FILENAME}", ASPECT_DTS_FILE_CONTENTS)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|