Skip to content

Commit 0db0b06

Browse files
committed
Refactor for consistency and brevity
1 parent 6d3a4c7 commit 0db0b06

File tree

1 file changed

+16
-21
lines changed
  • packages/theme/src/cli/services

1 file changed

+16
-21
lines changed

packages/theme/src/cli/services/info.ts

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {platformAndArch} from '@shopify/cli-kit/node/os'
55
import {themeEditorUrl, themePreviewUrl} from '@shopify/cli-kit/node/themes/urls'
66
import {Theme} from '@shopify/cli-kit/node/themes/types'
77
import {AdminSession} from '@shopify/cli-kit/node/session'
8-
import {AlertCustomSection} from '@shopify/cli-kit/node/ui'
8+
import {AlertCustomSection, InlineToken} from '@shopify/cli-kit/node/ui'
99

1010
interface ThemeInfo {
1111
theme: {
@@ -62,30 +62,25 @@ export async function fetchDevInfo(config: {cliVersion: string}): Promise<AlertC
6262
function devConfigSection(): AlertCustomSection {
6363
const store = getThemeStore() || 'Not configured'
6464
const developmentTheme = getDevelopmentTheme()
65-
return {
66-
title: 'Theme Configuration',
67-
body: {
68-
tabularData: [
69-
['Store', store],
70-
['Development Theme ID', developmentTheme ? `#${developmentTheme}` : {subdued: 'Not set'}],
71-
],
72-
firstColumnSubdued: true,
73-
},
74-
}
65+
return tabularSection('Theme Configuration', [
66+
['Store', store],
67+
['Development Theme ID', developmentTheme ? `#${developmentTheme}` : {subdued: 'Not set'}],
68+
])
7569
}
7670

7771
async function systemInfoSection(config: {cliVersion: string}): Promise<AlertCustomSection> {
7872
const {platform, arch} = platformAndArch()
73+
return tabularSection('Tooling and System', [
74+
['Shopify CLI', config.cliVersion],
75+
['OS', `${platform}-${arch}`],
76+
['Shell', process.env.SHELL || 'unknown'],
77+
['Node version', process.version],
78+
])
79+
}
80+
81+
function tabularSection(title: string, data: InlineToken[][]): AlertCustomSection {
7982
return {
80-
title: 'Tooling and System',
81-
body: {
82-
tabularData: [
83-
['Shopify CLI', config.cliVersion],
84-
['OS', `${platform}-${arch}`],
85-
['Shell', process.env.SHELL || 'unknown'],
86-
['Node version', process.version],
87-
],
88-
firstColumnSubdued: true,
89-
},
83+
title,
84+
body: {tabularData: data, firstColumnSubdued: true},
9085
}
9186
}

0 commit comments

Comments
 (0)