Skip to content

Commit 0510474

Browse files
authored
fix(astro): correct error message when chapter not found (#361)
1 parent 3c14eb9 commit 0510474

File tree

7 files changed

+921
-3
lines changed

7 files changed

+921
-3
lines changed

packages/astro/scripts/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ async function copyDefaultFolder() {
6767
// copy default folder unmodified, without test files
6868
await cp(src, dist, {
6969
recursive: true,
70-
filter: (filename) => !filename.endsWith('.spec.ts'),
70+
filter: (filename) => !filename.endsWith('.spec.ts') && !filename.includes('__snapshots__'),
7171
});
7272

7373
if (isWatch) {
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
{
2+
"parts": {
3+
"1-part": {
4+
"id": "1-part",
5+
"order": 0,
6+
"data": {
7+
"type": "part",
8+
"title": "Basics"
9+
},
10+
"slug": "part-slug",
11+
"chapters": {
12+
"1-chapter": {
13+
"id": "1-chapter",
14+
"order": 0,
15+
"data": {
16+
"title": "The first chapter in part 1",
17+
"type": "chapter"
18+
},
19+
"slug": "chapter-slug",
20+
"lessons": {
21+
"1-first": {
22+
"data": {
23+
"type": "lesson",
24+
"title": "Welcome to TutorialKit",
25+
"template": "default",
26+
"i18n": {
27+
"mocked": "default localization"
28+
},
29+
"openInStackBlitz": true
30+
},
31+
"id": "1-first",
32+
"filepath": "1-part/1-chapter/1-first/content.md",
33+
"order": 0,
34+
"part": {
35+
"id": "1-part",
36+
"title": "Basics"
37+
},
38+
"chapter": {
39+
"id": "1-chapter",
40+
"title": "The first chapter in part 1"
41+
},
42+
"Markdown": "Markdown for tutorial",
43+
"slug": "lesson-slug",
44+
"files": [
45+
"1-part-1-chapter-1-first-files.json",
46+
[]
47+
],
48+
"solution": [
49+
"1-part-1-chapter-1-first-solution.json",
50+
[]
51+
],
52+
"next": {
53+
"title": "Welcome to TutorialKit",
54+
"href": "/part-slug/chapter-slug/lesson-slug"
55+
}
56+
}
57+
},
58+
"firstLessonId": "1-first"
59+
}
60+
},
61+
"firstChapterId": "1-chapter"
62+
},
63+
"2-part": {
64+
"id": "2-part",
65+
"order": 1,
66+
"data": {
67+
"type": "part",
68+
"title": "Basics"
69+
},
70+
"slug": "part-slug",
71+
"chapters": {
72+
"2-chapter": {
73+
"id": "2-chapter",
74+
"order": 0,
75+
"data": {
76+
"title": "The first chapter in part 1",
77+
"type": "chapter"
78+
},
79+
"slug": "chapter-slug",
80+
"lessons": {
81+
"1-second": {
82+
"data": {
83+
"type": "lesson",
84+
"title": "Welcome to TutorialKit",
85+
"template": "default",
86+
"i18n": {
87+
"mocked": "default localization"
88+
},
89+
"openInStackBlitz": true
90+
},
91+
"id": "1-second",
92+
"filepath": "2-part/2-chapter/1-second/content.md",
93+
"order": 0,
94+
"part": {
95+
"id": "2-part",
96+
"title": "Basics"
97+
},
98+
"chapter": {
99+
"id": "2-chapter",
100+
"title": "The first chapter in part 1"
101+
},
102+
"Markdown": "Markdown for tutorial",
103+
"slug": "lesson-slug",
104+
"files": [
105+
"2-part-2-chapter-1-second-files.json",
106+
[]
107+
],
108+
"solution": [
109+
"2-part-2-chapter-1-second-solution.json",
110+
[]
111+
],
112+
"prev": {
113+
"title": "Welcome to TutorialKit",
114+
"href": "/part-slug/chapter-slug/lesson-slug"
115+
},
116+
"next": {
117+
"title": "Welcome to TutorialKit",
118+
"href": "/part-slug/chapter-slug/lesson-slug"
119+
}
120+
}
121+
},
122+
"firstLessonId": "1-second"
123+
}
124+
},
125+
"firstChapterId": "2-chapter"
126+
},
127+
"3-part": {
128+
"id": "3-part",
129+
"order": 2,
130+
"data": {
131+
"type": "part",
132+
"title": "Basics"
133+
},
134+
"slug": "part-slug",
135+
"chapters": {
136+
"3-chapter": {
137+
"id": "3-chapter",
138+
"order": 0,
139+
"data": {
140+
"title": "The first chapter in part 1",
141+
"type": "chapter"
142+
},
143+
"slug": "chapter-slug",
144+
"lessons": {
145+
"1-third": {
146+
"data": {
147+
"type": "lesson",
148+
"title": "Welcome to TutorialKit",
149+
"template": "default",
150+
"i18n": {
151+
"mocked": "default localization"
152+
},
153+
"openInStackBlitz": true
154+
},
155+
"id": "1-third",
156+
"filepath": "3-part/3-chapter/1-third/content.md",
157+
"order": 0,
158+
"part": {
159+
"id": "3-part",
160+
"title": "Basics"
161+
},
162+
"chapter": {
163+
"id": "3-chapter",
164+
"title": "The first chapter in part 1"
165+
},
166+
"Markdown": "Markdown for tutorial",
167+
"slug": "lesson-slug",
168+
"files": [
169+
"3-part-3-chapter-1-third-files.json",
170+
[]
171+
],
172+
"solution": [
173+
"3-part-3-chapter-1-third-solution.json",
174+
[]
175+
],
176+
"prev": {
177+
"title": "Welcome to TutorialKit",
178+
"href": "/part-slug/chapter-slug/lesson-slug"
179+
}
180+
}
181+
},
182+
"firstLessonId": "1-third"
183+
}
184+
},
185+
"firstChapterId": "3-chapter"
186+
}
187+
},
188+
"firstPartId": "1-part"
189+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"parts": {
3+
"1-part": {
4+
"id": "1-part",
5+
"order": 0,
6+
"data": {
7+
"type": "part",
8+
"title": "Basics"
9+
},
10+
"slug": "part-slug",
11+
"chapters": {
12+
"1-chapter": {
13+
"id": "1-chapter",
14+
"order": 0,
15+
"data": {
16+
"title": "The first chapter in part 1",
17+
"type": "chapter"
18+
},
19+
"slug": "chapter-slug",
20+
"lessons": {
21+
"1-lesson": {
22+
"data": {
23+
"type": "lesson",
24+
"title": "Welcome to TutorialKit",
25+
"template": "default",
26+
"i18n": {
27+
"mocked": "default localization"
28+
},
29+
"openInStackBlitz": true
30+
},
31+
"id": "1-lesson",
32+
"filepath": "1-part/1-chapter/1-lesson/content.md",
33+
"order": 0,
34+
"part": {
35+
"id": "1-part",
36+
"title": "Basics"
37+
},
38+
"chapter": {
39+
"id": "1-chapter",
40+
"title": "The first chapter in part 1"
41+
},
42+
"Markdown": "Markdown for tutorial",
43+
"slug": "lesson-slug",
44+
"files": [
45+
"1-part-1-chapter-1-lesson-files.json",
46+
[]
47+
],
48+
"solution": [
49+
"1-part-1-chapter-1-lesson-solution.json",
50+
[]
51+
]
52+
}
53+
},
54+
"firstLessonId": "1-lesson"
55+
}
56+
},
57+
"firstChapterId": "1-chapter"
58+
}
59+
},
60+
"firstPartId": "1-part"
61+
}

0 commit comments

Comments
 (0)