Skip to content

Commit 3e6f51a

Browse files
[WIP] Release the React Router template
1 parent e102716 commit 3e6f51a

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ describe('init', () => {
2828
// Then
2929
expect(renderSelectPrompt).toHaveBeenCalledWith({
3030
choices: [
31-
{label: 'Build a Remix app (recommended)', value: 'remix'},
31+
{label: 'Build a React Router app (recommended)', value: 'reactRouter'},
3232
{label: 'Build an extension-only app', value: 'none'},
3333
],
3434
message: 'Get started building your app:',
35-
defaultValue: 'remix',
35+
defaultValue: 'reactRouter',
3636
})
3737
expect(got).toEqual({...options, ...answers, templateType: 'none', globalCLIResult})
3838
})
3939

4040
test('it renders branches for templates that have them', async () => {
4141
const answers = {
42-
template: 'https://github.com/Shopify/shopify-app-template-remix#javascript',
42+
template: 'https://github.com/Shopify/shopify-app-template-react-router#javascript',
4343
}
4444
const options: InitOptions = {}
4545

4646
// Given
47-
vi.mocked(renderSelectPrompt).mockResolvedValueOnce('remix')
47+
vi.mocked(renderSelectPrompt).mockResolvedValueOnce('reactRouter')
4848
vi.mocked(renderSelectPrompt).mockResolvedValueOnce('javascript')
4949

5050
// When
@@ -53,19 +53,19 @@ describe('init', () => {
5353
// Then
5454
expect(renderSelectPrompt).toHaveBeenCalledWith({
5555
choices: [
56-
{label: 'Build a Remix app (recommended)', value: 'remix'},
56+
{label: 'Build a React Router app (recommended)', value: 'reactRouter'},
5757
{label: 'Build an extension-only app', value: 'none'},
5858
],
5959
message: 'Get started building your app:',
60-
defaultValue: 'remix',
60+
defaultValue: 'reactRouter',
6161
})
6262
expect(renderSelectPrompt).toHaveBeenCalledWith({
6363
choices: [
6464
{label: 'JavaScript', value: 'javascript'},
6565
{label: 'TypeScript', value: 'main'},
6666
],
67-
message: 'For your Remix template, which language do you want?',
67+
message: 'For your React Router template, which language do you want?',
6868
})
69-
expect(got).toEqual({...options, ...answers, templateType: 'remix', globalCLIResult})
69+
expect(got).toEqual({...options, ...answers, templateType: 'reactRouter', globalCLIResult})
7070
})
7171
})

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,22 @@ interface Template {
3131
// Eventually this list should be taken from a remote location
3232
// That way we don't have to update the CLI every time we add a template
3333
export const templates = {
34+
reactRouter: {
35+
url: 'https://github.com/Shopify/shopify-app-template-react-router',
36+
label: 'Build a React Router app (recommended)',
37+
visible: true,
38+
branches: {
39+
prompt: 'For your React Router template, which language do you want?',
40+
options: {
41+
javascript: {branch: 'javascript', label: 'JavaScript'},
42+
typescript: {branch: 'main', label: 'TypeScript'},
43+
},
44+
},
45+
} as Template,
3446
remix: {
3547
url: 'https://github.com/Shopify/shopify-app-template-remix',
3648
label: 'Build a Remix app (recommended)',
37-
visible: true,
49+
visible: false,
3850
branches: {
3951
prompt: 'For your Remix template, which language do you want?',
4052
options: {
@@ -72,14 +84,14 @@ type PredefinedTemplate = keyof typeof templates
7284
const allTemplates = Object.keys(templates) as Readonly<PredefinedTemplate[]>
7385
export const visibleTemplates = allTemplates.filter((key) => templates[key].visible) as Readonly<PredefinedTemplate[]>
7486

75-
const templateOptionsInOrder = ['remix', 'none'] as const
87+
const templateOptionsInOrder = ['reactRouter', 'none'] as const
7688

7789
const init = async (options: InitOptions): Promise<InitOutput> => {
7890
let template = options.template
7991
const flavor = options.flavor
8092

8193
const defaults = {
82-
template: templates.remix.url,
94+
template: templates.reactRouter.url,
8395
} as const
8496

8597
if (!template) {

0 commit comments

Comments
 (0)