Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 4 additions & 3 deletions packages/backend/server/utils/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ _commit: <a href="${checkRunUrl}"><code>${abbreviateCommitHash(workflowData.sha)

function generateTemplatesStr(templates: Record<string, string>) {
const entries = Object.entries(templates).filter(([k]) => k !== "default");
let str = templates.default
? `[Open in Stackblitz](${templates.default})`
: "";
let str =
Comment thread
AmirSa12 marked this conversation as resolved.
entries.length === 0 && templates.default
? `[Open in StackBlitz](${templates.default})`
: "";

if (entries.length > 0 && entries.length <= 2) {
str = [str, ...entries.map(([k, v]) => `[${k}](${v})`)]
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ const main = defineCommand({

const noDefaultTemplate = args.template === false;

if (!noDefaultTemplate) {
if (!noDefaultTemplate && templates.length === 0) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be an &&? why?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be an && because we want the default template to be created only when both conditions are true?
if no templates were found and if the user hasn't explicitly disabled templates.
if you think about using ||, I think it might be incorrect because if noDefaultTemplate is true, we should not create the default template, even if no templates were found. or if the user uses, as an example, --template ./examples/* and templates are found, we should not create the default template. unless I'm missing something here...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes total sense.

const project = createDefaultTemplate(
Object.fromEntries(deps.entries()),
);
Expand Down