Skip to content

Commit 6e73b3a

Browse files
Drop bundled Warp sample themes in favor of an explanatory empty state
Warp's preloaded themes live inside the Warp app binary, not on disk, so the sample fallback mostly duplicated Orca built-ins (Dracula, Gruvbox, Solarized) and imported static data into per-user settings. The import now returns a genuine empty result and the modal explains where Warp's built-in themes actually are, pointing at Orca's equivalents. Co-authored-by: Orca <[email protected]>
1 parent 18e1036 commit 6e73b3a

10 files changed

Lines changed: 43 additions & 209 deletions

File tree

src/main/warp-themes/bundled-themes.test.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/main/warp-themes/bundled-themes.ts

Lines changed: 0 additions & 104 deletions
This file was deleted.

src/main/warp-themes/index.test.ts

Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const statMock = vi.hoisted(() => vi.fn())
77
const getWarpThemeDirectoriesMock = vi.hoisted(() => vi.fn(() => ['/Users/alice/.warp/themes']))
88
const parseWarpThemeYamlWithTimeoutMock = vi.hoisted(() => vi.fn())
99
const showOpenDialogMock = vi.hoisted(() => vi.fn())
10-
const bundledThemesMock = vi.hoisted(() => [] as { label: string; content: string }[])
1110

1211
vi.mock('electron', () => ({
1312
BrowserWindow: { fromWebContents: vi.fn() },
@@ -28,11 +27,6 @@ vi.mock('./parser-runner', () => ({
2827
parseWarpThemeYamlWithTimeout: parseWarpThemeYamlWithTimeoutMock
2928
}))
3029

31-
vi.mock('./bundled-themes', () => ({
32-
BUNDLED_WARP_THEME_SOURCE_LABEL: 'Warp sample themes',
33-
BUNDLED_WARP_THEMES: bundledThemesMock
34-
}))
35-
3630
import { previewWarpThemeImport } from './index'
3731
import { parseWarpThemeYaml } from './parser'
3832
import type { Store } from '../persistence'
@@ -83,7 +77,6 @@ function mockStat(filePath: string) {
8377
describe('previewWarpThemeImport', () => {
8478
beforeEach(() => {
8579
vi.clearAllMocks()
86-
bundledThemesMock.length = 0
8780
getWarpThemeDirectoriesMock.mockReturnValue(['/Users/alice/.warp/themes'])
8881
statMock.mockImplementation(mockStat)
8982
readFileMock.mockResolvedValue(VALID_THEME)
@@ -104,34 +97,24 @@ describe('previewWarpThemeImport', () => {
10497
])
10598
})
10699

107-
it('shows bundled themes when no local Warp theme folder exists', async () => {
108-
bundledThemesMock.push({
109-
label: 'Warp Dark.yaml',
110-
content: VALID_THEME.replace('name: Duplicate', 'name: Warp Dark')
111-
})
100+
it('returns an empty errorless preview when no local Warp theme folder exists', async () => {
112101
statMock.mockImplementation(() => {
113102
throw new Error('missing local themes')
114103
})
115104

116105
const preview = await previewWarpThemeImport({} as Store, { kind: 'auto' })
117106

118-
expect(preview.found).toBe(true)
119-
expect(preview.sampleFallback).toBe(true)
120-
expect(preview.sourceLabel).toBe('Warp sample themes')
121-
expect(preview.themes).toHaveLength(1)
122-
expect(preview.themes[0]).toMatchObject({
123-
id: 'warp:warp-dark:warp-dark-yaml',
124-
name: 'Warp Dark',
125-
sourceLabel: 'Warp sample themes'
107+
expect(preview).toMatchObject({
108+
found: false,
109+
sourceLabel: 'Warp themes',
110+
themes: [],
111+
skippedFiles: []
126112
})
113+
expect(preview.error).toBeUndefined()
127114
expect(readFileMock).not.toHaveBeenCalled()
128115
})
129116

130-
it('does not show sample fallback for an empty readable local Warp theme folder', async () => {
131-
bundledThemesMock.push({
132-
label: 'Warp Dark.yaml',
133-
content: VALID_THEME.replace('name: Duplicate', 'name: Warp Dark')
134-
})
117+
it('returns an empty errorless preview for an empty readable local Warp theme folder', async () => {
135118
opendirMock.mockResolvedValue(mockDirectory([]))
136119

137120
const preview = await previewWarpThemeImport({} as Store, { kind: 'auto' })
@@ -140,41 +123,29 @@ describe('previewWarpThemeImport', () => {
140123
found: false,
141124
sourceLabel: 'Warp themes',
142125
themes: [],
143-
skippedFiles: [],
144-
error: 'No Warp theme files found.'
126+
skippedFiles: []
145127
})
146-
expect(preview.sampleFallback).toBeUndefined()
128+
expect(preview.error).toBeUndefined()
147129
expect(readFileMock).not.toHaveBeenCalled()
148130
})
149131

150-
it('shows sample fallback with bounded skips when local Warp folders are unreadable', async () => {
151-
bundledThemesMock.push({
152-
label: 'Warp Dark.yaml',
153-
content: VALID_THEME.replace('name: Duplicate', 'name: Warp Dark')
154-
})
132+
it('reports bounded skips when local Warp folders are unreadable', async () => {
155133
opendirMock.mockRejectedValue(
156134
new Error("EACCES: permission denied, scandir '/Users/alice/.warp/themes'")
157135
)
158136

159137
const preview = await previewWarpThemeImport({} as Store, { kind: 'auto' })
160138

161-
expect(preview.found).toBe(true)
162-
expect(preview.sampleFallback).toBe(true)
163-
expect(preview.sourceLabel).toBe('Warp sample themes')
139+
expect(preview.found).toBe(false)
140+
expect(preview.sourceLabel).toBe('Warp themes')
164141
expect(preview.skippedFiles).toEqual([{ label: 'themes', reason: 'Could not read folder.' }])
165-
expect(preview.themes[0]?.sourceLabel).toBe('Warp sample themes')
142+
expect(preview.themes).toEqual([])
166143
})
167144

168-
it('does not combine bundled themes with local auto-discovered themes', async () => {
169-
bundledThemesMock.push({
170-
label: 'Warp Dark.yaml',
171-
content: VALID_THEME.replace('name: Duplicate', 'name: Warp Dark')
172-
})
173-
145+
it('labels auto-discovered themes as local Warp themes', async () => {
174146
const preview = await previewWarpThemeImport({} as Store, { kind: 'auto' })
175147

176148
expect(preview.sourceLabel).toBe('Warp themes')
177-
expect(preview.sampleFallback).toBeUndefined()
178149
expect(preview.themes.map((theme) => theme.name)).toEqual(['Duplicate', 'Duplicate'])
179150
expect(preview.themes.map((theme) => theme.sourceLabel)).toEqual([
180151
'Local Warp themes',

0 commit comments

Comments
 (0)