Skip to content

Commit 0625063

Browse files
Merge pull request #6163 from Shopify/release-react-router-template
Release the React Router template
2 parents 313b841 + 93fbecb commit 0625063

File tree

8 files changed

+34
-17
lines changed

8 files changed

+34
-17
lines changed

.changeset/polite-coats-pay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/app': patch
3+
---
4+
5+
shopify app init now recommends the React Router template by default

docs-shopify.dev/commands/interfaces/app-init.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export interface appinit {
3838

3939
/**
4040
* The app template. Accepts one of the following:
41-
- <remix|none>
41+
- <reactRouter|remix|none>
4242
- Any GitHub repo with optional branch and subpath, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]
4343
* @environment SHOPIFY_FLAG_TEMPLATE
4444
*/

docs-shopify.dev/generated/generated_docs_data.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,7 @@
18201820
"syntaxKind": "PropertySignature",
18211821
"name": "--template <value>",
18221822
"value": "string",
1823-
"description": "The app template. Accepts one of the following: - <remix|none>\n - Any GitHub repo with optional branch and subpath, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]",
1823+
"description": "The app template. Accepts one of the following: - <reactRouter|remix|none>\n - Any GitHub repo with optional branch and subpath, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]",
18241824
"isOptional": true,
18251825
"environmentValue": "SHOPIFY_FLAG_TEMPLATE"
18261826
},
@@ -1861,7 +1861,7 @@
18611861
"environmentValue": "SHOPIFY_FLAG_PATH"
18621862
}
18631863
],
1864-
"value": "export interface appinit {\n /**\n * The Client ID of your app. Use this to automatically link your new project to an existing app. Using this flag avoids the app selection prompt.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * Which flavor of the given template to use.\n * @environment SHOPIFY_FLAG_TEMPLATE_FLAVOR\n */\n '--flavor <value>'?: string\n\n /**\n * \n * @environment SHOPIFY_FLAG_NAME\n */\n '-n, --name <value>'?: string\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * \n * @environment SHOPIFY_FLAG_PACKAGE_MANAGER\n */\n '-d, --package-manager <value>'?: string\n\n /**\n * \n * @environment SHOPIFY_FLAG_PATH\n */\n '-p, --path <value>'?: string\n\n /**\n * The app template. Accepts one of the following:\n - <remix|none>\n - Any GitHub repo with optional branch and subpath, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]\n * @environment SHOPIFY_FLAG_TEMPLATE\n */\n '--template <value>'?: string\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n}"
1864+
"value": "export interface appinit {\n /**\n * The Client ID of your app. Use this to automatically link your new project to an existing app. Using this flag avoids the app selection prompt.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * Which flavor of the given template to use.\n * @environment SHOPIFY_FLAG_TEMPLATE_FLAVOR\n */\n '--flavor <value>'?: string\n\n /**\n * \n * @environment SHOPIFY_FLAG_NAME\n */\n '-n, --name <value>'?: string\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * \n * @environment SHOPIFY_FLAG_PACKAGE_MANAGER\n */\n '-d, --package-manager <value>'?: string\n\n /**\n * \n * @environment SHOPIFY_FLAG_PATH\n */\n '-p, --path <value>'?: string\n\n /**\n * The app template. Accepts one of the following:\n - <reactRouter|remix|none>\n - Any GitHub repo with optional branch and subpath, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]\n * @environment SHOPIFY_FLAG_TEMPLATE\n */\n '--template <value>'?: string\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n}"
18651865
}
18661866
}
18671867
}

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,9 +31,21 @@ 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',
36-
label: 'Build a Remix app (recommended)',
48+
label: 'Build a Remix app',
3749
visible: true,
3850
branches: {
3951
prompt: 'For your Remix template, which language do you want?',
@@ -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) {

packages/cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ FLAGS
594594
--flavor=<value> Which flavor of the given template to use.
595595
--no-color Disable color output.
596596
--template=<value> The app template. Accepts one of the following:
597-
- <remix|none>
597+
- <reactRouter|remix|none>
598598
- Any GitHub repo with optional branch and subpath, e.g.,
599599
https://github.com/Shopify/<repository>/[subpath]#[branch]
600600
--verbose Increase the verbosity of the output.

packages/cli/oclif.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,7 @@
18211821
"type": "option"
18221822
},
18231823
"template": {
1824-
"description": "The app template. Accepts one of the following:\n - <remix|none>\n - Any GitHub repo with optional branch and subpath, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]",
1824+
"description": "The app template. Accepts one of the following:\n - <reactRouter|remix|none>\n - Any GitHub repo with optional branch and subpath, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]",
18251825
"env": "SHOPIFY_FLAG_TEMPLATE",
18261826
"hasDynamicHelp": false,
18271827
"multiple": false,

packages/create-app/oclif.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"type": "option"
7878
},
7979
"template": {
80-
"description": "The app template. Accepts one of the following:\n - <remix|none>\n - Any GitHub repo with optional branch and subpath, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]",
80+
"description": "The app template. Accepts one of the following:\n - <reactRouter|remix|none>\n - Any GitHub repo with optional branch and subpath, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]",
8181
"env": "SHOPIFY_FLAG_TEMPLATE",
8282
"hasDynamicHelp": false,
8383
"multiple": false,

0 commit comments

Comments
 (0)