Skip to content

Commit

Permalink
refactor: rename isJS to transpile
Browse files Browse the repository at this point in the history
This better reflects the fact that js-based templates shouldn't be transpiled. Previously `isJS` would be set to false, which is obviously misleading
  • Loading branch information
Tommypop2 committed Jan 24, 2025
1 parent 55bff9b commit d1540f8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/create/src/create-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const createStartJS = async ({ template, destination }: CreateStartArgs)
writeFileSync(join(destination, ".gitignore"), GIT_IGNORE);
};

export const createStart = (args: CreateStartArgs, js?: boolean) => {
if (js) {
export const createStart = (args: CreateStartArgs, transpile?: boolean) => {
if (transpile) {
return createStartJS(args);
}
return createStartTS(args);
Expand Down
4 changes: 2 additions & 2 deletions packages/create/src/create-vanilla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export type CreateVanillaArgs = {
template: VanillaTemplate;
destination: string;
};
export const createVanilla = (args: CreateVanillaArgs, js?: boolean) => {
if (js) {
export const createVanilla = (args: CreateVanillaArgs, transpile?: boolean) => {
if (transpile) {
return createVanillaJS(args);
}
return createVanillaTS(args);
Expand Down
6 changes: 3 additions & 3 deletions packages/create/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ export const createSolid = (version: string) =>
);

// Don't transpile project if it's already javascript!
const isJS = template.startsWith("js") ? false : !(await cancelable(p.confirm({ message: "Use Typescript?" })));
const transpileToJS = template.startsWith("js") ? false : !(await cancelable(p.confirm({ message: "Use Typescript?" })));

if (isStart) {
await spinnerify({
startText: "Creating project",
finishText: "Project created 🎉",
fn: () => createStart({ template: template as StartTemplate, destination: projectName }, isJS),
fn: () => createStart({ template: template as StartTemplate, destination: projectName }, transpileToJS),
});
} else {
await spinnerify({
startText: "Creating project",
finishText: "Project created 🎉",
fn: () => createVanilla({ template: template as VanillaTemplate, destination: projectName }, isJS),
fn: () => createVanilla({ template: template as VanillaTemplate, destination: projectName }, transpileToJS),
});
}
// Add "Created with Solid CLI" text to bottom of README
Expand Down

0 comments on commit d1540f8

Please sign in to comment.