Skip to content

Commit e0559c3

Browse files
authored
Merge branch 'main' into doc-meta
2 parents ebd26f6 + 3125547 commit e0559c3

File tree

99 files changed

+2644
-998
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2644
-998
lines changed

.github/workflows/integration-test-cli.yaml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,44 @@ name: CLI Integration Tests
33
on:
44
pull_request:
55
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
69

710
jobs:
8-
cli-integration-test:
11+
skip:
912
name: CLI Integration Tests
10-
# Note: `prepare-release.yaml` sets this commit message
11-
if: ${{ contains(github.event.pull_request.title, 'release CLI') || github.event_name == 'workflow_dispatch' }}
1213
runs-on: ubuntu-latest
14+
steps:
15+
- name: skip
16+
run: echo skip
17+
18+
cli-integration-test:
19+
name: CLI Integration Test Matrix
20+
# Note: `prepare-release.yaml` sets this commit message
21+
if: ${{ contains(github.event.pull_request.title, 'release CLI') || github.event_name == 'workflow_dispatch' || github.event_name == 'push' }}
22+
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
os: [ubuntu-latest]
28+
node-version: [18, 20, 22]
29+
include:
30+
- os: macos-latest
31+
node_version: 20
32+
- os: windows-latest
33+
node_version: 20.13.1
34+
1335
steps:
1436
- name: Checkout
1537
uses: actions/checkout@v4
1638
with:
1739
fetch-depth: 0
1840

1941
- uses: ./.github/actions/setup-and-build
42+
with:
43+
node-version: ${{ matrix.node-version }}
2044

2145
- name: Update template's versions
2246
working-directory: ./packages/cli

.github/workflows/publish-commit.yaml

Lines changed: 11 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,30 @@
1-
# PRs can be published by commenting `/pkg-pr-new` in the PR
1+
# PRs can be published by adding `pkg-pr-new` tag
22

3-
name: Publish Any Commit
3+
name: PR Preview Releases
44

55
on:
6-
issue_comment:
7-
types: [created]
6+
push:
7+
branches: [main]
8+
pull_request:
9+
types: [opened, synchronize, labeled]
810

911
jobs:
10-
build:
11-
if: github.repository == 'stackblitz/tutorialkit' && (github.event_name == 'push' || github.event.issue.pull_request && startsWith(github.event.comment.body, '/pkg-pr-new'))
12+
release:
13+
if: github.repository == 'stackblitz/tutorialkit' && (github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'pkg-pr-new'))
1214
runs-on: ubuntu-latest
15+
name: 'Release: pkg.pr.new'
1316

1417
steps:
15-
- if: github.event.issue.pull_request
16-
uses: actions/github-script@v7
17-
with:
18-
script: |
19-
const user = context.payload.sender.login
20-
console.log(`Validate user: ${user}`)
21-
22-
let hasTriagePermission = false
23-
try {
24-
const { data } = await github.rest.repos.getCollaboratorPermissionLevel({
25-
owner: context.repo.owner,
26-
repo: context.repo.repo,
27-
username: user,
28-
});
29-
hasTriagePermission = data.user.permissions.triage
30-
} catch (e) {
31-
console.warn(e)
32-
}
33-
34-
if (hasTriagePermission) {
35-
console.log('Allowed')
36-
await github.rest.reactions.createForIssueComment({
37-
owner: context.repo.owner,
38-
repo: context.repo.repo,
39-
comment_id: context.payload.comment.id,
40-
content: '+1',
41-
})
42-
} else {
43-
console.log('Not allowed')
44-
await github.rest.reactions.createForIssueComment({
45-
owner: context.repo.owner,
46-
repo: context.repo.repo,
47-
comment_id: context.payload.comment.id,
48-
content: '-1',
49-
})
50-
throw new Error('not allowed')
51-
}
52-
5318
- name: Checkout
5419
uses: actions/checkout@v4
5520
with:
56-
ref: refs/pull/${{ github.event.issue.number }}/head
21+
fetch-depth: 0
5722

5823
- uses: ./.github/actions/setup-and-build
5924

6025
- name: Publish to pkg.pr.new
6126
run: >
62-
pnpm dlx pkg-pr-new@0.0 publish --compact --pnpm
27+
pnpm dlx pkg-pr-new publish --compact --pnpm
6328
./packages/astro
6429
./packages/react
6530
./packages/runtime

.github/workflows/publish-docs.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This is for publishing documentation manually.
2+
# During release `publish-release.yaml` publishes docs automatically.
3+
name: Publish Documentation
4+
5+
on:
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish_docs:
10+
name: Publish documentation
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- uses: ./.github/actions/setup-and-build
19+
20+
- name: Build docs
21+
run: pnpm run docs:build
22+
23+
- name: Deploy documentation
24+
uses: cloudflare/pages-action@v1
25+
with:
26+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
27+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
28+
projectName: tutorialkit-docs-page
29+
workingDirectory: 'docs/tutorialkit.dev'
30+
directory: dist

CHANGELOG.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
# [1.3.0](https://github.com/stackblitz/tutorialkit/compare/1.2.2...1.3.0) (2024-11-15)
2+
3+
4+
### Bug Fixes
5+
6+
* remove `downloadAsZip` from template for now ([#416](https://github.com/stackblitz/tutorialkit/issues/416)) ([705fead](https://github.com/stackblitz/tutorialkit/commit/705fead006988a4ae865c9171062bd7d3afb3206))
7+
8+
9+
### Features
10+
11+
* **astro:** add "Download lesson as zip" button ([#415](https://github.com/stackblitz/tutorialkit/issues/415)) ([9c6e534](https://github.com/stackblitz/tutorialkit/commit/9c6e5349b6ab7e7399437839f6fc4cf11bd6c5c3))
12+
* **astro:** support lessons without parts or chapters ([#374](https://github.com/stackblitz/tutorialkit/issues/374)) ([8c44cbe](https://github.com/stackblitz/tutorialkit/commit/8c44cbec3f276a4f788b5d1652f67e4cf8cf7948))
13+
14+
15+
16+
## [1.2.2](https://github.com/stackblitz/tutorialkit/compare/1.2.1...1.2.2) (2024-11-12)
17+
18+
19+
### Bug Fixes
20+
21+
* hide preview container when `previews: false` ([#412](https://github.com/stackblitz/tutorialkit/issues/412)) ([b35de43](https://github.com/stackblitz/tutorialkit/commit/b35de43d437492d124af232adddd2a30ec70ec0e))
22+
23+
24+
25+
## [1.2.1](https://github.com/stackblitz/tutorialkit/compare/1.2.0...1.2.1) (2024-11-05)
26+
27+
28+
### Bug Fixes
29+
30+
* **astro:** optimize CJS dependency `picomatch` ([#406](https://github.com/stackblitz/tutorialkit/issues/406)) ([17a48a6](https://github.com/stackblitz/tutorialkit/commit/17a48a6858912277942d87b8af28a601adfad8da))
31+
32+
33+
34+
# [1.2.0](https://github.com/stackblitz/tutorialkit/compare/1.1.1...1.2.0) (2024-11-05)
35+
36+
37+
### Bug Fixes
38+
39+
* **react:** file tree scroll visibility ([#399](https://github.com/stackblitz/tutorialkit/issues/399)) ([e1e9160](https://github.com/stackblitz/tutorialkit/commit/e1e916044cc225dab925bd846d9208181f2080e1))
40+
41+
42+
### Features
43+
44+
* **runtime:** `fs.watch` to support syncing new files from webcontainer ([#394](https://github.com/stackblitz/tutorialkit/issues/394)) ([3beda90](https://github.com/stackblitz/tutorialkit/commit/3beda905df20ed9c7d286fc02007cf5b2e74835a))
45+
46+
47+
48+
## [1.1.1](https://github.com/stackblitz/tutorialkit/compare/1.1.0...1.1.1) (2024-10-20)
49+
50+
51+
### Bug Fixes
52+
53+
* **theme:** apply `fast-glob` Windows work-around for all `\@` matches ([#383](https://github.com/stackblitz/tutorialkit/issues/383)) ([9f4bd13](https://github.com/stackblitz/tutorialkit/commit/9f4bd13270f877b9f52e6b85eca5693c283ee249))
54+
55+
56+
157
# [1.1.0](https://github.com/stackblitz/tutorialkit/compare/1.0.0...1.1.0) (2024-10-18)
258

359

docs/tutorialkit.dev/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@tutorialkit/react": "workspace:*",
15-
"@webcontainer/api": "1.2.4",
15+
"@webcontainer/api": "1.5.1",
1616
"classnames": "^2.5.1",
1717
"react": "^18.3.1",
1818
"react-dom": "^18.3.1"
631 KB
Loading

docs/tutorialkit.dev/src/content/docs/guides/creating-content.mdx

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Content creation
33
description: 'Creating content in TutorialKit.'
44
---
55
import { FileTree } from '@astrojs/starlight/components';
6+
import { Tabs, TabItem } from '@astrojs/starlight/components';
67

78
From an information architecture perspective, tutorial content is divided into **parts**, which are further divided into **chapters**, each consisting of **lessons**.
89

@@ -36,6 +37,64 @@ This structure is reflected in the directory structure of your TutorialKit proje
3637

3738
Navigate into one of these folders to see another folder that represents a **chapter**. Inside the chapter folder, you will find one or more **lesson** folders.
3839

40+
You can also omit parts or chapters such that you only have lessons or only lessons and parts. Here are a few examples:
41+
42+
<Tabs>
43+
<TabItem label="Structure">
44+
```plaintext
45+
- Lesson 1: Getting started
46+
- Lesson 2: Adding pages
47+
```
48+
</TabItem>
49+
50+
<TabItem label="File tree">
51+
<FileTree>
52+
- src
53+
- content
54+
- tutorial
55+
- getting-started
56+
- _files/
57+
- _solution/
58+
- content.md
59+
- adding-pages/
60+
- meta.md
61+
- config.ts
62+
- templates/
63+
</FileTree>
64+
</TabItem>
65+
</Tabs>
66+
67+
<Tabs>
68+
<TabItem label="Structure">
69+
```plaintext
70+
- Part 1: Introduction
71+
- Lesson 1: What is Vite?
72+
- Lesson 2: Installing
73+
- …
74+
- Part 2: Project structure
75+
- …
76+
```
77+
</TabItem>
78+
79+
<TabItem label="File tree">
80+
<FileTree>
81+
- src
82+
- content
83+
- tutorial
84+
- introduction/
85+
- what-is-vite/
86+
- _files/
87+
- _solution/
88+
- content.md
89+
- installing/
90+
- project-structure/
91+
- meta.md
92+
- config.ts
93+
- templates/
94+
</FileTree>
95+
</TabItem>
96+
</Tabs>
97+
3998
## A lesson content file
4099

41100
Navigate to the `src/content/tutorial/1-basics/1-introduction/1-welcome` folder and open the `content.md` in your editor. You will see a file structured like this:
@@ -192,6 +251,39 @@ const removed = 'This line was removed';
192251
const highlighted = 'This line is highlighted';
193252
```
194253

254+
#### Useful Expressive Code Attributes
255+
256+
- **`title`** - Sets the title of the code block.
257+
- **`frame`** - Defines the frame of the code block. Options: `"code"`, `"terminal"`, `"none"`, `"auto"`.
258+
- **`showLineNumbers`** - Displays line numbers. You can combine this with `startLineNumber=#` to begin numbering from a specific line.
259+
- **`wrap`** - Controls word wrapping. Use `preserveIndent` and `preserveIndent=false` to adjust indentation handling.
260+
261+
##### Marking Lines
262+
263+
- **`{x}`** - Marks specific lines. For example, `{6,10-18}` will mark lines 6 and 10 through 18.
264+
- **`ins`** - Marks inserted lines. Example: `ins={6,10-18}`.
265+
- **`del`** - Marks deleted lines. Example: `del={6,10-18}`.
266+
- **`{"Label":x}`** - Assigns a label to a line or range of lines. Works with `mark`, `ins`, and `del`. Example: `{"Label1":5} del={"Label2":7-8} ins={"Label3":10-12}`. If the label is long, consider placing an empty line in the code for better readability.
267+
- **`collapse={X-Y}`** - Collapses the specified lines. Example: `collapse={1-5,12-14}`.
268+
269+
##### Marking Text
270+
271+
You can highlight text using strings or regular expressions. For example:
272+
273+
````md title="content.md"
274+
```jsx title="code.js" "hello" /ye[sp]/ add=/add[12]/ del=/remove[12]/
275+
console.log(
276+
'Hello, the words yes and yep will be marked. Also add1, add2, remove1, remove2',
277+
)
278+
```
279+
````
280+
281+
```jsx title="code.js" "hello" /ye[sp]/ add=/add[12]/ del=/remove[12]/
282+
console.log(
283+
'Hello, the words yes and yep will be marked. Also add1, add2, remove1, remove2',
284+
)
285+
```
286+
195287
#### Importing files
196288

197289
In addition to Expressive Code features, you can import files from your code template `_files` and `_solution` folders using the file or solution shortcodes. These shortcodes insert the content of the specified file directly into your lesson content.

docs/tutorialkit.dev/src/content/docs/guides/overriding-components.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ When overriding `TopBar` you can place TutorialKit's default components using fo
4646

4747
- `logo`: Logo of the application
4848
- `open-in-stackblitz-link`: Link for opening current lesson in StackBlitz
49+
- `download-button`: Button for downloading current lesson as `.zip` file
4950
- `theme-switch`: Switch for changing the theme
5051
- `login-button`: For StackBlitz Enterprise user, the login button
5152

@@ -61,6 +62,8 @@ When overriding `TopBar` you can place TutorialKit's default components using fo
6162

6263
<LanguageSelect />
6364

65+
<slot name="download-button" />
66+
6467
<slot name="open-in-stackblitz-link" />
6568

6669
<slot name="login-button" />

0 commit comments

Comments
 (0)