Skip to content

Commit

Permalink
fix: don't try to transpile js templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Tommypop2 committed Oct 30, 2024
1 parent b165654 commit bee4bb8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/commands/src/handlers/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,11 @@ export const handleNew = async (
return;
}

const withTs = variation ? variation === "ts" : await cancelable(p.confirm({ message: "Use Typescript?" }));
const withTs = variation.startsWith("ts") ? await cancelable(p.confirm({ message: "Use Typescript?" })) : false;

// If the user does not want ts, we create the project in a temp directory inside the project directory
const tempDir = withTs ? name : join(name, ".solid-start");
// If project is already JS don't bother transpiling
const tempDir = withTs || variation.startsWith("js") ? name : join(name, ".solid-start");
const readmeAlreadyExists = existsSync(join(name, "README.md"));

await spinnerify({
Expand All @@ -229,8 +230,8 @@ export const handleNew = async (
await downloadRepo({ repo: { owner: "solidjs", name: "templates", subdir: variation }, dest: tempDir });
},
});

if (!withTs) await handleTSConversion(tempDir, name);
// Don't try to convert to ts if the template used is JS
if (!withTs && !variation.startsWith("js")) await handleTSConversion(tempDir, name);

// Add .gitignore
writeFileSync(join(name, ".gitignore"), gitIgnore);
Expand Down

0 comments on commit bee4bb8

Please sign in to comment.