Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(remix-dev): Update create-remix to use the new examples repository #4208

Merged
merged 6 commits into from
Sep 26, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix repository url
  • Loading branch information
machour authored and MichaelDeBoey committed Sep 19, 2022
commit 45026dcbf353b8bcf5a9cbbe2196773a69a40ed6
15 changes: 9 additions & 6 deletions packages/remix-dev/cli/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -708,12 +708,15 @@ export async function validateTemplate(
case "example":
case "template": {
let spinner = ora("Validating the template…").start();
let isExample = templateType === "example";
let name = input;
if (templateType === "example") {
if (isExample) {
name = name.split("/")[1];
}
let typeDir = templateType + "s";
let templateUrl = `https://github.com/remix-run/remix/tree/main/${typeDir}/${name}`;
let repoBaseUrl = isExample ?
"https://github.com/remix-run/examples/tree/main" :
"https://github.com/remix-run/remix/tree/main/templates";
let templateUrl = `${repoBaseUrl}/${name}`;
let response;
try {
response = await fetch(templateUrl, { method: "HEAD" });
Expand All @@ -733,15 +736,15 @@ export async function validateTemplate(
throw Error(
"🚨 The template could not be verified. Please double check that " +
"the template is a valid project directory in " +
`https://github.com/remix-run/remix/tree/main/${typeDir} and ` +
`${repoBaseUrl} and ` +
"try again."
);
default:
throw Error(
"🚨 The template could not be verified. The server returned a " +
`response with a ${response.status} status. Please double ` +
"check that the template is a valid project directory in " +
`https://github.com/remix-run/remix/tree/main/${typeDir} and ` +
"check that the template is a valid project directory in " +
`${repoBaseUrl} and ` +
"try again."
);
}
Expand Down