shopify-cli 1.7.0 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +28 -0
- data/.rubocop_todo.yml +15 -2
- data/CHANGELOG.md +21 -0
- data/Gemfile.lock +14 -14
- data/README.md +2 -1
- data/dev.yml +3 -0
- data/lib/docgen/markdown.rb +1 -1
- data/lib/graphql/extension_create.graphql +17 -2
- data/lib/graphql/fetch_specifications.graphql +14 -0
- data/lib/project_types/extension/cli.rb +4 -10
- data/lib/project_types/extension/commands/create.rb +2 -2
- data/lib/project_types/extension/commands/extension_command.rb +10 -6
- data/lib/project_types/extension/commands/push.rb +2 -2
- data/lib/project_types/extension/commands/register.rb +6 -5
- data/lib/project_types/extension/commands/serve.rb +1 -7
- data/lib/project_types/extension/extension_project.rb +19 -4
- data/lib/project_types/extension/extension_project_keys.rb +2 -1
- data/lib/project_types/extension/features/argo.rb +18 -34
- data/lib/project_types/extension/features/argo_renderer_package.rb +47 -0
- data/lib/project_types/extension/features/argo_serve.rb +69 -0
- data/lib/project_types/extension/features/argo_setup.rb +1 -1
- data/lib/project_types/extension/forms/questions/ask_type.rb +16 -5
- data/lib/project_types/extension/messages/message_loading.rb +3 -1
- data/lib/project_types/extension/messages/messages.rb +6 -6
- data/lib/project_types/extension/models/registration.rb +1 -0
- data/lib/project_types/extension/models/specification.rb +6 -2
- data/lib/project_types/extension/models/specification_handlers/default.rb +9 -1
- data/lib/project_types/extension/models/specifications.rb +12 -1
- data/lib/project_types/extension/models/version.rb +1 -1
- data/lib/project_types/extension/tasks/configure_features.rb +3 -1
- data/lib/project_types/extension/tasks/converters/registration_converter.rb +2 -0
- data/lib/project_types/extension/tasks/fetch_specifications.rb +8 -28
- data/lib/project_types/node/commands/generate.rb +0 -22
- data/lib/project_types/node/forms/create.rb +10 -1
- data/lib/project_types/node/messages/messages.rb +5 -4
- data/lib/project_types/rails/forms/create.rb +11 -1
- data/lib/project_types/rails/messages/messages.rb +5 -4
- data/lib/project_types/script/cli.rb +7 -7
- data/lib/project_types/script/commands/create.rb +2 -7
- data/lib/project_types/script/commands/push.rb +3 -3
- data/lib/project_types/script/config/extension_points.yml +27 -10
- data/lib/project_types/script/errors.rb +0 -35
- data/lib/project_types/script/forms/create.rb +3 -14
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +5 -5
- data/lib/project_types/script/graphql/get_app_scripts.graphql +6 -0
- data/lib/project_types/script/graphql/script_service_proxy.graphql +1 -2
- data/lib/project_types/script/layers/application/create_script.rb +32 -22
- data/lib/project_types/script/layers/application/extension_points.rb +3 -2
- data/lib/project_types/script/layers/application/push_script.rb +6 -3
- data/lib/project_types/script/layers/domain/config_ui.rb +16 -0
- data/lib/project_types/script/layers/domain/errors.rb +16 -0
- data/lib/project_types/script/layers/domain/extension_point.rb +60 -45
- data/lib/project_types/script/layers/domain/metadata.rb +18 -25
- data/lib/project_types/script/layers/domain/push_package.rb +4 -4
- data/lib/project_types/script/layers/domain/script_project.rb +54 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +37 -8
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +5 -40
- data/lib/project_types/script/layers/infrastructure/errors.rb +50 -19
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +8 -9
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +1 -1
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +198 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +27 -66
- data/lib/project_types/script/messages/messages.rb +28 -51
- data/lib/project_types/script/tasks/ensure_env.rb +77 -0
- data/lib/project_types/script/ui/error_handler.rb +63 -47
- data/lib/shopify-cli/context.rb +28 -0
- data/lib/shopify-cli/js_system.rb +2 -2
- data/lib/shopify-cli/messages/messages.rb +3 -2
- data/lib/shopify-cli/method_object.rb +1 -1
- 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/result.rb +3 -3
- data/lib/shopify-cli/tasks/ensure_dev_store.rb +1 -1
- data/lib/shopify-cli/transform_data_structure.rb +2 -2
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +0 -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 +11 -10
- data/.travis.yml +0 -14
- data/lib/project_types/script/commands/disable.rb +0 -25
- data/lib/project_types/script/commands/enable.rb +0 -80
- data/lib/project_types/script/graphql/shop_script_delete.graphql +0 -14
- data/lib/project_types/script/graphql/shop_script_update_or_create.graphql +0 -28
- data/lib/project_types/script/layers/application/disable_script.rb +0 -21
- data/lib/project_types/script/layers/application/enable_script.rb +0 -23
- data/lib/project_types/script/script_project.rb +0 -85
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea41fa5cbfa0eb2bf575fe82111c6be56df6807ed7696e64acc741ef2fa2e6be
|
4
|
+
data.tar.gz: 899299251ed4b0a50b0c3a5c5ae55324ebd64e92fbb981da7d4a093df94d5596
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b757bbf4ef686593f3fe8fdf82da6c83468f40d04bc312476e2bea614d5f75e3d63afe097c149f3de34b35631032c096799f0728b12732dfbbb5bd3e5141384
|
7
|
+
data.tar.gz: 2059062ef9aff95cad44d2b4bcad442e2cf82636d6733c065bb83544ac4d0b8cef2a5de3c438d5f252a251fa0cf813b03fc064db407940e3469b476a26c35e0d
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
name: Ruby ${{ matrix.version }}
|
8
|
+
runs-on: macos-latest
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
version:
|
12
|
+
- 3.0.0
|
13
|
+
- 2.6.6
|
14
|
+
- 2.7.1
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
|
18
|
+
- name: Set up Ruby ${{ matrix.version }}
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.version }}
|
22
|
+
bundler-cache: true
|
23
|
+
|
24
|
+
- name: Install Dependencies
|
25
|
+
run: bundle install
|
26
|
+
|
27
|
+
- name: Run Tests
|
28
|
+
run: bundle exec rake
|
data/.rubocop_todo.yml
CHANGED
@@ -1,11 +1,24 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2021-04-08 18:25:36 UTC using RuboCop version 1.12.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 35
|
10
10
|
Minitest/MultipleAssertions:
|
11
11
|
Max: 9
|
12
|
+
|
13
|
+
# Offense count: 1
|
14
|
+
# Cop supports --auto-correct.
|
15
|
+
Style/PerlBackrefs:
|
16
|
+
Exclude:
|
17
|
+
- 'lib/docgen/markdown.rb'
|
18
|
+
|
19
|
+
# Offense count: 2
|
20
|
+
# Cop supports --auto-correct.
|
21
|
+
Style/RedundantBegin:
|
22
|
+
Exclude:
|
23
|
+
- 'lib/shopify-cli/shopifolk.rb'
|
24
|
+
- 'test/shopify-cli/tunnel_test.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,29 @@
|
|
1
1
|
Unreleased
|
2
2
|
------
|
3
3
|
|
4
|
+
Version 1.10.0
|
5
|
+
-------------
|
6
|
+
* Updating internal features in development
|
7
|
+
|
8
|
+
Version 1.9.1
|
9
|
+
-------------
|
10
|
+
* [1201](https://github.com/Shopify/shopify-app-cli/pull/1201) Determine Argo Renderer Dynamically. This fixes `shopify serve` and `shopify push` for extensions.
|
11
|
+
|
12
|
+
Version 1.9.0
|
13
|
+
-------------
|
14
|
+
* [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))
|
15
|
+
|
16
|
+
Version 1.8.0
|
17
|
+
-------------
|
18
|
+
* [1119](https://github.com/Shopify/shopify-app-cli/pull/1119): Enable guest serialization for scripts
|
19
|
+
|
20
|
+
Version 1.7.1
|
21
|
+
------
|
22
|
+
* Updating internal features in development
|
23
|
+
|
4
24
|
Version 1.7.0
|
5
25
|
-----
|
26
|
+
* [#1109](https://github.com/Shopify/shopify-app-cli/pull/1109): Abort app generation if name contains disallowed text.
|
6
27
|
* [#1075](https://github.com/Shopify/shopify-app-cli/pull/1075): Add support for kebab-case flags
|
7
28
|
|
8
29
|
Version 1.6.0
|
data/Gemfile.lock
CHANGED
@@ -4,7 +4,7 @@ GEM
|
|
4
4
|
addressable (2.7.0)
|
5
5
|
public_suffix (>= 2.0.2, < 5.0)
|
6
6
|
ansi (1.5.0)
|
7
|
-
ast (2.4.
|
7
|
+
ast (2.4.2)
|
8
8
|
builder (3.2.4)
|
9
9
|
byebug (11.1.3)
|
10
10
|
coderay (1.1.3)
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
ruby-progressbar
|
23
23
|
mocha (1.11.2)
|
24
24
|
parallel (1.20.1)
|
25
|
-
parser (
|
25
|
+
parser (3.0.1.0)
|
26
26
|
ast (~> 2.4.1)
|
27
27
|
pry (0.13.1)
|
28
28
|
coderay (~> 1.1)
|
@@ -33,26 +33,26 @@ GEM
|
|
33
33
|
public_suffix (4.0.6)
|
34
34
|
rainbow (3.0.0)
|
35
35
|
rake (13.0.1)
|
36
|
-
regexp_parser (1.
|
37
|
-
rexml (3.2.
|
38
|
-
rubocop (1.
|
36
|
+
regexp_parser (2.1.1)
|
37
|
+
rexml (3.2.5)
|
38
|
+
rubocop (1.12.1)
|
39
39
|
parallel (~> 1.10)
|
40
|
-
parser (>=
|
40
|
+
parser (>= 3.0.0.0)
|
41
41
|
rainbow (>= 2.2.2, < 4.0)
|
42
|
-
regexp_parser (>= 1.8)
|
42
|
+
regexp_parser (>= 1.8, < 3.0)
|
43
43
|
rexml
|
44
|
-
rubocop-ast (>= 1.
|
44
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
45
45
|
ruby-progressbar (~> 1.7)
|
46
|
-
unicode-display_width (>= 1.4.0, <
|
47
|
-
rubocop-ast (1.
|
46
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
47
|
+
rubocop-ast (1.4.1)
|
48
48
|
parser (>= 2.7.1.5)
|
49
49
|
rubocop-minitest (0.10.1)
|
50
50
|
rubocop (>= 0.87)
|
51
|
-
rubocop-shopify (
|
52
|
-
rubocop (~> 1.
|
53
|
-
ruby-progressbar (1.
|
51
|
+
rubocop-shopify (2.0.1)
|
52
|
+
rubocop (~> 1.11)
|
53
|
+
ruby-progressbar (1.11.0)
|
54
54
|
timecop (0.9.2)
|
55
|
-
unicode-display_width (
|
55
|
+
unicode-display_width (2.0.0)
|
56
56
|
webmock (3.9.3)
|
57
57
|
addressable (>= 2.3.6)
|
58
58
|
crack (>= 0.3.2)
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# [Shopify App CLI](https://shopify.dev/tools/cli)
|
2
2
|
|
3
|
-
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.md)
|
3
|
+
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.md)
|
4
|
+
[![Build Status](https://github.com/Shopify/shopify-app-cli/workflows/CI/badge.svg)](https://github.com/Shopify/shopify-app-cli/actions)
|
4
5
|
|
5
6
|
Shopify App CLI helps you build Shopify apps faster. It quickly generates Node.js and Ruby on Rails apps and automates many common development tasks.
|
6
7
|
|
data/dev.yml
CHANGED
data/lib/docgen/markdown.rb
CHANGED
@@ -1,7 +1,22 @@
|
|
1
|
-
mutation ExtensionCreate(
|
2
|
-
|
1
|
+
mutation ExtensionCreate(
|
2
|
+
$api_key: String!
|
3
|
+
$type: ExtensionType!
|
4
|
+
$title: String!
|
5
|
+
$config: JSON!
|
6
|
+
$extension_context: String
|
7
|
+
) {
|
8
|
+
extensionCreate(
|
9
|
+
input: {
|
10
|
+
apiKey: $api_key
|
11
|
+
type: $type
|
12
|
+
title: $title
|
13
|
+
config: $config
|
14
|
+
context: $extension_context
|
15
|
+
}
|
16
|
+
) {
|
3
17
|
extensionRegistration {
|
4
18
|
id
|
19
|
+
uuid
|
5
20
|
type
|
6
21
|
title
|
7
22
|
draftVersion {
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Extension
|
4
|
+
class PackageNotFound < RuntimeError; end
|
5
|
+
|
4
6
|
class Project < ShopifyCli::ProjectType
|
5
7
|
hidden_feature
|
6
8
|
title("App Extension")
|
@@ -57,6 +59,8 @@ module Extension
|
|
57
59
|
end
|
58
60
|
|
59
61
|
module Features
|
62
|
+
autoload :ArgoRendererPackage, Project.project_filepath("features/argo_renderer_package")
|
63
|
+
autoload :ArgoServe, Project.project_filepath("features/argo_serve")
|
60
64
|
autoload :ArgoSetup, Project.project_filepath("features/argo_setup")
|
61
65
|
autoload :ArgoSetupStep, Project.project_filepath("features/argo_setup_step")
|
62
66
|
autoload :ArgoSetupSteps, Project.project_filepath("features/argo_setup_steps")
|
@@ -81,14 +85,4 @@ module Extension
|
|
81
85
|
|
82
86
|
autoload :ExtensionProjectKeys, Project.project_filepath("extension_project_keys")
|
83
87
|
autoload :ExtensionProject, Project.project_filepath("extension_project")
|
84
|
-
|
85
|
-
def self.specifications
|
86
|
-
@specifications ||= Models::Specifications.new(
|
87
|
-
fetch_specifications: Tasks::FetchSpecifications
|
88
|
-
)
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.specifications=(specifications)
|
92
|
-
@specifications = specifications
|
93
|
-
end
|
94
88
|
end
|
@@ -38,8 +38,8 @@ module Extension
|
|
38
38
|
Usage: {{command:#{ShopifyCli::TOOL_NAME} create extension}}
|
39
39
|
Options:
|
40
40
|
{{command:--type=TYPE}} The type of extension you would like to create.
|
41
|
-
{{command:--name=NAME}} The name of your extension (50 characters)
|
42
|
-
{{command:--api-key=KEY}} The API key of your app
|
41
|
+
{{command:--name=NAME}} The name of your extension (50 characters).
|
42
|
+
{{command:--api-key=KEY}} The API key of your app.
|
43
43
|
HELP
|
44
44
|
end
|
45
45
|
|
@@ -8,15 +8,19 @@ module Extension
|
|
8
8
|
@project ||= ExtensionProject.current
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
@
|
13
|
-
identifier = project.
|
11
|
+
def specification_handler
|
12
|
+
@specification_handler ||= begin
|
13
|
+
identifier = project.specification_identifier
|
14
14
|
Models::LazySpecificationHandler.new(identifier) do
|
15
|
-
|
16
|
-
|
15
|
+
specifications = Models::Specifications.new(
|
16
|
+
fetch_specifications: Tasks::FetchSpecifications.new(api_key: project.app.api_key, context: @ctx)
|
17
|
+
)
|
18
|
+
|
19
|
+
unless specifications.valid?(identifier)
|
20
|
+
@ctx.abort(@ctx.message("errors.unknown_type", project.specification_identifier))
|
17
21
|
end
|
18
22
|
|
19
|
-
|
23
|
+
specifications[identifier]
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
@@ -59,8 +59,8 @@ module Extension
|
|
59
59
|
context: @ctx,
|
60
60
|
api_key: project.app.api_key,
|
61
61
|
registration_id: project.registration_id,
|
62
|
-
config:
|
63
|
-
extension_context:
|
62
|
+
config: specification_handler.config(@ctx),
|
63
|
+
extension_context: specification_handler.extension_context(@ctx)
|
64
64
|
)
|
65
65
|
end
|
66
66
|
end
|
@@ -12,7 +12,7 @@ module Extension
|
|
12
12
|
|
13
13
|
update_project_files(registration)
|
14
14
|
|
15
|
-
@ctx.puts(@ctx.message("register.success", project.title
|
15
|
+
@ctx.puts(@ctx.message("register.success", project.title))
|
16
16
|
@ctx.puts(@ctx.message("register.success_info"))
|
17
17
|
end
|
18
18
|
end
|
@@ -27,8 +27,8 @@ module Extension
|
|
27
27
|
private
|
28
28
|
|
29
29
|
def confirm_registration
|
30
|
-
@ctx.puts(@ctx.message("register.confirm_info",
|
31
|
-
CLI::UI::Prompt.confirm(@ctx.message("register.confirm_question"
|
30
|
+
@ctx.puts(@ctx.message("register.confirm_info", specification_handler.name))
|
31
|
+
CLI::UI::Prompt.confirm(@ctx.message("register.confirm_question"))
|
32
32
|
end
|
33
33
|
|
34
34
|
def register_extension
|
@@ -37,10 +37,10 @@ module Extension
|
|
37
37
|
Tasks::CreateExtension.call(
|
38
38
|
context: @ctx,
|
39
39
|
api_key: app.api_key,
|
40
|
-
type:
|
40
|
+
type: specification_handler.graphql_identifier,
|
41
41
|
title: project.title,
|
42
42
|
config: {},
|
43
|
-
extension_context:
|
43
|
+
extension_context: specification_handler.extension_context(@ctx)
|
44
44
|
)
|
45
45
|
end
|
46
46
|
|
@@ -50,6 +50,7 @@ module Extension
|
|
50
50
|
api_key: app.api_key,
|
51
51
|
api_secret: app.secret,
|
52
52
|
registration_id: registration.id,
|
53
|
+
registration_uuid: registration.uuid,
|
53
54
|
title: project.title
|
54
55
|
)
|
55
56
|
end
|
@@ -3,14 +3,8 @@
|
|
3
3
|
module Extension
|
4
4
|
module Commands
|
5
5
|
class Serve < ExtensionCommand
|
6
|
-
YARN_SERVE_COMMAND = %w(server)
|
7
|
-
NPM_SERVE_COMMAND = %w(run-script server)
|
8
|
-
|
9
6
|
def call(_args, _command_name)
|
10
|
-
|
11
|
-
success = ShopifyCli::JsSystem.call(@ctx, yarn: YARN_SERVE_COMMAND, npm: NPM_SERVE_COMMAND)
|
12
|
-
@ctx.abort(@ctx.message("serve.serve_failure_message")) unless success
|
13
|
-
end
|
7
|
+
specification_handler.serve(@ctx)
|
14
8
|
end
|
15
9
|
|
16
10
|
def self.help
|
@@ -9,20 +9,27 @@ module Extension
|
|
9
9
|
context,
|
10
10
|
project_type: :extension,
|
11
11
|
organization_id: nil,
|
12
|
-
"#{ExtensionProjectKeys::
|
12
|
+
"#{ExtensionProjectKeys::SPECIFICATION_IDENTIFIER_KEY}": type
|
13
13
|
)
|
14
14
|
end
|
15
15
|
|
16
|
-
def write_env_file(
|
16
|
+
def write_env_file(
|
17
|
+
context:, title:, api_key: "", api_secret: "", registration_id: nil, registration_uuid: nil
|
18
|
+
)
|
17
19
|
ShopifyCli::Resources::EnvFile.new(
|
18
20
|
api_key: api_key,
|
19
21
|
secret: api_secret,
|
20
22
|
extra: {
|
21
23
|
ExtensionProjectKeys::TITLE_KEY => title,
|
22
24
|
ExtensionProjectKeys::REGISTRATION_ID_KEY => registration_id,
|
25
|
+
ExtensionProjectKeys::REGISTRATION_UUID_KEY => registration_uuid || generate_temporary_uuid,
|
23
26
|
}.compact
|
24
27
|
).write(context)
|
25
28
|
|
29
|
+
reload
|
30
|
+
end
|
31
|
+
|
32
|
+
def reload
|
26
33
|
current.reload unless project_empty?
|
27
34
|
end
|
28
35
|
|
@@ -45,8 +52,8 @@ module Extension
|
|
45
52
|
get_extra_field(ExtensionProjectKeys::TITLE_KEY)
|
46
53
|
end
|
47
54
|
|
48
|
-
def
|
49
|
-
config[ExtensionProjectKeys::
|
55
|
+
def specification_identifier
|
56
|
+
config[ExtensionProjectKeys::SPECIFICATION_IDENTIFIER_KEY]
|
50
57
|
end
|
51
58
|
|
52
59
|
def registration_id?
|
@@ -59,10 +66,18 @@ module Extension
|
|
59
66
|
get_extra_field(ExtensionProjectKeys::REGISTRATION_ID_KEY).to_i
|
60
67
|
end
|
61
68
|
|
69
|
+
def registration_uuid
|
70
|
+
get_extra_field(ExtensionProjectKeys::REGISTRATION_UUID_KEY)
|
71
|
+
end
|
72
|
+
|
62
73
|
def reload
|
63
74
|
@env = nil
|
64
75
|
end
|
65
76
|
|
77
|
+
def self.generate_temporary_uuid
|
78
|
+
"dev-#{SecureRandom.uuid}"
|
79
|
+
end
|
80
|
+
|
66
81
|
private
|
67
82
|
|
68
83
|
def get_extra_field(key)
|
@@ -4,7 +4,8 @@ require "shopify_cli"
|
|
4
4
|
module Extension
|
5
5
|
module ExtensionProjectKeys
|
6
6
|
REGISTRATION_ID_KEY = "EXTENSION_ID"
|
7
|
-
|
7
|
+
REGISTRATION_UUID_KEY = "EXTENSION_UUID"
|
8
|
+
SPECIFICATION_IDENTIFIER_KEY = "EXTENSION_TYPE"
|
8
9
|
TITLE_KEY = "EXTENSION_TITLE"
|
9
10
|
end
|
10
11
|
end
|
@@ -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
|
@@ -47,45 +47,29 @@ module Extension
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
result = run_list_command(context)
|
54
|
-
found_version = find_version_number(context, result)
|
55
|
-
context.abort(
|
56
|
-
context.message("features.argo.dependencies.argo_renderer_package_invalid_version_error")
|
57
|
-
) if found_version.nil?
|
58
|
-
::Semantic::Version.new(found_version).to_s
|
59
|
-
rescue ArgumentError
|
50
|
+
def renderer_package(context)
|
51
|
+
Features::ArgoRendererPackage.from_package_manager(run_list_command(context))
|
52
|
+
rescue Extension::PackageNotFound
|
60
53
|
context.abort(
|
61
|
-
context.message("features.argo.dependencies.
|
54
|
+
context.message("features.argo.dependencies.argo_missing_renderer_package_error")
|
62
55
|
)
|
63
56
|
end
|
64
57
|
|
65
|
-
|
66
|
-
packages = result.to_json.split('\n')
|
67
|
-
found_package = packages.find do |package|
|
68
|
-
package.match(/#{renderer_package_name}@/)
|
69
|
-
end
|
70
|
-
if found_package.nil?
|
71
|
-
error = "'#{renderer_package_name}' not found."
|
72
|
-
context.abort(
|
73
|
-
context.message("features.argo.dependencies.argo_missing_renderer_package_error", error)
|
74
|
-
)
|
75
|
-
end
|
76
|
-
found_package.split("@")[2]&.strip
|
77
|
-
end
|
58
|
+
private
|
78
59
|
|
79
60
|
def run_list_command(context)
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
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,
|
84
68
|
capture_response: true
|
85
69
|
)
|
86
|
-
context.abort(
|
87
|
-
|
88
|
-
) unless status.success?
|
70
|
+
# context.abort(
|
71
|
+
# context.message("features.argo.dependencies.argo_missing_renderer_package_error", error)
|
72
|
+
# ) unless status.success?
|
89
73
|
result
|
90
74
|
end
|
91
75
|
|