From 68e7ccfd972039313bcae30262cb7bbf00cf89ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ari=20Perkki=C3=B6?= Date: Fri, 15 Nov 2024 09:28:04 +0200 Subject: [PATCH] fix: review --- docs/tutorialkit.dev/package.json | 2 +- .../content/docs/reference/configuration.mdx | 3 ++- packages/astro/package.json | 2 +- .../src/default/components/DownloadButton.tsx | 2 +- packages/astro/src/default/utils/content.ts | 2 +- .../overwrites/src/content/tutorial/meta.md | 1 + packages/react/package.json | 2 +- packages/runtime/package.json | 2 +- packages/test-utils/package.json | 2 +- pnpm-lock.yaml | 24 +++++++++---------- 10 files changed, 22 insertions(+), 20 deletions(-) diff --git a/docs/tutorialkit.dev/package.json b/docs/tutorialkit.dev/package.json index 56e0e8bc..8a029083 100644 --- a/docs/tutorialkit.dev/package.json +++ b/docs/tutorialkit.dev/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@tutorialkit/react": "workspace:*", - "@webcontainer/api": "1.5.0", + "@webcontainer/api": "1.5.1", "classnames": "^2.5.1", "react": "^18.3.1", "react-dom": "^18.3.1" diff --git a/docs/tutorialkit.dev/src/content/docs/reference/configuration.mdx b/docs/tutorialkit.dev/src/content/docs/reference/configuration.mdx index ba22c36f..0c99cdb9 100644 --- a/docs/tutorialkit.dev/src/content/docs/reference/configuration.mdx +++ b/docs/tutorialkit.dev/src/content/docs/reference/configuration.mdx @@ -413,7 +413,8 @@ type TemplateType = "html" | "node" | "angular-cli" | "create-react-app" | "java ``` ### `downloadAsZip` -Display a button for downloading the current lesson as `.zip` file. +Display a button for downloading the current lesson as `.zip` file. Defaults to `false`. +The default filename is constructed by concatenating folder names of part, chapter and lesson. The `DownloadAsZip` type has the following shape: diff --git a/packages/astro/package.json b/packages/astro/package.json index 29964db0..ad606443 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -45,7 +45,7 @@ "@tutorialkit/types": "workspace:*", "@types/react": "^18.3.3", "@unocss/reset": "^0.62.2", - "@webcontainer/api": "1.5.0", + "@webcontainer/api": "1.5.1", "astro": "^4.15.0", "astro-expressive-code": "^0.35.3", "chokidar": "3.6.0", diff --git a/packages/astro/src/default/components/DownloadButton.tsx b/packages/astro/src/default/components/DownloadButton.tsx index b9b94ee0..a0b2f390 100644 --- a/packages/astro/src/default/components/DownloadButton.tsx +++ b/packages/astro/src/default/components/DownloadButton.tsx @@ -25,7 +25,7 @@ async function onClick() { let filename = typeof lesson.data.downloadAsZip === 'object' ? lesson.data.downloadAsZip.filename - : `${lesson.part.id}-${lesson.chapter.id}-${lesson.id}.zip`; + : [lesson.part?.id, lesson.chapter?.id, lesson.id].filter(Boolean).join('-'); if (!filename.endsWith('.zip')) { filename += '.zip'; diff --git a/packages/astro/src/default/utils/content.ts b/packages/astro/src/default/utils/content.ts index 2adc63e3..9bd2eb1a 100644 --- a/packages/astro/src/default/utils/content.ts +++ b/packages/astro/src/default/utils/content.ts @@ -161,7 +161,7 @@ async function parseCollection(collection: CollectionEntryTutorial[]) { tutorialMetaData.template ??= 'default'; tutorialMetaData.i18n = Object.assign({ ...DEFAULT_LOCALIZATION }, tutorialMetaData.i18n); tutorialMetaData.openInStackBlitz ??= true; - tutorialMetaData.downloadAsZip ??= true; + tutorialMetaData.downloadAsZip ??= false; tutorial.logoLink = data.logoLink; } else if (type === 'part') { diff --git a/packages/cli/overwrites/src/content/tutorial/meta.md b/packages/cli/overwrites/src/content/tutorial/meta.md index 86a50e02..984d22f0 100644 --- a/packages/cli/overwrites/src/content/tutorial/meta.md +++ b/packages/cli/overwrites/src/content/tutorial/meta.md @@ -3,4 +3,5 @@ type: tutorial mainCommand: ['npm run dev', 'Starting http server'] prepareCommands: - ['npm install', 'Installing dependencies'] +downloadAsZip: true --- diff --git a/packages/react/package.json b/packages/react/package.json index 39989a6e..0d840a59 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -85,7 +85,7 @@ "@replit/codemirror-lang-svelte": "^6.0.0", "@tutorialkit/runtime": "workspace:*", "@tutorialkit/theme": "workspace:*", - "@webcontainer/api": "1.5.0", + "@webcontainer/api": "1.5.1", "@xterm/addon-fit": "^0.10.0", "@xterm/addon-web-links": "^0.11.0", "@xterm/xterm": "^5.5.0", diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 56098d24..17037585 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -34,7 +34,7 @@ }, "dependencies": { "@tutorialkit/types": "workspace:*", - "@webcontainer/api": "1.5.0", + "@webcontainer/api": "1.5.1", "nanostores": "^0.10.3", "picomatch": "^4.0.2" }, diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index a65e3490..30a7d4f8 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -5,7 +5,7 @@ "type": "module", "private": true, "devDependencies": { - "@webcontainer/api": "1.5.0", + "@webcontainer/api": "1.5.1", "typescript": "^5.4.5", "vitest": "^2.1.1" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f902ee95..3aadc020 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -94,8 +94,8 @@ importers: specifier: workspace:* version: link:../../packages/react '@webcontainer/api': - specifier: 1.5.0 - version: 1.5.0 + specifier: 1.5.1 + version: 1.5.1 classnames: specifier: ^2.5.1 version: 2.5.1 @@ -327,8 +327,8 @@ importers: specifier: ^0.62.2 version: 0.62.3 '@webcontainer/api': - specifier: 1.5.0 - version: 1.5.0 + specifier: 1.5.1 + version: 1.5.1 astro: specifier: ^4.15.0 version: 4.15.0(@types/node@22.9.0)(typescript@5.5.3) @@ -564,8 +564,8 @@ importers: specifier: workspace:* version: link:../theme '@webcontainer/api': - specifier: 1.5.0 - version: 1.5.0 + specifier: 1.5.1 + version: 1.5.1 '@xterm/addon-fit': specifier: ^0.10.0 version: 0.10.0(@xterm/xterm@5.5.0) @@ -625,8 +625,8 @@ importers: specifier: workspace:* version: link:../types '@webcontainer/api': - specifier: 1.5.0 - version: 1.5.0 + specifier: 1.5.1 + version: 1.5.1 nanostores: specifier: ^0.10.3 version: 0.10.3 @@ -696,8 +696,8 @@ importers: packages/test-utils: devDependencies: '@webcontainer/api': - specifier: 1.5.0 - version: 1.5.0 + specifier: 1.5.1 + version: 1.5.1 typescript: specifier: ^5.4.5 version: 5.5.3 @@ -4434,8 +4434,8 @@ packages: resolution: {integrity: sha512-KYSIHVmslkaCDyw013pphY+d7x1qV8IZupYfeIfzNA+nsaWHbn5uPuQRvdRFsa9zFzGeudPuoGoZ1Op4jrJXIQ==} dev: true - /@webcontainer/api@1.5.0: - resolution: {integrity: sha512-Xb4PdQh5BjRbsndO9a5KmRw8n35GamRng6UrRA22XSCuT0Ze5HsKhq0//diIavnjURGm58PXeFwrN1oPfU/flQ==} + /@webcontainer/api@1.5.1: + resolution: {integrity: sha512-+ELk+TbTOUx0LawAUdB+nnxaofg/FxUXo/Ac/+CzHSP3SOc3ebBAW3fLo4UZfvJdUW+ygWZOiQMthPLQXvKZEg==} /@xterm/addon-fit@0.10.0(@xterm/xterm@5.5.0): resolution: {integrity: sha512-UFYkDm4HUahf2lnEyHvio51TNGiLK66mqP2JoATy7hRZeXaGMRDr00JiSF7m63vR5WKATF605yEggJKsw0JpMQ==}