shopify-cli 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/docs/_config.yml +3 -0
  4. data/docs/_data/nav.yml +9 -0
  5. data/docs/getting-started/index.md +5 -40
  6. data/docs/getting-started/install/index.md +39 -0
  7. data/docs/getting-started/migrate/index.md +63 -0
  8. data/docs/getting-started/uninstall/index.md +37 -0
  9. data/docs/getting-started/upgrade/index.md +37 -0
  10. data/docs/index.md +5 -6
  11. data/lib/project_types/extension/cli.rb +2 -1
  12. data/lib/project_types/extension/commands/tunnel.rb +1 -1
  13. data/lib/project_types/extension/forms/register.rb +2 -3
  14. data/lib/project_types/extension/graphql/get_app_by_api_key.graphql +9 -0
  15. data/lib/project_types/extension/tasks/converters/app_converter.rb +27 -0
  16. data/lib/project_types/extension/tasks/get_app.rb +22 -0
  17. data/lib/project_types/extension/tasks/get_apps.rb +1 -6
  18. data/lib/project_types/script/cli.rb +3 -2
  19. data/lib/project_types/script/commands/create.rb +5 -4
  20. data/lib/project_types/script/errors.rb +1 -0
  21. data/lib/project_types/script/forms/create.rb +8 -4
  22. data/lib/project_types/script/layers/application/create_script.rb +11 -18
  23. data/lib/project_types/script/layers/application/project_dependencies.rb +0 -5
  24. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +106 -0
  25. data/lib/project_types/script/layers/infrastructure/errors.rb +1 -1
  26. data/lib/project_types/script/layers/infrastructure/project_creator.rb +23 -0
  27. data/lib/project_types/script/layers/infrastructure/script_repository.rb +0 -33
  28. data/lib/project_types/script/messages/messages.rb +5 -6
  29. data/lib/project_types/script/templates/ts/as-pect.d.ts +1 -0
  30. data/lib/project_types/script/ui/error_handler.rb +5 -0
  31. data/lib/shopify-cli/tunnel.rb +33 -1
  32. data/lib/shopify-cli/version.rb +1 -1
  33. data/vendor/deps/cli-ui/REVISION +1 -1
  34. data/vendor/deps/cli-ui/lib/cli/ui.rb +52 -11
  35. data/vendor/deps/cli-ui/lib/cli/ui/color.rb +11 -7
  36. data/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +34 -21
  37. data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +107 -149
  38. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +99 -0
  39. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +119 -0
  40. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +158 -0
  41. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +112 -0
  42. data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +9 -15
  43. data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +47 -0
  44. data/vendor/deps/cli-ui/lib/cli/ui/progress.rb +9 -7
  45. data/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +39 -14
  46. data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +62 -44
  47. data/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +7 -2
  48. data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +23 -3
  49. data/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +34 -10
  50. data/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +12 -7
  51. data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +26 -16
  52. data/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +3 -3
  53. data/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +75 -0
  54. data/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +27 -0
  55. data/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +61 -0
  56. metadata +20 -7
  57. data/lib/project_types/extension/features/tunnel_url.rb +0 -20
  58. data/lib/project_types/script/layers/infrastructure/assemblyscript_dependency_manager.rb +0 -51
  59. data/lib/project_types/script/layers/infrastructure/dependency_manager.rb +0 -36
  60. data/lib/project_types/script/layers/infrastructure/test_suite_repository.rb +0 -62
  61. 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,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
@@ -1,15 +0,0 @@
1
- require 'cli/ui'
2
-
3
- module CLI
4
- module UI
5
- module Box
6
- module Heavy
7
- VERT = '┃'
8
- HORZ = '━'
9
- DIV = "┣"
10
- TL = '┏'
11
- BL = '┗'
12
- end
13
- end
14
- end
15
- end