From f2fb758f359b53e6114091f1ec5e500ed83a49a5 Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Fri, 28 Mar 2025 16:25:34 +0330 Subject: [PATCH 01/11] update --- packages/backend/server/utils/markdown.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/backend/server/utils/markdown.ts b/packages/backend/server/utils/markdown.ts index 5146fafe..1374f5dc 100644 --- a/packages/backend/server/utils/markdown.ts +++ b/packages/backend/server/utils/markdown.ts @@ -114,9 +114,10 @@ _commit: ${abbreviateCommitHash(workflowData.sha) function generateTemplatesStr(templates: Record) { const entries = Object.entries(templates).filter(([k]) => k !== "default"); - let str = templates.default - ? `[Open in Stackblitz](${templates.default})` - : ""; + let str = + 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})`)] From 009dcc222478459510ca8c98810615c03ecdcf69 Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Fri, 28 Mar 2025 17:39:05 +0330 Subject: [PATCH 02/11] update --- packages/backend/server/utils/markdown.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/backend/server/utils/markdown.ts b/packages/backend/server/utils/markdown.ts index 1374f5dc..554c41a3 100644 --- a/packages/backend/server/utils/markdown.ts +++ b/packages/backend/server/utils/markdown.ts @@ -114,10 +114,9 @@ _commit: ${abbreviateCommitHash(workflowData.sha) function generateTemplatesStr(templates: Record) { const entries = Object.entries(templates).filter(([k]) => k !== "default"); - let str = - entries.length === 0 && templates.default - ? `[Open in StackBlitz](${templates.default})` - : ""; + let str = Object.keys(templates).length === 0 + ? `[Open in StackBlitz](${templates.default})` + : ""; if (entries.length > 0 && entries.length <= 2) { str = [str, ...entries.map(([k, v]) => `[${k}](${v})`)] From 7a9a7683d0fca38e077353bd8b72398b598f4695 Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Fri, 28 Mar 2025 17:40:22 +0330 Subject: [PATCH 03/11] lint --- packages/backend/server/utils/markdown.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/backend/server/utils/markdown.ts b/packages/backend/server/utils/markdown.ts index 554c41a3..4166acbf 100644 --- a/packages/backend/server/utils/markdown.ts +++ b/packages/backend/server/utils/markdown.ts @@ -114,9 +114,10 @@ _commit: ${abbreviateCommitHash(workflowData.sha) function generateTemplatesStr(templates: Record) { const entries = Object.entries(templates).filter(([k]) => k !== "default"); - let str = Object.keys(templates).length === 0 - ? `[Open in StackBlitz](${templates.default})` - : ""; + let str = + Object.keys(templates).length === 0 + ? `[Open in StackBlitz](${templates.default})` + : ""; if (entries.length > 0 && entries.length <= 2) { str = [str, ...entries.map(([k, v]) => `[${k}](${v})`)] From 10761612158602acd87d6e818e9ac6cfcd360ffe Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Fri, 28 Mar 2025 17:47:45 +0330 Subject: [PATCH 04/11] update --- packages/backend/server/utils/markdown.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/backend/server/utils/markdown.ts b/packages/backend/server/utils/markdown.ts index 4166acbf..a71820ed 100644 --- a/packages/backend/server/utils/markdown.ts +++ b/packages/backend/server/utils/markdown.ts @@ -113,9 +113,11 @@ _commit: ${abbreviateCommitHash(workflowData.sha) } function generateTemplatesStr(templates: Record) { - const entries = Object.entries(templates).filter(([k]) => k !== "default"); + const entries = Object.entries(templates).filter( + ([k]) => k !== "default" && !k.startsWith("example-"), + ); let str = - Object.keys(templates).length === 0 + entries.length === 0 && templates.default ? `[Open in StackBlitz](${templates.default})` : ""; From 8c8297c1339c626efaa94279264a745f3531d91c Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Fri, 28 Mar 2025 17:54:16 +0330 Subject: [PATCH 05/11] update --- packages/backend/server/utils/markdown.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/backend/server/utils/markdown.ts b/packages/backend/server/utils/markdown.ts index a71820ed..dc045299 100644 --- a/packages/backend/server/utils/markdown.ts +++ b/packages/backend/server/utils/markdown.ts @@ -113,23 +113,28 @@ _commit: ${abbreviateCommitHash(workflowData.sha) } function generateTemplatesStr(templates: Record) { - const entries = Object.entries(templates).filter( + const actualEntries = Object.entries(templates).filter( ([k]) => k !== "default" && !k.startsWith("example-"), ); + const exampleEntries = Object.entries(templates).filter(([k]) => + k.startsWith("example-"), + ); + let str = - entries.length === 0 && templates.default + actualEntries.length === 0 && templates.default ? `[Open in StackBlitz](${templates.default})` : ""; - if (entries.length > 0 && entries.length <= 2) { - str = [str, ...entries.map(([k, v]) => `[${k}](${v})`)] + const allEntries = [...actualEntries, ...exampleEntries]; + if (allEntries.length > 0 && allEntries.length <= 2) { + str = [str, ...allEntries.map(([k, v]) => `[${k}](${v})`)] .filter(Boolean) .join(" • "); - } else if (entries.length > 2) { + } else if (allEntries.length > 2) { str += createCollapsibleBlock( "More templates", ` -${entries.map(([k, v]) => `- [${k}](${v})`).join("\n")} +${allEntries.map(([k, v]) => `- [${k}](${v})`).join("\n")} `, ); } From 057ab9ff0fbde8ed68fcff51d1977ec79dcd4eb0 Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Sat, 29 Mar 2025 14:13:56 +0330 Subject: [PATCH 06/11] update --- packages/backend/server/utils/markdown.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/packages/backend/server/utils/markdown.ts b/packages/backend/server/utils/markdown.ts index dc045299..1374f5dc 100644 --- a/packages/backend/server/utils/markdown.ts +++ b/packages/backend/server/utils/markdown.ts @@ -113,28 +113,21 @@ _commit: ${abbreviateCommitHash(workflowData.sha) } function generateTemplatesStr(templates: Record) { - const actualEntries = Object.entries(templates).filter( - ([k]) => k !== "default" && !k.startsWith("example-"), - ); - const exampleEntries = Object.entries(templates).filter(([k]) => - k.startsWith("example-"), - ); - + const entries = Object.entries(templates).filter(([k]) => k !== "default"); let str = - actualEntries.length === 0 && templates.default + entries.length === 0 && templates.default ? `[Open in StackBlitz](${templates.default})` : ""; - const allEntries = [...actualEntries, ...exampleEntries]; - if (allEntries.length > 0 && allEntries.length <= 2) { - str = [str, ...allEntries.map(([k, v]) => `[${k}](${v})`)] + if (entries.length > 0 && entries.length <= 2) { + str = [str, ...entries.map(([k, v]) => `[${k}](${v})`)] .filter(Boolean) .join(" • "); - } else if (allEntries.length > 2) { + } else if (entries.length > 2) { str += createCollapsibleBlock( "More templates", ` -${allEntries.map(([k, v]) => `- [${k}](${v})`).join("\n")} +${entries.map(([k, v]) => `- [${k}](${v})`).join("\n")} `, ); } From 8d2a105424583cee55a714c7feab82e499fbc8f7 Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Sat, 29 Mar 2025 14:18:19 +0330 Subject: [PATCH 07/11] test --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b57bde9..9a6969e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,5 +115,4 @@ jobs: echo "File $file_path created with random content of size $file_size MB." working-directory: ./playgrounds/playground-b - - name: pkg.pr.new - run: pnpm publish:playgrounds + From c2538bba4d4bdef2d285e0076d288ae0ae11be4d Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Sat, 29 Mar 2025 14:19:39 +0330 Subject: [PATCH 08/11] test --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a6969e9..b3f7b98c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,5 +114,3 @@ jobs: head -c $file_size_in_bytes $file_path echo "File $file_path created with random content of size $file_size MB." working-directory: ./playgrounds/playground-b - - From 6c249b8d00abc01a1fdd44cda4649a3416064ecf Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Sat, 29 Mar 2025 14:24:12 +0330 Subject: [PATCH 09/11] test --- .github/workflows/ci.yml | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3f7b98c..1b57bde9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,3 +114,6 @@ jobs: head -c $file_size_in_bytes $file_path echo "File $file_path created with random content of size $file_size MB." working-directory: ./playgrounds/playground-b + + - name: pkg.pr.new + run: pnpm publish:playgrounds diff --git a/package.json b/package.json index c067a566..494f246d 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "scripts": { "dev": "pnpm -r run dev", "build": "pnpm -r run build", - "publish:playgrounds": "pnpm pkg-pr-new publish './playgrounds/*' ./packages/cli --template './templates/*' --peerDeps", + "publish:playgrounds": "pnpm pkg-pr-new publish './playgrounds/*' ./packages/cli --peerDeps", "format": "prettier --write --cache .", "lint": "pnpm run \"/lint:.*/\"", "lint:js": "eslint --cache .", From 79df426330dbd2317ef87bbe6f4e79495880c67d Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Sat, 29 Mar 2025 14:28:51 +0330 Subject: [PATCH 10/11] done --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 494f246d..c067a566 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "scripts": { "dev": "pnpm -r run dev", "build": "pnpm -r run build", - "publish:playgrounds": "pnpm pkg-pr-new publish './playgrounds/*' ./packages/cli --peerDeps", + "publish:playgrounds": "pnpm pkg-pr-new publish './playgrounds/*' ./packages/cli --template './templates/*' --peerDeps", "format": "prettier --write --cache .", "lint": "pnpm run \"/lint:.*/\"", "lint:js": "eslint --cache .", From 5834fa628466d9569882dbe15e0357c0890a2dec Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Sat, 29 Mar 2025 15:24:47 +0330 Subject: [PATCH 11/11] update --- packages/cli/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/index.ts b/packages/cli/index.ts index 04c1793d..e258356e 100644 --- a/packages/cli/index.ts +++ b/packages/cli/index.ts @@ -315,7 +315,7 @@ const main = defineCommand({ const noDefaultTemplate = args.template === false; - if (!noDefaultTemplate) { + if (!noDefaultTemplate && templates.length === 0) { const project = createDefaultTemplate( Object.fromEntries(deps.entries()), );