Skip to content

Commit

Permalink
fix: review
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Nov 15, 2024
1 parent 2843338 commit 68e7ccf
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion docs/tutorialkit.dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
<PropertyTable inherited type="DownloadAsZip" />

The `DownloadAsZip` type has the following shape:
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/default/components/DownloadButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/default/utils/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
1 change: 1 addition & 0 deletions packages/cli/overwrites/src/content/tutorial/meta.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ type: tutorial
mainCommand: ['npm run dev', 'Starting http server']
prepareCommands:
- ['npm install', 'Installing dependencies']
downloadAsZip: true
---
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
24 changes: 12 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 68e7ccf

Please sign in to comment.