Skip to content

chore: only show the "Open in Stackblitz" button when there are no actual templates defined#349

Merged
Aslemammad merged 11 commits into
mainfrom
chore/markdown
Mar 29, 2025
Merged

chore: only show the "Open in Stackblitz" button when there are no actual templates defined#349
Aslemammad merged 11 commits into
mainfrom
chore/markdown

Conversation

@AmirSa12
Copy link
Copy Markdown
Member

@AmirSa12 AmirSa12 commented Mar 28, 2025

With these changes, the button will always be shown when there are no actual templates. The only time the button is hidden is when there are actual templates.

@continuous-releases-staging
Copy link
Copy Markdown

continuous-releases-staging Bot commented Mar 28, 2025

example-1example-2

npm i https://e28730b6.stackblitz-cr.pages.dev/stackblitz-labs/pkg.pr.new/pkg-pr-new@349
npm i https://e28730b6.stackblitz-cr.pages.dev/stackblitz-labs/pkg.pr.new/playground-a@349
npm i https://e28730b6.stackblitz-cr.pages.dev/stackblitz-labs/pkg.pr.new/playground-b@349

commit: 5834fa6

Comment thread packages/backend/server/utils/markdown.ts Outdated
Comment thread packages/backend/server/utils/markdown.ts
Comment thread packages/cli/index.ts
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.

@Aslemammad Aslemammad merged commit 32a744a into main Mar 29, 2025
6 checks passed
@Aslemammad Aslemammad deleted the chore/markdown branch March 29, 2025 21:29
@Aslemammad
Copy link
Copy Markdown
Member

please mention in each of the relevant slack threads that this issue was fixed. same with other issues. and i think there are more issues in slack that need to be tackled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants