Skip to content

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

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

Merged
merged 11 commits into from
Mar 29, 2025

Conversation

AmirSa12
Copy link
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.

Copy link

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

@@ -315,7 +315,7 @@ const main = defineCommand({

const noDefaultTemplate = args.template === false;

if (!noDefaultTemplate) {
if (!noDefaultTemplate && templates.length === 0) {
Copy link
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
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
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
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