Skip to content

Commit 56665e5

Browse files
Fionoblevividviolet
authored andcommitted
Clean up POLARIS_UNIFIED flag
1 parent 0975852 commit 56665e5

File tree

5 files changed

+12
-147
lines changed

5 files changed

+12
-147
lines changed

packages/app/src/cli/prompts/init/init.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,6 @@ export const templates = {
5252
options: {
5353
javascript: {branch: 'javascript', label: 'JavaScript'},
5454
typescript: {branch: 'main', label: 'TypeScript'},
55-
...(process.env.POLARIS_UNIFIED && {
56-
javascriptPolarisEarlyAccess: {
57-
branch: 'polaris-docs-2025-js',
58-
label: 'JavaScript (Polaris Release Candidate)',
59-
},
60-
typescriptPolarisEarlyAccess: {
61-
branch: 'polaris-docs-2025',
62-
label: 'TypeScript (Polaris Release Candidate)',
63-
},
64-
}),
6555
},
6656
},
6757
} as Template,
Lines changed: 8 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import {fetchExtensionTemplates} from './fetch-template-specifications.js'
22
import {ExtensionFlavorValue} from './extension.js'
33
import {testDeveloperPlatformClient, testOrganizationApp} from '../../models/app/app.test-data.js'
4-
import {ExtensionFlavor} from '../../models/app/template.js'
5-
import {describe, expect, test, vi} from 'vitest'
6-
import * as experimentModule from '@shopify/cli-kit/node/is-polaris-unified-enabled'
7-
8-
vi.mock('@shopify/cli-kit/node/is-polaris-unified-enabled', () => ({
9-
isPolarisUnifiedEnabled: vi.fn().mockReturnValue(false),
10-
}))
4+
import {describe, expect, test} from 'vitest'
115

126
describe('fetchTemplateSpecifications', () => {
137
test('returns the remote specs', async () => {
@@ -34,12 +28,7 @@ describe('fetchTemplateSpecifications', () => {
3428
})
3529

3630
describe('ui_extension', () => {
37-
const preactFlavor: ExtensionFlavor = {
38-
name: 'Preact',
39-
value: 'preact' as ExtensionFlavorValue,
40-
}
41-
42-
const oldFlavors = [
31+
const allFlavors = [
4332
{
4433
name: 'JavaScript React',
4534
value: 'react' as ExtensionFlavorValue,
@@ -60,8 +49,11 @@ describe('fetchTemplateSpecifications', () => {
6049
value: 'typescript' as ExtensionFlavorValue,
6150
path: 'admin-action',
6251
},
52+
{
53+
name: 'Preact',
54+
value: 'preact' as ExtensionFlavorValue,
55+
},
6356
]
64-
const allFlavors = [...oldFlavors, preactFlavor]
6557

6658
async function getTemplates() {
6759
const {templates} = await fetchExtensionTemplates(
@@ -90,86 +82,12 @@ describe('fetchTemplateSpecifications', () => {
9082
return templates
9183
}
9284

93-
test('returns only the preact flavor when POLARIS_UNIFIED is enabled', async () => {
94-
// Given
95-
vi.spyOn(experimentModule, 'isPolarisUnifiedEnabled').mockReturnValueOnce(true)
96-
85+
test('includes all flavors', async () => {
9786
// When
9887
const templates = await getTemplates()
9988

10089
// Then
101-
expect(templates[0]!.supportedFlavors).toEqual([preactFlavor])
102-
})
103-
104-
test('excludes the preact flavor by default', async () => {
105-
// When
106-
const templates = await getTemplates()
107-
108-
// Then
109-
expect(templates[0]!.supportedFlavors).toEqual(oldFlavors)
110-
})
111-
112-
test('filter out templates that have no flavors available by default', async () => {
113-
// When
114-
const {templates} = await fetchExtensionTemplates(
115-
testDeveloperPlatformClient({
116-
templateSpecifications: () =>
117-
Promise.resolve({
118-
templates: [
119-
{
120-
identifier: 'ui_extension',
121-
name: 'UI Extension',
122-
defaultName: 'ui-extension',
123-
group: 'Merchant Admin',
124-
supportLinks: [],
125-
type: 'ui_extension',
126-
url: 'https://github.com/Shopify/extensions-templates',
127-
extensionPoints: [],
128-
supportedFlavors: [preactFlavor],
129-
},
130-
],
131-
groupOrder: [],
132-
}),
133-
}),
134-
testOrganizationApp(),
135-
['ui_extension'],
136-
)
137-
138-
// Then
139-
expect(templates).toEqual([])
140-
})
141-
142-
test('filter out templates that have no flavors available POLARIS_UNIFIED is enabled', async () => {
143-
// Given
144-
vi.spyOn(experimentModule, 'isPolarisUnifiedEnabled').mockReturnValueOnce(true)
145-
146-
// When
147-
const {templates} = await fetchExtensionTemplates(
148-
testDeveloperPlatformClient({
149-
templateSpecifications: () =>
150-
Promise.resolve({
151-
templates: [
152-
{
153-
identifier: 'ui_extension',
154-
name: 'UI Extension',
155-
defaultName: 'ui-extension',
156-
group: 'Merchant Admin',
157-
supportLinks: [],
158-
type: 'ui_extension',
159-
url: 'https://github.com/Shopify/extensions-templates',
160-
extensionPoints: [],
161-
supportedFlavors: oldFlavors,
162-
},
163-
],
164-
groupOrder: [],
165-
}),
166-
}),
167-
testOrganizationApp(),
168-
['ui_extension'],
169-
)
170-
171-
// Then
172-
expect(templates).toEqual([])
90+
expect(templates[0]!.supportedFlavors).toEqual(allFlavors)
17391
})
17492
})
17593
})

packages/app/src/cli/services/generate/fetch-template-specifications.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,18 @@
11
import {ExtensionTemplatesResult} from '../../models/app/template.js'
22
import {MinimalAppIdentifiers} from '../../models/organization.js'
33
import {DeveloperPlatformClient} from '../../utilities/developer-platform-client.js'
4-
import {isPolarisUnifiedEnabled} from '@shopify/cli-kit/node/is-polaris-unified-enabled'
54

65
export async function fetchExtensionTemplates(
76
developerPlatformClient: DeveloperPlatformClient,
87
app: MinimalAppIdentifiers,
98
availableSpecifications: string[],
109
): Promise<ExtensionTemplatesResult> {
1110
const {templates: remoteTemplates, groupOrder} = await developerPlatformClient.templateSpecifications(app)
12-
const polarisUnifiedEnabled = isPolarisUnifiedEnabled()
1311

14-
const filteredTemplates = remoteTemplates
15-
.filter(
16-
(template) =>
17-
availableSpecifications.includes(template.identifier) || availableSpecifications.includes(template.type),
18-
)
19-
.map((template) => {
20-
if (template.type === 'ui_extension') {
21-
return {
22-
...template,
23-
supportedFlavors: template.supportedFlavors.filter((flavor) =>
24-
polarisUnifiedEnabled ? flavor.value === 'preact' : flavor.value !== 'preact',
25-
),
26-
}
27-
}
28-
return template
29-
})
30-
.filter((template) => template.supportedFlavors.length > 0)
12+
const filteredTemplates = remoteTemplates.filter(
13+
(template) =>
14+
availableSpecifications.includes(template.identifier) || availableSpecifications.includes(template.type),
15+
)
3116

3217
return {
3318
templates: filteredTemplates,

packages/cli-kit/src/public/node/is-polaris-unified-enabled.test.ts

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

packages/cli-kit/src/public/node/is-polaris-unified-enabled.ts

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

0 commit comments

Comments
 (0)