@shopify/cli-kit 3.46.0-pre.1 → 3.46.0-pre.3

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.
Files changed (104) hide show
  1. package/assets/cli-ruby/Gemfile +1 -1
  2. package/assets/cli-ruby/lib/graphql/get_variant_id.graphql +1 -1
  3. package/assets/cli-ruby/lib/project_types/extension/commands/serve.rb +4 -0
  4. package/assets/cli-ruby/lib/project_types/extension/messages/messages.rb +13 -0
  5. package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +2 -0
  6. package/assets/cli-ruby/lib/project_types/theme/commands/serve.rb +1 -0
  7. package/assets/cli-ruby/lib/project_types/theme/messages/messages.rb +3 -0
  8. package/assets/cli-ruby/lib/shopify_cli/context.rb +16 -0
  9. package/assets/cli-ruby/lib/shopify_cli/shopifolk.rb +2 -1
  10. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hooks/file_change_hook.rb +5 -2
  11. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/local_assets.rb +6 -6
  12. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server.rb +11 -2
  13. package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hooks/file_change_hook.rb +5 -2
  14. package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server.rb +16 -4
  15. package/assets/cli-ruby/lib/shopify_cli/theme/notifier.rb +52 -0
  16. package/dist/private/node/constants.d.ts +7 -0
  17. package/dist/private/node/constants.js +7 -0
  18. package/dist/private/node/constants.js.map +1 -1
  19. package/dist/private/node/context/utilities.d.ts +14 -0
  20. package/dist/private/node/context/utilities.js +47 -0
  21. package/dist/private/node/context/utilities.js.map +1 -1
  22. package/dist/private/node/session.js +13 -2
  23. package/dist/private/node/session.js.map +1 -1
  24. package/dist/private/node/testing/ui.d.ts +29 -1
  25. package/dist/private/node/testing/ui.js +42 -2
  26. package/dist/private/node/testing/ui.js.map +1 -1
  27. package/dist/private/node/ui/components/Alert.test.js +1 -1
  28. package/dist/private/node/ui/components/Alert.test.js.map +1 -1
  29. package/dist/private/node/ui/components/AutocompletePrompt.js +3 -3
  30. package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -1
  31. package/dist/private/node/ui/components/AutocompletePrompt.test.js +4 -5
  32. package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -1
  33. package/dist/private/node/ui/components/Banner.test.js +1 -1
  34. package/dist/private/node/ui/components/Banner.test.js.map +1 -1
  35. package/dist/private/node/ui/components/Command.test.js +1 -1
  36. package/dist/private/node/ui/components/Command.test.js.map +1 -1
  37. package/dist/private/node/ui/components/ConcurrentOutput.js +9 -5
  38. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
  39. package/dist/private/node/ui/components/ConcurrentOutput.test.js +55 -8
  40. package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
  41. package/dist/private/node/ui/components/FatalError.test.js +1 -1
  42. package/dist/private/node/ui/components/FatalError.test.js.map +1 -1
  43. package/dist/private/node/ui/components/FilePath.test.js +1 -1
  44. package/dist/private/node/ui/components/FilePath.test.js.map +1 -1
  45. package/dist/private/node/ui/components/Link.js +2 -4
  46. package/dist/private/node/ui/components/Link.js.map +1 -1
  47. package/dist/private/node/ui/components/Link.test.js +42 -3
  48. package/dist/private/node/ui/components/Link.test.js.map +1 -1
  49. package/dist/private/node/ui/components/List.test.js +1 -1
  50. package/dist/private/node/ui/components/List.test.js.map +1 -1
  51. package/dist/private/node/ui/components/Prompts/InfoTable.test.js +1 -1
  52. package/dist/private/node/ui/components/Prompts/InfoTable.test.js.map +1 -1
  53. package/dist/private/node/ui/components/SelectInput.test.js +1 -2
  54. package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
  55. package/dist/private/node/ui/components/SelectPrompt.js +3 -3
  56. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
  57. package/dist/private/node/ui/components/SelectPrompt.test.js +4 -5
  58. package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -1
  59. package/dist/private/node/ui/components/Subdued.test.js +1 -1
  60. package/dist/private/node/ui/components/Subdued.test.js.map +1 -1
  61. package/dist/private/node/ui/components/Table/Table.test.js +1 -1
  62. package/dist/private/node/ui/components/Table/Table.test.js.map +1 -1
  63. package/dist/private/node/ui/components/Tasks.test.js +8 -22
  64. package/dist/private/node/ui/components/Tasks.test.js.map +1 -1
  65. package/dist/private/node/ui/components/TextAnimation.js +2 -2
  66. package/dist/private/node/ui/components/TextAnimation.js.map +1 -1
  67. package/dist/private/node/ui/components/TextInput.test.js +1 -2
  68. package/dist/private/node/ui/components/TextInput.test.js.map +1 -1
  69. package/dist/private/node/ui/components/TextPrompt.d.ts +1 -0
  70. package/dist/private/node/ui/components/TextPrompt.js +4 -2
  71. package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
  72. package/dist/private/node/ui/components/TextPrompt.test.js +25 -2
  73. package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -1
  74. package/dist/private/node/ui/components/TokenizedText.test.js +1 -1
  75. package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -1
  76. package/dist/private/node/ui/components/UserInput.test.js +1 -1
  77. package/dist/private/node/ui/components/UserInput.test.js.map +1 -1
  78. package/dist/private/node/ui/hooks/use-layout.js +2 -2
  79. package/dist/private/node/ui/hooks/use-layout.js.map +1 -1
  80. package/dist/private/node/ui.d.ts +2 -7
  81. package/dist/private/node/ui.js +3 -6
  82. package/dist/private/node/ui.js.map +1 -1
  83. package/dist/public/common/version.d.ts +1 -1
  84. package/dist/public/common/version.js +1 -1
  85. package/dist/public/common/version.js.map +1 -1
  86. package/dist/public/node/context/local.d.ts +5 -1
  87. package/dist/public/node/context/local.js +9 -2
  88. package/dist/public/node/context/local.js.map +1 -1
  89. package/dist/public/node/environment.d.ts +21 -0
  90. package/dist/public/node/environment.js +36 -1
  91. package/dist/public/node/environment.js.map +1 -1
  92. package/dist/public/node/mimes.d.ts +15 -0
  93. package/dist/public/node/mimes.js +22 -0
  94. package/dist/public/node/mimes.js.map +1 -0
  95. package/dist/public/node/ruby.js +3 -1
  96. package/dist/public/node/ruby.js.map +1 -1
  97. package/dist/public/node/system.d.ts +10 -0
  98. package/dist/public/node/system.js +12 -0
  99. package/dist/public/node/system.js.map +1 -1
  100. package/dist/public/node/ui.d.ts +1 -1
  101. package/dist/public/node/ui.js +12 -4
  102. package/dist/public/node/ui.js.map +1 -1
  103. package/dist/tsconfig.tsbuildinfo +1 -1
  104. package/package.json +6 -3
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
 
4
4
  gem "bugsnag", "~> 6.22"
5
5
  gem "listen", "~> 3.7.0"
6
- gem "theme-check", "~> 1.14.0"
6
+ gem "theme-check", "~> 1.15.0"
7
7
  gem "nokogiri", "~> 1.14.0"
8
8
 
9
9
  # None of these can actually be used in a development copy of dev
@@ -1,5 +1,5 @@
1
1
  query {
2
- products(first: 1) {
2
+ products(first: 1, query:"published_status:published") {
3
3
  edges {
4
4
  node {
5
5
  id
@@ -38,6 +38,7 @@ module Extension
38
38
  parser.on("--extension-type=EXTENSION_TYPE", "The type of the extension") do |extension_type|
39
39
  flags[:extension_type] = extension_type.gsub('"', "")
40
40
  end
41
+ parser.on("-n", "--notify=PATH") { |path| flags[:notify] = path }
41
42
  end
42
43
 
43
44
  class RuntimeConfiguration
@@ -54,6 +55,7 @@ module Extension
54
55
  property :registration_id, accepts: String, default: nil
55
56
  property :extension_title, accepts: String, default: nil
56
57
  property :extension_type, accepts: String, default: nil
58
+ property :notify, accepts: String, default: nil
57
59
  end
58
60
 
59
61
  def call(args, _command_name)
@@ -70,6 +72,7 @@ module Extension
70
72
  registration_id: options.flags[:registration_id],
71
73
  extension_title: options.flags[:extension_title],
72
74
  extension_type: options.flags[:extension_type],
75
+ notify: options.flags[:notify],
73
76
  )
74
77
 
75
78
  ShopifyCLI::Result
@@ -152,6 +155,7 @@ module Extension
152
155
  registration_id: runtime_configuration.registration_id,
153
156
  resource_url: runtime_configuration.resource_url,
154
157
  project: project,
158
+ notify: runtime_configuration.notify,
155
159
  )
156
160
  runtime_configuration
157
161
  end
@@ -123,6 +123,19 @@ module Extension
123
123
  Setup your theme app extension in the host theme:
124
124
  {{green:%s}}
125
125
 
126
+ Preview your theme app extension:
127
+ {{green:%s}}
128
+ PREVIEW_MESSAGE
129
+ preview_message_1p: <<~PREVIEW_MESSAGE,
130
+ Access Shopify Organization:
131
+ {{green:%s}}
132
+
133
+ Enable your theme app extension:
134
+ {{green:%s}}
135
+
136
+ Setup your theme app extension in the host theme:
137
+ {{green:%s}}
138
+
126
139
  Preview your theme app extension:
127
140
  {{green:%s}}
128
141
  PREVIEW_MESSAGE
@@ -77,12 +77,14 @@ module Extension
77
77
  @ctx = options[:context]
78
78
  root = options[:context]&.root
79
79
  project = options[:project]
80
+ notify = options[:notify]
80
81
  properties = options
81
82
  .slice(:port, :theme, :generate_tmp_theme)
82
83
  .compact
83
84
  .merge({
84
85
  project: project,
85
86
  specification_handler: self,
87
+ notify: notify,
86
88
  })
87
89
 
88
90
  ShopifyCLI::Theme::Extension::DevServer.start(@ctx, root, **properties)
@@ -36,6 +36,7 @@ module Theme
36
36
  end
37
37
  parser.on("-f", "--force") { flags[:force] = true }
38
38
  parser.on("--overwrite-json") { flags[:overwrite_json] = true }
39
+ parser.on("-n", "--notify=PATH") { |path| flags[:notify] = path }
39
40
  end
40
41
 
41
42
  def call(_args, name)
@@ -161,6 +161,9 @@ module Theme
161
161
  fixed: "Fixed",
162
162
  },
163
163
  },
164
+ notifier: {
165
+ error: "Error while notifying webhook {{blue:%s}}: %s",
166
+ },
164
167
  syncer: {
165
168
  forms: {
166
169
  apply_to_all: {
@@ -262,6 +262,22 @@ module ShopifyCLI
262
262
  File.binwrite(ctx_path(fname), content)
263
263
  end
264
264
 
265
+ # will update the Access and Modified times of a file, relative to the context root
266
+ # unless the file path is absolute.
267
+ #
268
+ # #### Parameters
269
+ # * `atime` - the access time
270
+ # * `mtime` - the modified time
271
+ # * `fname` - filename of the file that you are writing, relative to root unless it is absolute.
272
+ #
273
+ # #### Example
274
+ #
275
+ # @ctx.utime(Time.now, Time.now, '/tmp/file.txt')
276
+ #
277
+ def utime(atime, mtime, fname)
278
+ File.utime(atime, mtime, ctx_path(fname))
279
+ end
280
+
265
281
  # will change directories and update the root, the filepath is relative to the command root unless absolute
266
282
  #
267
283
  # #### Parameters
@@ -32,7 +32,8 @@ module ShopifyCLI
32
32
 
33
33
  def acting_as_shopify_organization?
34
34
  !!(DB.get(:acting_as_shopify_organization) ||
35
- (Project.has_current? && Project.current.config["shopify_organization"]))
35
+ (Project.has_current? && Project.current.config["shopify_organization"])) ||
36
+ ENV.fetch("SHOPIFY_CLI_1P_DEV", "0") == "1"
36
37
  end
37
38
 
38
39
  def reset
@@ -10,13 +10,14 @@ module ShopifyCLI
10
10
  class FileChangeHook
11
11
  include ShopifyCLI::Theme::IgnoreHelper
12
12
 
13
- attr_reader :include_filter, :ignore_filter
13
+ attr_reader :include_filter, :ignore_filter, :notifier
14
14
 
15
- def initialize(ctx, theme:, include_filter: nil, ignore_filter: nil)
15
+ def initialize(ctx, theme:, include_filter: nil, ignore_filter: nil, notifier: nil)
16
16
  @ctx = ctx
17
17
  @theme = theme
18
18
  @include_filter = include_filter
19
19
  @ignore_filter = ignore_filter
20
+ @notifier = notifier
20
21
  end
21
22
 
22
23
  def call(modified, added, removed, streams: nil)
@@ -34,6 +35,8 @@ module ShopifyCLI
34
35
 
35
36
  hot_reload(files) unless files.empty?
36
37
  remote_reload(liquid_css_files)
38
+
39
+ notifier.notify_updates(modified + added + removed) unless (modified + added + removed).empty?
37
40
  end
38
41
 
39
42
  private
@@ -5,6 +5,7 @@ module ShopifyCLI
5
5
  class DevServer
6
6
  class LocalAssets
7
7
  THEME_REGEX = %r{//cdn\.shopify\.com/s/.+?/(assets/.+?\.(?:css|js))}
8
+ VANITY_THEME_REGEX = %r{/cdn/shop/.+?/(assets/.+?\.(?:css|js))}
8
9
 
9
10
  class FileBody
10
11
  def initialize(path)
@@ -44,12 +45,11 @@ module ShopifyCLI
44
45
  private
45
46
 
46
47
  def replace_asset_urls(body)
47
- replaced_body = body.join.gsub(THEME_REGEX) do |match|
48
- path = Regexp.last_match[1]
49
- if @target.static_asset_paths.include?(path)
50
- "/#{path}"
51
- else
52
- match
48
+ replaced_body = body.join
49
+ [THEME_REGEX, VANITY_THEME_REGEX].each do |regex|
50
+ replaced_body = replaced_body.gsub(regex) do |match|
51
+ path = Regexp.last_match[1]
52
+ @target.static_asset_paths.include?(path) ? "/#{path}" : match
53
53
  end
54
54
  end
55
55
 
@@ -23,6 +23,7 @@ require_relative "development_theme"
23
23
  require_relative "ignore_filter"
24
24
  require_relative "include_filter"
25
25
  require_relative "syncer"
26
+ require_relative "notifier"
26
27
 
27
28
  module ShopifyCLI
28
29
  module Theme
@@ -30,7 +31,7 @@ module ShopifyCLI
30
31
  include Singleton
31
32
 
32
33
  attr_reader :app, :stopped, :ctx, :root, :host, :theme_identifier, :port, :poll, :editor_sync, :stable, :mode,
33
- :block, :includes, :ignores
34
+ :block, :includes, :ignores, :notify
34
35
 
35
36
  class << self
36
37
  def start(
@@ -46,6 +47,7 @@ module ShopifyCLI
46
47
  mode: ReloadMode.default,
47
48
  includes: nil,
48
49
  ignores: nil,
50
+ notify: nil,
49
51
  &block
50
52
  )
51
53
  instance.setup(
@@ -61,6 +63,7 @@ module ShopifyCLI
61
63
  mode,
62
64
  includes,
63
65
  ignores,
66
+ notify,
64
67
  &block
65
68
  )
66
69
  instance.start
@@ -85,6 +88,7 @@ module ShopifyCLI
85
88
  mode,
86
89
  includes,
87
90
  ignores,
91
+ notify,
88
92
  &block
89
93
  )
90
94
  @ctx = ctx
@@ -99,6 +103,7 @@ module ShopifyCLI
99
103
  @mode = mode
100
104
  @includes = includes
101
105
  @ignores = ignores
106
+ @notify = notify
102
107
  @block = block
103
108
  end
104
109
 
@@ -202,6 +207,10 @@ module ShopifyCLI
202
207
  )
203
208
  end
204
209
 
210
+ def notifier
211
+ @notifier ||= Notifier.new(ctx, path: notify)
212
+ end
213
+
205
214
  def watcher
206
215
  @watcher ||= Watcher.new(
207
216
  ctx,
@@ -248,7 +257,7 @@ module ShopifyCLI
248
257
 
249
258
  def broadcast_hooks
250
259
  file_handler = Hooks::FileChangeHook.new(ctx, theme: theme, include_filter: include_filter,
251
- ignore_filter: ignore_filter)
260
+ ignore_filter: ignore_filter, notifier: notifier)
252
261
  [file_handler]
253
262
  end
254
263
 
@@ -6,12 +6,13 @@ module ShopifyCLI
6
6
  class DevServer
7
7
  module Hooks
8
8
  class FileChangeHook
9
- attr_reader :ctx, :extension, :syncer, :streams
9
+ attr_reader :ctx, :extension, :syncer, :streams, :notifier
10
10
 
11
- def initialize(ctx, extension:, syncer:)
11
+ def initialize(ctx, extension:, syncer:, notifier:)
12
12
  @ctx = ctx
13
13
  @extension = extension
14
14
  @syncer = syncer
15
+ @notifier = notifier
15
16
  end
16
17
 
17
18
  def call(modified, added, removed, streams: nil)
@@ -23,6 +24,8 @@ module ShopifyCLI
23
24
 
24
25
  hot_reload(modified) unless modified.empty?
25
26
  reload_page(added, removed) unless (added + removed).empty?
27
+
28
+ notifier.notify_updates(modified + added + removed) unless (modified + added + removed).empty?
26
29
  end
27
30
 
28
31
  private
@@ -6,6 +6,7 @@ require "shopify_cli/theme/extension/app_extension"
6
6
  require "shopify_cli/theme/dev_server"
7
7
  require "shopify_cli/theme/extension/host_theme"
8
8
  require "shopify_cli/theme/syncer"
9
+ require "shopify_cli/theme/notifier"
9
10
 
10
11
  require_relative "dev_server/local_assets"
11
12
  require_relative "dev_server/proxy_param_builder"
@@ -29,12 +30,13 @@ module ShopifyCLI
29
30
  attr_accessor :project, :specification_handler, :generate_tmp_theme
30
31
 
31
32
  class << self
32
- def start(ctx, root, port: 9292, theme: nil, generate_tmp_theme: false, project:, specification_handler:)
33
+ def start(ctx, root, port: 9292, theme: nil, generate_tmp_theme: false, project:, specification_handler:,
34
+ notify: nil)
33
35
  instance.project = project
34
36
  instance.specification_handler = specification_handler
35
37
  instance.generate_tmp_theme = generate_tmp_theme
36
38
 
37
- super(ctx, root, port: port, theme: theme)
39
+ super(ctx, root, port: port, theme: theme, notify: notify)
38
40
  end
39
41
  end
40
42
 
@@ -65,6 +67,10 @@ module ShopifyCLI
65
67
  )
66
68
  end
67
69
 
70
+ def notifier
71
+ @notifier ||= ShopifyCLI::Theme::Notifier.new(ctx, path: notify)
72
+ end
73
+
68
74
  def theme
69
75
  @theme ||= if theme_identifier
70
76
  theme = HostTheme.find_by_identifier(ctx, identifier: theme_identifier)
@@ -130,7 +136,7 @@ module ShopifyCLI
130
136
  # Hooks
131
137
 
132
138
  def broadcast_hooks
133
- file_handler = Hooks::FileChangeHook.new(ctx, extension: extension, syncer: syncer)
139
+ file_handler = Hooks::FileChangeHook.new(ctx, extension: extension, syncer: syncer, notifier: notifier)
134
140
  [file_handler]
135
141
  end
136
142
 
@@ -145,7 +151,13 @@ module ShopifyCLI
145
151
  end
146
152
 
147
153
  def preview_message
148
- ctx.message("serve.preview_message", extension.location, theme.editor_url, address)
154
+ if Shopifolk.acting_as_shopify_organization?
155
+ parsed_uri = URI.parse(extension.location)
156
+ shopify_org_url = "#{parsed_uri.scheme}://#{parsed_uri.host}/9082/impersonate"
157
+ ctx.message("serve.preview_message_1p", shopify_org_url, extension.location, theme.editor_url, address)
158
+ else
159
+ ctx.message("serve.preview_message", extension.location, theme.editor_url, address)
160
+ end
149
161
  end
150
162
  end
151
163
  end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "uri"
4
+ require "net/http"
5
+
6
+ module ShopifyCLI
7
+ module Theme
8
+ class Notifier
9
+ attr_reader :ctx, :path
10
+
11
+ def initialize(ctx, path: nil)
12
+ @ctx = ctx
13
+ @path = path
14
+ end
15
+
16
+ def notify_updates(files)
17
+ return if path.nil? || path.empty? || !path.is_a?(String)
18
+
19
+ unless valid_url?(path)
20
+ return notify_file(path)
21
+ end
22
+
23
+ response = notify_url(files)
24
+
25
+ unless response.is_a?(Net::HTTPSuccess)
26
+ ctx.puts(ctx.message("theme.serve.notifier.error", path, response.message))
27
+ end
28
+
29
+ rescue => error
30
+ ctx.puts(ctx.message("theme.serve.notifier.error", path, error.message))
31
+ end
32
+
33
+ private
34
+
35
+ def notify_url(files)
36
+ Net::HTTP.post(URI(path), { "files" => files }.to_json, "Content-Type" => "application/json")
37
+ end
38
+
39
+ def notify_file(fname)
40
+ ctx.write(fname, "")
41
+ ctx.utime(Time.now, Time.now, fname)
42
+ end
43
+
44
+ def valid_url?(url)
45
+ uri = URI.parse(url)
46
+ uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS)
47
+ rescue URI::InvalidURIError
48
+ false
49
+ end
50
+ end
51
+ end
52
+ end
@@ -17,9 +17,16 @@ export declare const environmentVariables: {
17
17
  codespaceName: string;
18
18
  codespaces: string;
19
19
  gitpod: string;
20
+ cloudShell: string;
20
21
  spin: string;
21
22
  spinAppPort: string;
22
23
  spinAppHost: string;
24
+ organization: string;
25
+ identityToken: string;
26
+ refreshToken: string;
27
+ };
28
+ export declare const systemEnvironmentVariables: {
29
+ backendPort: string;
23
30
  };
24
31
  export declare const pathConstants: {
25
32
  executables: {
@@ -26,9 +26,16 @@ export const environmentVariables = {
26
26
  codespaceName: 'CODESPACE_NAME',
27
27
  codespaces: 'CODESPACES',
28
28
  gitpod: 'GITPOD_WORKSPACE_URL',
29
+ cloudShell: 'CLOUD_SHELL',
29
30
  spin: 'SPIN',
30
31
  spinAppPort: 'SERVER_PORT',
31
32
  spinAppHost: 'SPIN_APP_HOST',
33
+ organization: 'SHOPIFY_CLI_ORGANIZATION',
34
+ identityToken: 'SHOPIFY_CLI_IDENTITY_TOKEN',
35
+ refreshToken: 'SHOPIFY_CLI_REFRESH_TOKEN',
36
+ };
37
+ export const systemEnvironmentVariables = {
38
+ backendPort: 'BACKEND_PORT',
32
39
  };
33
40
  export const pathConstants = {
34
41
  executables: {
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/private/node/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,2BAA2B,CAAA;AAClD,OAAO,QAAQ,MAAM,WAAW,CAAA;AAEhC,MAAM,UAAU,GAAG,aAAa,CAAA;AAEhC,MAAM,WAAW,GAAG,GAAG,EAAE;IACvB,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAA;IACjE,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,CAAA;AACnC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,kBAAkB,EAAE,kCAAkC;IACtD,UAAU,EAAE,yBAAyB;IACrC,iBAAiB,EAAE,iCAAiC;IACpD,GAAG,EAAE,iBAAiB;IACtB,aAAa,EAAE,oBAAoB;IACnC,WAAW,EAAE,0BAA0B;IACvC,aAAa,EAAE,4BAA4B;IAC3C,SAAS,EAAE,qBAAqB;IAChC,UAAU,EAAE,qBAAqB;IACjC,eAAe,EAAE,+BAA+B;IAChD,YAAY,EAAE,eAAe;IAC7B,UAAU,EAAE,yBAAyB;IACrC,QAAQ,EAAE,mBAAmB;IAC7B,OAAO,EAAE,sBAAsB;IAC/B,aAAa,EAAE,4BAA4B;IAC3C,mEAAmE;IACnE,aAAa,EAAE,gBAAgB;IAC/B,UAAU,EAAE,YAAY;IACxB,MAAM,EAAE,sBAAsB;IAC9B,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,eAAe;CAC7B,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,WAAW,EAAE;QACX,GAAG,EAAE,kBAAkB;KACxB;IACD,WAAW,EAAE;QACX,KAAK,EAAE;YACL,IAAI,EAAE,GAAG,EAAE;gBACT,OAAO,WAAW,EAAE,CAAA;YACtB,CAAC;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,GAAG,EAAE;oBACT,OAAO,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,CAAC,CAAA;gBAC1C,CAAC;gBACD,QAAQ,EAAE,GAAG,EAAE;oBACb,OAAO,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;gBACtD,CAAC;aACF;SACF;KACF;CACF,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,OAAO,EAAE,aAAa;CACvB,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,6BAA6B,EAAE,CAAC;CACjC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,kCAAkC,CAAA","sourcesContent":["import {joinPath} from '../../public/node/path.js'\nimport envPaths from 'env-paths'\n\nconst identifier = 'shopify-cli'\n\nconst cacheFolder = () => {\n if (process.env.XDG_CACHE_HOME) return process.env.XDG_CACHE_HOME\n return envPaths(identifier).cache\n}\n\nexport const environmentVariables = {\n alwaysLogAnalytics: 'SHOPIFY_CLI_ALWAYS_LOG_ANALYTICS',\n deviceAuth: 'SHOPIFY_CLI_DEVICE_AUTH',\n enableCliRedirect: 'SHOPIFY_CLI_ENABLE_CLI_REDIRECT',\n env: 'SHOPIFY_CLI_ENV',\n firstPartyDev: 'SHOPIFY_CLI_1P_DEV',\n noAnalytics: 'SHOPIFY_CLI_NO_ANALYTICS',\n partnersToken: 'SHOPIFY_CLI_PARTNERS_TOKEN',\n runAsUser: 'SHOPIFY_RUN_AS_USER',\n serviceEnv: 'SHOPIFY_SERVICE_ENV',\n skipCliRedirect: 'SHOPIFY_CLI_SKIP_CLI_REDIRECT',\n spinInstance: 'SPIN_INSTANCE',\n themeToken: 'SHOPIFY_CLI_THEME_TOKEN',\n unitTest: 'SHOPIFY_UNIT_TEST',\n verbose: 'SHOPIFY_FLAG_VERBOSE',\n themeBundling: 'SHOPIFY_CLI_THEME_BUNDLING',\n // Variables to detect if the CLI is running in a cloud environment\n codespaceName: 'CODESPACE_NAME',\n codespaces: 'CODESPACES',\n gitpod: 'GITPOD_WORKSPACE_URL',\n spin: 'SPIN',\n spinAppPort: 'SERVER_PORT',\n spinAppHost: 'SPIN_APP_HOST',\n}\n\nexport const pathConstants = {\n executables: {\n dev: '/opt/dev/bin/dev',\n },\n directories: {\n cache: {\n path: () => {\n return cacheFolder()\n },\n vendor: {\n path: () => {\n return joinPath(cacheFolder(), 'vendor')\n },\n binaries: () => {\n return joinPath(cacheFolder(), 'vendor', 'binaries')\n },\n },\n },\n },\n}\n\nexport const keychainConstants = {\n service: 'shopify-cli',\n}\n\nexport const sessionConstants = {\n expirationTimeMarginInMinutes: 4,\n}\n\nexport const bugsnagApiKey = '9e1e6889176fd0c795d5c659225e0fae'\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/private/node/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,2BAA2B,CAAA;AAClD,OAAO,QAAQ,MAAM,WAAW,CAAA;AAEhC,MAAM,UAAU,GAAG,aAAa,CAAA;AAEhC,MAAM,WAAW,GAAG,GAAG,EAAE;IACvB,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAA;IACjE,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,CAAA;AACnC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,kBAAkB,EAAE,kCAAkC;IACtD,UAAU,EAAE,yBAAyB;IACrC,iBAAiB,EAAE,iCAAiC;IACpD,GAAG,EAAE,iBAAiB;IACtB,aAAa,EAAE,oBAAoB;IACnC,WAAW,EAAE,0BAA0B;IACvC,aAAa,EAAE,4BAA4B;IAC3C,SAAS,EAAE,qBAAqB;IAChC,UAAU,EAAE,qBAAqB;IACjC,eAAe,EAAE,+BAA+B;IAChD,YAAY,EAAE,eAAe;IAC7B,UAAU,EAAE,yBAAyB;IACrC,QAAQ,EAAE,mBAAmB;IAC7B,OAAO,EAAE,sBAAsB;IAC/B,aAAa,EAAE,4BAA4B;IAC3C,mEAAmE;IACnE,aAAa,EAAE,gBAAgB;IAC/B,UAAU,EAAE,YAAY;IACxB,MAAM,EAAE,sBAAsB;IAC9B,UAAU,EAAE,aAAa;IACzB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,eAAe;IAC5B,YAAY,EAAE,0BAA0B;IACxC,aAAa,EAAE,4BAA4B;IAC3C,YAAY,EAAE,2BAA2B;CAC1C,CAAA;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,WAAW,EAAE,cAAc;CAC5B,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,WAAW,EAAE;QACX,GAAG,EAAE,kBAAkB;KACxB;IACD,WAAW,EAAE;QACX,KAAK,EAAE;YACL,IAAI,EAAE,GAAG,EAAE;gBACT,OAAO,WAAW,EAAE,CAAA;YACtB,CAAC;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,GAAG,EAAE;oBACT,OAAO,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,CAAC,CAAA;gBAC1C,CAAC;gBACD,QAAQ,EAAE,GAAG,EAAE;oBACb,OAAO,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;gBACtD,CAAC;aACF;SACF;KACF;CACF,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,OAAO,EAAE,aAAa;CACvB,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,6BAA6B,EAAE,CAAC;CACjC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,kCAAkC,CAAA","sourcesContent":["import {joinPath} from '../../public/node/path.js'\nimport envPaths from 'env-paths'\n\nconst identifier = 'shopify-cli'\n\nconst cacheFolder = () => {\n if (process.env.XDG_CACHE_HOME) return process.env.XDG_CACHE_HOME\n return envPaths(identifier).cache\n}\n\nexport const environmentVariables = {\n alwaysLogAnalytics: 'SHOPIFY_CLI_ALWAYS_LOG_ANALYTICS',\n deviceAuth: 'SHOPIFY_CLI_DEVICE_AUTH',\n enableCliRedirect: 'SHOPIFY_CLI_ENABLE_CLI_REDIRECT',\n env: 'SHOPIFY_CLI_ENV',\n firstPartyDev: 'SHOPIFY_CLI_1P_DEV',\n noAnalytics: 'SHOPIFY_CLI_NO_ANALYTICS',\n partnersToken: 'SHOPIFY_CLI_PARTNERS_TOKEN',\n runAsUser: 'SHOPIFY_RUN_AS_USER',\n serviceEnv: 'SHOPIFY_SERVICE_ENV',\n skipCliRedirect: 'SHOPIFY_CLI_SKIP_CLI_REDIRECT',\n spinInstance: 'SPIN_INSTANCE',\n themeToken: 'SHOPIFY_CLI_THEME_TOKEN',\n unitTest: 'SHOPIFY_UNIT_TEST',\n verbose: 'SHOPIFY_FLAG_VERBOSE',\n themeBundling: 'SHOPIFY_CLI_THEME_BUNDLING',\n // Variables to detect if the CLI is running in a cloud environment\n codespaceName: 'CODESPACE_NAME',\n codespaces: 'CODESPACES',\n gitpod: 'GITPOD_WORKSPACE_URL',\n cloudShell: 'CLOUD_SHELL',\n spin: 'SPIN',\n spinAppPort: 'SERVER_PORT',\n spinAppHost: 'SPIN_APP_HOST',\n organization: 'SHOPIFY_CLI_ORGANIZATION',\n identityToken: 'SHOPIFY_CLI_IDENTITY_TOKEN',\n refreshToken: 'SHOPIFY_CLI_REFRESH_TOKEN',\n}\n\nexport const systemEnvironmentVariables = {\n backendPort: 'BACKEND_PORT',\n}\n\nexport const pathConstants = {\n executables: {\n dev: '/opt/dev/bin/dev',\n },\n directories: {\n cache: {\n path: () => {\n return cacheFolder()\n },\n vendor: {\n path: () => {\n return joinPath(cacheFolder(), 'vendor')\n },\n binaries: () => {\n return joinPath(cacheFolder(), 'vendor', 'binaries')\n },\n },\n },\n },\n}\n\nexport const keychainConstants = {\n service: 'shopify-cli',\n}\n\nexport const sessionConstants = {\n expirationTimeMarginInMinutes: 4,\n}\n\nexport const bugsnagApiKey = '9e1e6889176fd0c795d5c659225e0fae'\n"]}
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" resolution-mode="require"/>
1
2
  /**
2
3
  * Returns whether an environment variable value represents a truthy value.
3
4
  */
@@ -6,3 +7,16 @@ export declare function isTruthy(variable: string | undefined): boolean;
6
7
  * Returns whether an environment variable has been set and is non-empty
7
8
  */
8
9
  export declare function isSet(variable: string | undefined): boolean;
10
+ /**
11
+ * Returns an object with environment variables from the specified CI environment.
12
+ */
13
+ export declare function getCIMetadata(envName: string, envs: NodeJS.ProcessEnv): Metadata;
14
+ export interface Metadata {
15
+ actor?: string;
16
+ branch?: string;
17
+ build?: string;
18
+ commitMessage?: string;
19
+ commitSha?: string;
20
+ run?: string;
21
+ url?: string;
22
+ }
@@ -16,4 +16,51 @@ export function isSet(variable) {
16
16
  }
17
17
  return true;
18
18
  }
19
+ /**
20
+ * Returns an object with environment variables from the specified CI environment.
21
+ */
22
+ export function getCIMetadata(envName, envs) {
23
+ switch (envName) {
24
+ case 'bitbucket':
25
+ return {
26
+ actor: envs.BITBUCKET_COMMIT_AUTHOR,
27
+ branch: envs.BITBUCKET_BRANCH,
28
+ build: envs.BITBUCKET_BUILD_NUMBER,
29
+ commitSha: envs.BITBUCKET_COMMIT,
30
+ run: envs.BITBUCKET_BUILD_NUMBER,
31
+ url: envs.BITBUCKET_BUILD_URL,
32
+ };
33
+ case 'circleci':
34
+ return {
35
+ actor: envs.CIRCLE_USERNAME,
36
+ branch: envs.CIRCLE_BRANCH,
37
+ build: envs.CIRCLE_BUILD_NUM,
38
+ commitSha: envs.CIRCLE_SHA1,
39
+ run: envs.CIRCLE_WORKFLOW_ID,
40
+ url: envs.CIRCLE_BUILD_URL,
41
+ };
42
+ case 'github':
43
+ return {
44
+ actor: envs.GITHUB_ACTOR,
45
+ branch: envs.GITHUB_REF_NAME,
46
+ build: envs.GITHUB_RUN_ID,
47
+ commitMessage: envs.GITHUB_COMMIT_MESSAGE,
48
+ commitSha: envs.GITHUB_SHA,
49
+ run: envs.GITHUB_RUN_ID,
50
+ url: `${envs.GITHUB_SERVER_URL}${envs.GITHUB_REPOSITORY}/actions/runs/${envs.GITHUB_RUN_ID}`,
51
+ };
52
+ case 'gitlab':
53
+ return {
54
+ actor: envs.GITLAB_USER_LOGIN,
55
+ branch: envs.CI_COMMIT_REF_NAME,
56
+ build: envs.CI_PIPELINE_ID,
57
+ commitSha: envs.CI_COMMIT_SHA,
58
+ commitMessage: envs.CI_COMMIT_MESSAGE,
59
+ run: envs.CI_RUNNER_ID,
60
+ url: envs.CI_PROJECT_URL,
61
+ };
62
+ default:
63
+ return {};
64
+ }
65
+ }
19
66
  //# sourceMappingURL=utilities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../../../src/private/node/context/utilities.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,QAA4B;IACnD,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,KAAK,CAAA;KACb;IACD,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAC/D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,QAA4B;IAChD,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACpD,OAAO,KAAK,CAAA;KACb;IACD,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["/**\n * Returns whether an environment variable value represents a truthy value.\n */\nexport function isTruthy(variable: string | undefined): boolean {\n if (!variable) {\n return false\n }\n return ['1', 'true', 'TRUE', 'yes', 'YES'].includes(variable)\n}\n\n/**\n * Returns whether an environment variable has been set and is non-empty\n */\nexport function isSet(variable: string | undefined): boolean {\n if (variable === undefined || variable.trim() === '') {\n return false\n }\n return true\n}\n"]}
1
+ {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../../../../src/private/node/context/utilities.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,QAA4B;IACnD,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,KAAK,CAAA;KACb;IACD,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAC/D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,QAA4B;IAChD,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACpD,OAAO,KAAK,CAAA;KACb;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,IAAuB;IACpE,QAAQ,OAAO,EAAE;QACf,KAAK,WAAW;YACd,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,uBAAuB;gBACnC,MAAM,EAAE,IAAI,CAAC,gBAAgB;gBAC7B,KAAK,EAAE,IAAI,CAAC,sBAAsB;gBAClC,SAAS,EAAE,IAAI,CAAC,gBAAgB;gBAChC,GAAG,EAAE,IAAI,CAAC,sBAAsB;gBAChC,GAAG,EAAE,IAAI,CAAC,mBAAmB;aAC9B,CAAA;QACH,KAAK,UAAU;YACb,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,eAAe;gBAC3B,MAAM,EAAE,IAAI,CAAC,aAAa;gBAC1B,KAAK,EAAE,IAAI,CAAC,gBAAgB;gBAC5B,SAAS,EAAE,IAAI,CAAC,WAAW;gBAC3B,GAAG,EAAE,IAAI,CAAC,kBAAkB;gBAC5B,GAAG,EAAE,IAAI,CAAC,gBAAgB;aAC3B,CAAA;QACH,KAAK,QAAQ;YACX,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,YAAY;gBACxB,MAAM,EAAE,IAAI,CAAC,eAAe;gBAC5B,KAAK,EAAE,IAAI,CAAC,aAAa;gBACzB,aAAa,EAAE,IAAI,CAAC,qBAAqB;gBACzC,SAAS,EAAE,IAAI,CAAC,UAAU;gBAC1B,GAAG,EAAE,IAAI,CAAC,aAAa;gBACvB,GAAG,EAAE,GAAG,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,iBAAiB,IAAI,CAAC,aAAa,EAAE;aAC7F,CAAA;QACH,KAAK,QAAQ;YACX,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,iBAAiB;gBAC7B,MAAM,EAAE,IAAI,CAAC,kBAAkB;gBAC/B,KAAK,EAAE,IAAI,CAAC,cAAc;gBAC1B,SAAS,EAAE,IAAI,CAAC,aAAa;gBAC7B,aAAa,EAAE,IAAI,CAAC,iBAAiB;gBACrC,GAAG,EAAE,IAAI,CAAC,YAAY;gBACtB,GAAG,EAAE,IAAI,CAAC,cAAc;aACzB,CAAA;QACH;YACE,OAAO,EAAE,CAAA;KACZ;AACH,CAAC","sourcesContent":["/**\n * Returns whether an environment variable value represents a truthy value.\n */\nexport function isTruthy(variable: string | undefined): boolean {\n if (!variable) {\n return false\n }\n return ['1', 'true', 'TRUE', 'yes', 'YES'].includes(variable)\n}\n\n/**\n * Returns whether an environment variable has been set and is non-empty\n */\nexport function isSet(variable: string | undefined): boolean {\n if (variable === undefined || variable.trim() === '') {\n return false\n }\n return true\n}\n\n/**\n * Returns an object with environment variables from the specified CI environment.\n */\nexport function getCIMetadata(envName: string, envs: NodeJS.ProcessEnv): Metadata {\n switch (envName) {\n case 'bitbucket':\n return {\n actor: envs.BITBUCKET_COMMIT_AUTHOR,\n branch: envs.BITBUCKET_BRANCH,\n build: envs.BITBUCKET_BUILD_NUMBER,\n commitSha: envs.BITBUCKET_COMMIT,\n run: envs.BITBUCKET_BUILD_NUMBER,\n url: envs.BITBUCKET_BUILD_URL,\n }\n case 'circleci':\n return {\n actor: envs.CIRCLE_USERNAME,\n branch: envs.CIRCLE_BRANCH,\n build: envs.CIRCLE_BUILD_NUM,\n commitSha: envs.CIRCLE_SHA1,\n run: envs.CIRCLE_WORKFLOW_ID,\n url: envs.CIRCLE_BUILD_URL,\n }\n case 'github':\n return {\n actor: envs.GITHUB_ACTOR,\n branch: envs.GITHUB_REF_NAME,\n build: envs.GITHUB_RUN_ID,\n commitMessage: envs.GITHUB_COMMIT_MESSAGE,\n commitSha: envs.GITHUB_SHA,\n run: envs.GITHUB_RUN_ID,\n url: `${envs.GITHUB_SERVER_URL}${envs.GITHUB_REPOSITORY}/actions/runs/${envs.GITHUB_RUN_ID}`,\n }\n case 'gitlab':\n return {\n actor: envs.GITLAB_USER_LOGIN,\n branch: envs.CI_COMMIT_REF_NAME,\n build: envs.CI_PIPELINE_ID,\n commitSha: envs.CI_COMMIT_SHA,\n commitMessage: envs.CI_COMMIT_MESSAGE,\n run: envs.CI_RUNNER_ID,\n url: envs.CI_PROJECT_URL,\n }\n default:\n return {}\n }\n}\n\nexport interface Metadata {\n actor?: string\n branch?: string\n build?: string\n commitMessage?: string\n commitSha?: string\n run?: string\n url?: string\n}\n"]}
@@ -13,7 +13,7 @@ import { partnersRequest } from '../../public/node/api/partners.js';
13
13
  import { normalizeStoreFqdn, partnersFqdn, identityFqdn } from '../../public/node/context/fqdn.js';
14
14
  import { openURL } from '../../public/node/system.js';
15
15
  import { keypress } from '../../public/node/ui.js';
16
- import { getPartnersToken } from '../../public/node/environment.js';
16
+ import { getIdentityTokenInformation, getPartnersToken } from '../../public/node/environment.js';
17
17
  import { gql } from 'graphql-request';
18
18
  import { outputCompleted, outputInfo, outputWarn } from '@shopify/cli-kit/node/output';
19
19
  /**
@@ -95,7 +95,11 @@ async function executeCompleteFlow(applications, identityFqdn) {
95
95
  scopes.push('employee');
96
96
  }
97
97
  let identityToken;
98
- if (useDeviceAuth()) {
98
+ const identityTokenInformation = getIdentityTokenInformation();
99
+ if (identityTokenInformation) {
100
+ identityToken = buildIdentityTokenFromEnv(scopes, identityTokenInformation);
101
+ }
102
+ else if (useDeviceAuth()) {
99
103
  // Request a device code to authorize without a browser redirect.
100
104
  outputDebug(outputContent `Requesting device authorization code...`);
101
105
  const deviceAuth = await requestDeviceAuthorization(scopes);
@@ -256,4 +260,11 @@ function getExchangeScopes(apps) {
256
260
  storefront: apiScopes('storefront-renderer', storefrontScopes),
257
261
  };
258
262
  }
263
+ function buildIdentityTokenFromEnv(scopes, identityTokenInformation) {
264
+ return {
265
+ ...identityTokenInformation,
266
+ expiresAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000),
267
+ scopes,
268
+ };
269
+ }
259
270
  //# sourceMappingURL=session.js.map