@@ -2,13 +2,10 @@ import {getDevelopmentTheme, getThemeStore} from './local-storage.js'
22import { findOrSelectTheme } from '../utilities/theme-selector.js'
33import { DevelopmentThemeManager } from '../utilities/development-theme-manager.js'
44import { platformAndArch } from '@shopify/cli-kit/node/os'
5- import { checkForNewVersion } from '@shopify/cli-kit/node/node-package-manager'
65import { themeEditorUrl , themePreviewUrl } from '@shopify/cli-kit/node/themes/urls'
76import { Theme } from '@shopify/cli-kit/node/themes/types'
87import { AdminSession } from '@shopify/cli-kit/node/session'
9- import { linesToColumns } from '@shopify/cli-kit/common/string'
10- import { OutputMessage , formatSection } from '@shopify/cli-kit/node/output'
11- import { getOutputUpdateCLIReminder } from '@shopify/cli-kit/node/upgrade'
8+ import { AlertCustomSection , InlineToken } from '@shopify/cli-kit/node/ui'
129
1310interface ThemeInfo {
1411 theme : {
@@ -58,40 +55,32 @@ export async function fetchThemeInfo(
5855 return theme ? themeInfoJSON ( theme , adminSession ) : undefined
5956}
6057
61- export async function fetchDevInfo ( config : { cliVersion : string } ) : Promise < OutputMessage > {
62- const sections : [ string , string ] [ ] = [ devConfigSection ( ) , await systemInfoSection ( config ) ]
63- const message = sections . map ( ( sectionContents ) => formatSection ( ...sectionContents ) ) . join ( '\n\n' )
64- return message
58+ export async function fetchDevInfo ( config : { cliVersion : string } ) : Promise < AlertCustomSection [ ] > {
59+ return [ devConfigSection ( ) , await systemInfoSection ( config ) ]
6560}
6661
67- function devConfigSection ( ) : [ string , string ] {
68- const title = 'Theme Configuration'
62+ function devConfigSection ( ) : AlertCustomSection {
6963 const store = getThemeStore ( ) || 'Not configured'
70- let developmentTheme = getDevelopmentTheme ( )
71- developmentTheme = developmentTheme ? `#${ developmentTheme } ` : 'Not set'
72- const lines : string [ ] [ ] = [
64+ const developmentTheme = getDevelopmentTheme ( )
65+ return tabularSection ( 'Theme Configuration' , [
7366 [ 'Store' , store ] ,
74- [ 'Development Theme ID' , developmentTheme ] ,
75- ]
76- return [ title , linesToColumns ( lines ) ]
67+ [ 'Development Theme ID' , developmentTheme ? `#${ developmentTheme } ` : { subdued : 'Not set' } ] ,
68+ ] )
7769}
7870
79- async function systemInfoSection ( config : { cliVersion : string } ) : Promise < [ string , string ] > {
80- const title = 'Tooling and System'
71+ async function systemInfoSection ( config : { cliVersion : string } ) : Promise < AlertCustomSection > {
8172 const { platform, arch} = platformAndArch ( )
82- const lines : string [ ] [ ] = [
83- [ 'Shopify CLI' , await cliVersionInfo ( config ) ] ,
73+ return tabularSection ( 'Tooling and System' , [
74+ [ 'Shopify CLI' , config . cliVersion ] ,
8475 [ 'OS' , `${ platform } -${ arch } ` ] ,
8576 [ 'Shell' , process . env . SHELL || 'unknown' ] ,
8677 [ 'Node version' , process . version ] ,
87- ]
88- return [ title , linesToColumns ( lines ) ]
78+ ] )
8979}
9080
91- async function cliVersionInfo ( config : { cliVersion : string } ) : Promise < string > {
92- const dependency = '@shopify/cli'
93- const newestVersion = await checkForNewVersion ( dependency , config . cliVersion )
94- if ( ! newestVersion ) return config . cliVersion
95- const upgradeMessage = getOutputUpdateCLIReminder ( newestVersion )
96- return [ config . cliVersion , upgradeMessage ] . join ( ' ' ) . trim ( )
81+ function tabularSection ( title : string , data : InlineToken [ ] [ ] ) : AlertCustomSection {
82+ return {
83+ title,
84+ body : { tabularData : data , firstColumnSubdued : true } ,
85+ }
9786}
0 commit comments