From 8f192de436fdf5107ef6ec8affdd2c6eb49ea5f8 Mon Sep 17 00:00:00 2001 From: merelinguist Date: Sat, 15 Feb 2020 16:15:43 +0000 Subject: [PATCH 01/13] Confirm if user wants example when creating app --- packages/create-next-app/helpers/examples.ts | 7 +++ packages/create-next-app/index.ts | 50 ++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/packages/create-next-app/helpers/examples.ts b/packages/create-next-app/helpers/examples.ts index 746f5cd3a860a..34b80b7313898 100644 --- a/packages/create-next-app/helpers/examples.ts +++ b/packages/create-next-app/helpers/examples.ts @@ -20,3 +20,10 @@ export async function downloadAndExtractExample( tar.extract({ cwd: root, strip: 3 }, [`next.js-canary/examples/${name}`]) ) } + +export async function listExamples(): Promise { + const res = await got( + 'https://api.github.com/repositories/70107786/contents/examples' + ).catch(e => e) + return JSON.parse(res.body) +} diff --git a/packages/create-next-app/index.ts b/packages/create-next-app/index.ts index 99377ebcd6fcc..6adc75dd2c6e3 100644 --- a/packages/create-next-app/index.ts +++ b/packages/create-next-app/index.ts @@ -9,6 +9,7 @@ import { createApp } from './create-app' import { validateNpmName } from './helpers/validate-pkg' import packageJson from './package.json' import { shouldUseYarn } from './helpers/should-use-yarn' +import { listExamples } from './helpers/examples' let projectPath: string = '' @@ -83,6 +84,55 @@ async function run() { process.exit(1) } + if (!program.example) { + const wantsRes = await prompts({ + type: 'confirm', + name: 'wantsExample', + message: 'Would you like to create your an app from an example?', + initial: false, + }) + + if (wantsRes.wantsExample) { + const examplesJSON = await listExamples() + const options = examplesJSON.map((example: any) => { + return { title: example.name, value: example.name } + }) + + // The search function built into `prompts` isn’t very helpful: + // someone searching for `styled-components` would get no results since + // the example is called `with-styled-components`, and `prompts` searches + // the beginnings of titles. + + // To solve this, we implement a basic fuzzy search here. + const fuzzyMatch = (pattern: string, str: string) => { + pattern = '.*' + pattern.split('').join('.*') + '.*' + const re = new RegExp(pattern) + return re.test(str) + } + + const fuzzySuggest = (input: any, choices: any) => + Promise.resolve( + choices.filter((choice: any) => fuzzyMatch(input, choice.title)) + ) + + const nameRes = await prompts({ + type: 'autocomplete', + name: 'exampleName', + message: 'Pick an example', + suggest: fuzzySuggest, + choices: options, + }) + + if (!nameRes.exampleName) { + console.error( + 'Could not locate an example with that name. Creating project from blank starter instead.' + ) + } + + program.example = nameRes.exampleName + } + } + await createApp({ appPath: resolvedProjectPath, useNpm: !!program.useNpm, From 1e548168203f908edc47fbad9f22cd348cf2e401 Mon Sep 17 00:00:00 2001 From: merelinguist Date: Mon, 17 Feb 2020 20:20:27 +0000 Subject: [PATCH 02/13] Only ask user to choose example if they provide --example flag --- packages/create-next-app/index.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/create-next-app/index.ts b/packages/create-next-app/index.ts index 6adc75dd2c6e3..991cab2de8262 100644 --- a/packages/create-next-app/index.ts +++ b/packages/create-next-app/index.ts @@ -22,7 +22,7 @@ const program = new Commander.Command(packageJson.name) }) .option('--use-npm') .option( - '-e, --example ', + '-e, --example [example-path]', 'an example to bootstrap the app with' ) .allowUnknownOption() @@ -84,11 +84,14 @@ async function run() { process.exit(1) } - if (!program.example) { + // --example flag included, but no example path provided, i.e.: + // $ create-next-app --example + if (program.example && typeof program.example !== 'string') { const wantsRes = await prompts({ type: 'confirm', name: 'wantsExample', - message: 'Would you like to create your an app from an example?', + message: + 'You forgot to select an example, would you like to pick one now?', initial: false, }) @@ -130,6 +133,11 @@ async function run() { } program.example = nameRes.exampleName + + // If the user says 'no' to choosing from examples, they are warned that the default + // template is being used. + } else { + console.warn(chalk.yellow('Creating project from blank starter instead.')) } } From 46fdb51df95453b9796af7ea5cb9023953dd9b99 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Wed, 25 Mar 2020 16:31:58 -0500 Subject: [PATCH 03/13] Simplify the search --- packages/create-next-app/index.ts | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/packages/create-next-app/index.ts b/packages/create-next-app/index.ts index 1a10abc6fa06f..61ecba0bac2a3 100644 --- a/packages/create-next-app/index.ts +++ b/packages/create-next-app/index.ts @@ -22,7 +22,7 @@ const program = new Commander.Command(packageJson.name) }) .option('--use-npm') .option( - '-e, --example |', + '-e, --example [name]|[github-url]', ` An example to bootstrap the app with. You can use an example name @@ -112,33 +112,21 @@ async function run() { if (wantsRes.wantsExample) { const examplesJSON = await listExamples() - const options = examplesJSON.map((example: any) => { - return { title: example.name, value: example.name } - }) - + const choices = examplesJSON.map((example: any) => ({ + title: example.name, + value: example.name, + })) // The search function built into `prompts` isn’t very helpful: // someone searching for `styled-components` would get no results since // the example is called `with-styled-components`, and `prompts` searches // the beginnings of titles. - - // To solve this, we implement a basic fuzzy search here. - const fuzzyMatch = (pattern: string, str: string) => { - pattern = '.*' + pattern.split('').join('.*') + '.*' - const re = new RegExp(pattern) - return re.test(str) - } - - const fuzzySuggest = (input: any, choices: any) => - Promise.resolve( - choices.filter((choice: any) => fuzzyMatch(input, choice.title)) - ) - const nameRes = await prompts({ type: 'autocomplete', name: 'exampleName', message: 'Pick an example', - suggest: fuzzySuggest, - choices: options, + choices, + suggest: (input: any, choices: any) => + choices.filter((choice: any) => choice.title.includes(input)), }) if (!nameRes.exampleName) { From ca41193504d1431a3866f47c45ee8bab2bd2953c Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Wed, 25 Mar 2020 17:08:19 -0500 Subject: [PATCH 04/13] Added test --- .../integration/create-next-app/index.test.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/integration/create-next-app/index.test.js b/test/integration/create-next-app/index.test.js index c7bb146dd1b6d..bccbfcaad84b2 100644 --- a/test/integration/create-next-app/index.test.js +++ b/test/integration/create-next-app/index.test.js @@ -150,4 +150,32 @@ describe('create next app', () => { fs.existsSync(path.join(cwd, projectName, '.gitignore')) ).toBeTruthy() }) + + it('Should ask for an example', async () => { + const question = async (...args) => { + return new Promise((resolve, reject) => { + const res = run(...args) + + let timeout = setTimeout(() => { + if (!res.killed) { + res.kill() + reject(new Error('Missing request to select example name')) + } + }, 2000) + + res.stdout.on('data', data => { + const stdout = data.toString() + if (stdout.includes('y/N')) { + res.kill() + clearTimeout(timeout) + resolve(stdout) + } + }) + }) + } + + expect(await question('no-example', '--example')).toMatch( + /You forgot to select an example, would you like to pick one now/ + ) + }) }) From 12de1186a9bb57906466b601094d89935d58e3b5 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Sat, 28 Mar 2020 11:35:43 -0500 Subject: [PATCH 05/13] Use a select to pick the template --- packages/create-next-app/index.ts | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/packages/create-next-app/index.ts b/packages/create-next-app/index.ts index 61ecba0bac2a3..4f4f1d51ae7f4 100644 --- a/packages/create-next-app/index.ts +++ b/packages/create-next-app/index.ts @@ -99,18 +99,18 @@ async function run() { process.exit(1) } - // --example flag included, but no example path provided, i.e.: - // $ create-next-app --example - if (program.example && typeof program.example !== 'string') { - const wantsRes = await prompts({ - type: 'confirm', - name: 'wantsExample', - message: - 'You forgot to select an example, would you like to pick one now?', - initial: false, + if (!program.example) { + const template = await prompts({ + type: 'select', + name: 'value', + message: 'Pick a template', + choices: [ + { title: 'Default starter app', value: 'default' }, + { title: 'Example from the Next.js repo', value: 'example' }, + ], }) - if (wantsRes.wantsExample) { + if (template.value === 'example') { const examplesJSON = await listExamples() const choices = examplesJSON.map((example: any) => ({ title: example.name, @@ -130,17 +130,11 @@ async function run() { }) if (!nameRes.exampleName) { - console.error( - 'Could not locate an example with that name. Creating project from blank starter instead.' - ) + console.error('Could not locate an example with that name.') + process.exit(1) } program.example = nameRes.exampleName - - // If the user says 'no' to choosing from examples, they are warned that the default - // template is being used. - } else { - console.warn(chalk.yellow('Creating project from blank starter instead.')) } } From 80a4a5e8afe8f6fc24fbf84e50c27fc0a1c487f8 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Sat, 28 Mar 2020 11:49:11 -0500 Subject: [PATCH 06/13] Updated test --- test/integration/create-next-app/index.test.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/integration/create-next-app/index.test.js b/test/integration/create-next-app/index.test.js index bccbfcaad84b2..7f108279d0e24 100644 --- a/test/integration/create-next-app/index.test.js +++ b/test/integration/create-next-app/index.test.js @@ -151,7 +151,7 @@ describe('create next app', () => { ).toBeTruthy() }) - it('Should ask for an example', async () => { + it('Should ask for a template', async () => { const question = async (...args) => { return new Promise((resolve, reject) => { const res = run(...args) @@ -159,13 +159,14 @@ describe('create next app', () => { let timeout = setTimeout(() => { if (!res.killed) { res.kill() - reject(new Error('Missing request to select example name')) + reject(new Error('Missing request to select template')) } }, 2000) res.stdout.on('data', data => { const stdout = data.toString() - if (stdout.includes('y/N')) { + + if (/Pick a template/.test(stdout)) { res.kill() clearTimeout(timeout) resolve(stdout) @@ -174,8 +175,9 @@ describe('create next app', () => { }) } - expect(await question('no-example', '--example')).toMatch( - /You forgot to select an example, would you like to pick one now/ - ) + const stdout = await question('no-example') + + expect(stdout).toMatch(/Default starter app/) + expect(stdout).toMatch(/Example from the Next.js repo/) }) }) From 352dce756b5e4d126f5e55328df6b8c88ebfe1b5 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Mon, 30 Mar 2020 15:34:20 -0500 Subject: [PATCH 07/13] check for lowercase and updated no example message --- packages/create-next-app/index.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/create-next-app/index.ts b/packages/create-next-app/index.ts index 4f4f1d51ae7f4..3065e266326ae 100644 --- a/packages/create-next-app/index.ts +++ b/packages/create-next-app/index.ts @@ -125,12 +125,16 @@ async function run() { name: 'exampleName', message: 'Pick an example', choices, - suggest: (input: any, choices: any) => - choices.filter((choice: any) => choice.title.includes(input)), + suggest: (input: any, choices: any) => { + const regex = new RegExp(input, 'i') + return choices.filter((choice: any) => regex.test(choice.title)) + }, }) if (!nameRes.exampleName) { - console.error('Could not locate an example with that name.') + console.error( + 'Please specify an example or use the default starter app.' + ) process.exit(1) } From f70eba3e689627c3c79286b8efeb8eaa3545ce36 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Mon, 30 Mar 2020 15:39:12 -0500 Subject: [PATCH 08/13] Add message if no template is selected --- packages/create-next-app/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/create-next-app/index.ts b/packages/create-next-app/index.ts index 3065e266326ae..d8c4800e22ba2 100644 --- a/packages/create-next-app/index.ts +++ b/packages/create-next-app/index.ts @@ -110,6 +110,12 @@ async function run() { ], }) + if (!template.value) { + console.log() + console.log('Please specify the template') + process.exit(1) + } + if (template.value === 'example') { const examplesJSON = await listExamples() const choices = examplesJSON.map((example: any) => ({ @@ -132,9 +138,8 @@ async function run() { }) if (!nameRes.exampleName) { - console.error( - 'Please specify an example or use the default starter app.' - ) + console.log() + console.log('Please specify an example or use the default starter app.') process.exit(1) } From 1ab4b9356ba9de20585a7a5c3ba66625d5970d0d Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Mon, 30 Mar 2020 20:52:40 -0500 Subject: [PATCH 09/13] Updated tests --- packages/create-next-app/index.ts | 1 + .../integration/create-next-app/index.test.js | 87 ++++++++++++------- 2 files changed, 55 insertions(+), 33 deletions(-) diff --git a/packages/create-next-app/index.ts b/packages/create-next-app/index.ts index d8c4800e22ba2..43c7737212e80 100644 --- a/packages/create-next-app/index.ts +++ b/packages/create-next-app/index.ts @@ -179,6 +179,7 @@ async function notifyUpdate() { ) console.log() } + process.exit() } catch { // ignore error } diff --git a/test/integration/create-next-app/index.test.js b/test/integration/create-next-app/index.test.js index 7f108279d0e24..0c21950af9363 100644 --- a/test/integration/create-next-app/index.test.js +++ b/test/integration/create-next-app/index.test.js @@ -13,6 +13,19 @@ const cwd = path.join( ) const run = (...args) => execa('node', [cli, ...args], { cwd }) +const runStarter = (...args) => { + const res = run(...args) + + res.stdout.on('data', data => { + const stdout = data.toString() + + if (/Pick a template/.test(stdout)) { + res.stdin.write('\n') + } + }) + + return res +} describe('create next app', () => { beforeAll(async () => { @@ -22,14 +35,13 @@ describe('create next app', () => { it('non-empty directory', async () => { const projectName = 'non-empty-directory' - await fs.mkdirp(path.join(cwd, projectName)) const pkg = path.join(cwd, projectName, 'package.json') fs.writeFileSync(pkg, '{ "foo": "bar" }') expect.assertions(1) try { - await run(projectName) + await runStarter(projectName) } catch (e) { expect(e.stdout).toMatch(/contains files that could conflict/) } @@ -37,9 +49,9 @@ describe('create next app', () => { it('empty directory', async () => { const projectName = 'empty-directory' - const res = await run(projectName) + const res = await runStarter(projectName) - expect(res.exitCode).toBe(0) + expect(res.code).toBe(0) expect( fs.existsSync(path.join(cwd, projectName, 'package.json')) ).toBeTruthy() @@ -64,7 +76,7 @@ describe('create next app', () => { it('valid example', async () => { const projectName = 'valid-example' const res = await run(projectName, '--example', 'basic-css') - expect(res.exitCode).toBe(0) + expect(res.code).toBe(0) expect( fs.existsSync(path.join(cwd, projectName, 'package.json')) @@ -86,7 +98,7 @@ describe('create next app', () => { 'https://github.com/zeit/next-learn-demo/tree/master/1-navigate-between-pages' ) - expect(res.exitCode).toBe(0) + expect(res.code).toBe(0) expect( fs.existsSync(path.join(cwd, projectName, 'package.json')) ).toBeTruthy() @@ -111,7 +123,7 @@ describe('create next app', () => { '1-navigate-between-pages' ) - expect(res.exitCode).toBe(0) + expect(res.code).toBe(0) expect( fs.existsSync(path.join(cwd, projectName, 'package.json')) ).toBeTruthy() @@ -136,7 +148,7 @@ describe('create next app', () => { '1-navigate-between-pages' ) - expect(res.exitCode).toBe(0) + expect(res.code).toBe(0) expect( fs.existsSync(path.join(cwd, projectName, 'package.json')) ).toBeTruthy() @@ -151,33 +163,42 @@ describe('create next app', () => { ).toBeTruthy() }) - it('Should ask for a template', async () => { - const question = async (...args) => { - return new Promise((resolve, reject) => { - const res = run(...args) - - let timeout = setTimeout(() => { - if (!res.killed) { - res.kill() - reject(new Error('Missing request to select template')) - } - }, 2000) - - res.stdout.on('data', data => { - const stdout = data.toString() - - if (/Pick a template/.test(stdout)) { - res.kill() - clearTimeout(timeout) - resolve(stdout) - } - }) - }) + it('should allow to manually select an example', async () => { + const runExample = (...args) => { + const res = run(...args) + + function pickExample(data) { + if (/hello-world/.test(data.toString())) { + console.log('YO') + res.stdout.removeListener('data', pickExample) + res.stdin.write('\n') + } + } + + function searchExample(data) { + if (/Pick an example/.test(data.toString())) { + res.stdout.removeListener('data', searchExample) + res.stdin.write('hello-world') + res.stdout.on('data', pickExample) + } + } + + function selectExample(data) { + if (/Pick a template/.test(data.toString())) { + res.stdout.removeListener('data', selectExample) + res.stdin.write('\u001b[B\n') // Down key and enter + res.stdout.on('data', searchExample) + } + } + + res.stdout.on('data', selectExample) + + return res } - const stdout = await question('no-example') + const res = await runExample('no-example') - expect(stdout).toMatch(/Default starter app/) - expect(stdout).toMatch(/Example from the Next.js repo/) + expect(res.code).toBe(0) + expect(res.stdout).toMatch(/Downloading files for example hello-world/) }) }) From b2ff9e3b96b6fbfa3faadc045b95f8f97e13ec02 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Mon, 6 Apr 2020 12:20:58 -0500 Subject: [PATCH 10/13] Handle error if fetching the examples fails --- packages/create-next-app/index.ts | 66 ++++++++++++------- .../integration/create-next-app/index.test.js | 1 - 2 files changed, 42 insertions(+), 25 deletions(-) diff --git a/packages/create-next-app/index.ts b/packages/create-next-app/index.ts index 43c7737212e80..1385357a705ff 100644 --- a/packages/create-next-app/index.ts +++ b/packages/create-next-app/index.ts @@ -117,33 +117,51 @@ async function run() { } if (template.value === 'example') { - const examplesJSON = await listExamples() - const choices = examplesJSON.map((example: any) => ({ - title: example.name, - value: example.name, - })) - // The search function built into `prompts` isn’t very helpful: - // someone searching for `styled-components` would get no results since - // the example is called `with-styled-components`, and `prompts` searches - // the beginnings of titles. - const nameRes = await prompts({ - type: 'autocomplete', - name: 'exampleName', - message: 'Pick an example', - choices, - suggest: (input: any, choices: any) => { - const regex = new RegExp(input, 'i') - return choices.filter((choice: any) => regex.test(choice.title)) - }, - }) - - if (!nameRes.exampleName) { + let examplesJSON: any + + try { + examplesJSON = await listExamples() + } catch (error) { + console.log() + console.log( + 'Failed to fetch the list of examples with the following error:' + ) + console.error(error) + console.log() + console.log('Switching to the default starter app') console.log() - console.log('Please specify an example or use the default starter app.') - process.exit(1) } - program.example = nameRes.exampleName + if (examplesJSON) { + const choices = examplesJSON.map((example: any) => ({ + title: example.name, + value: example.name, + })) + // The search function built into `prompts` isn’t very helpful: + // someone searching for `styled-components` would get no results since + // the example is called `with-styled-components`, and `prompts` searches + // the beginnings of titles. + const nameRes = await prompts({ + type: 'autocomplete', + name: 'exampleName', + message: 'Pick an example', + choices, + suggest: (input: any, choices: any) => { + const regex = new RegExp(input, 'i') + return choices.filter((choice: any) => regex.test(choice.title)) + }, + }) + + if (!nameRes.exampleName) { + console.log() + console.log( + 'Please specify an example or use the default starter app.' + ) + process.exit(1) + } + + program.example = nameRes.exampleName + } } } diff --git a/test/integration/create-next-app/index.test.js b/test/integration/create-next-app/index.test.js index 0c21950af9363..aa3d038618658 100644 --- a/test/integration/create-next-app/index.test.js +++ b/test/integration/create-next-app/index.test.js @@ -169,7 +169,6 @@ describe('create next app', () => { function pickExample(data) { if (/hello-world/.test(data.toString())) { - console.log('YO') res.stdout.removeListener('data', pickExample) res.stdin.write('\n') } From afb884bef87261dc2a0bfd2625dc124c72a2129c Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Mon, 6 Apr 2020 17:52:08 -0500 Subject: [PATCH 11/13] Fixed tests --- test/integration/create-next-app/index.test.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/integration/create-next-app/index.test.js b/test/integration/create-next-app/index.test.js index aa3d038618658..eeeb3518c2bac 100644 --- a/test/integration/create-next-app/index.test.js +++ b/test/integration/create-next-app/index.test.js @@ -51,7 +51,7 @@ describe('create next app', () => { const projectName = 'empty-directory' const res = await runStarter(projectName) - expect(res.code).toBe(0) + expect(res.exitCode).toBe(0) expect( fs.existsSync(path.join(cwd, projectName, 'package.json')) ).toBeTruthy() @@ -76,7 +76,7 @@ describe('create next app', () => { it('valid example', async () => { const projectName = 'valid-example' const res = await run(projectName, '--example', 'basic-css') - expect(res.code).toBe(0) + expect(res.exitCode).toBe(0) expect( fs.existsSync(path.join(cwd, projectName, 'package.json')) @@ -98,7 +98,7 @@ describe('create next app', () => { 'https://github.com/zeit/next-learn-demo/tree/master/1-navigate-between-pages' ) - expect(res.code).toBe(0) + expect(res.exitCode).toBe(0) expect( fs.existsSync(path.join(cwd, projectName, 'package.json')) ).toBeTruthy() @@ -123,7 +123,7 @@ describe('create next app', () => { '1-navigate-between-pages' ) - expect(res.code).toBe(0) + expect(res.exitCode).toBe(0) expect( fs.existsSync(path.join(cwd, projectName, 'package.json')) ).toBeTruthy() @@ -148,7 +148,7 @@ describe('create next app', () => { '1-navigate-between-pages' ) - expect(res.code).toBe(0) + expect(res.exitCode).toBe(0) expect( fs.existsSync(path.join(cwd, projectName, 'package.json')) ).toBeTruthy() @@ -197,7 +197,7 @@ describe('create next app', () => { const res = await runExample('no-example') - expect(res.code).toBe(0) + expect(res.exitCode).toBe(0) expect(res.stdout).toMatch(/Downloading files for example hello-world/) }) }) From 0629bbec9dc0402da155c33a2a2f9ca837ede0e1 Mon Sep 17 00:00:00 2001 From: Luis Alvarez Date: Mon, 6 Apr 2020 21:42:25 -0500 Subject: [PATCH 12/13] Updated test timeout --- test/integration/create-next-app/index.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/create-next-app/index.test.js b/test/integration/create-next-app/index.test.js index eeeb3518c2bac..6e9315dd75082 100644 --- a/test/integration/create-next-app/index.test.js +++ b/test/integration/create-next-app/index.test.js @@ -29,7 +29,7 @@ const runStarter = (...args) => { describe('create next app', () => { beforeAll(async () => { - jest.setTimeout(1000 * 60) + jest.setTimeout(1000 * 60 * 2) await fs.mkdirp(cwd) }) From 2c3775c742c2a323a27d8855af865c1fda67efe2 Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Tue, 7 Apr 2020 12:56:19 -0400 Subject: [PATCH 13/13] Update examples.ts --- packages/create-next-app/helpers/examples.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-next-app/helpers/examples.ts b/packages/create-next-app/helpers/examples.ts index 6287cff598843..59a7e94da4d37 100644 --- a/packages/create-next-app/helpers/examples.ts +++ b/packages/create-next-app/helpers/examples.ts @@ -73,6 +73,6 @@ export function downloadAndExtractExample( export async function listExamples(): Promise { const res = await got( 'https://api.github.com/repositories/70107786/contents/examples' - ).catch(e => e) + ) return JSON.parse(res.body) }