Unverified Commit b325f15e authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update Create Next App to handle rename of org (#13138)

* Update Create Next App to handle rename

* Rethrow if we dont handle the error
parent 5703362d
......@@ -82,14 +82,28 @@ export function downloadAndExtractRepo(
)
}
export function downloadAndExtractExample(
export async function downloadAndExtractExample(
root: string,
name: string
): Promise<void> {
return pipeline(
got.stream('https://codeload.github.com/zeit/next.js/tar.gz/canary'),
tar.extract({ cwd: root, strip: 3 }, [`next.js-canary/examples/${name}`])
)
try {
return await pipeline(
got.stream('https://codeload.github.com/zeit/next.js/tar.gz/canary'),
tar.extract({ cwd: root, strip: 3 }, [`next.js-canary/examples/${name}`])
)
} catch (err) {
// TODO: remove after this change has been landed
if (err?.response?.statusCode === 404) {
return pipeline(
got.stream('https://codeload.github.com/vercel/next.js/tar.gz/canary'),
tar.extract({ cwd: root, strip: 3 }, [
`next.js-canary/examples/${name}`,
])
)
} else {
throw err
}
}
}
export async function listExamples(): Promise<any> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment