@tutorialkit-rb/types 1.5.2-rb.0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/default-localization.d.ts +20 -0
- package/dist/default-localization.js +20 -0
- package/dist/entities/index.d.ts +61 -0
- package/dist/entities/index.js +1 -0
- package/dist/entities/nav.d.ts +8 -0
- package/dist/entities/nav.js +1 -0
- package/dist/files-ref.d.ts +1 -0
- package/dist/files-ref.js +3 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/schemas/chapter.d.ts +379 -0
- package/dist/schemas/chapter.js +9 -0
- package/dist/schemas/common.d.ts +894 -0
- package/dist/schemas/common.js +229 -0
- package/dist/schemas/content.d.ts +1512 -0
- package/dist/schemas/content.js +9 -0
- package/dist/schemas/i18n.d.ts +151 -0
- package/dist/schemas/i18n.js +133 -0
- package/dist/schemas/index.d.ts +6 -0
- package/dist/schemas/index.js +6 -0
- package/dist/schemas/lesson.d.ts +382 -0
- package/dist/schemas/lesson.js +10 -0
- package/dist/schemas/metatags.d.ts +15 -0
- package/dist/schemas/metatags.js +13 -0
- package/dist/schemas/part.d.ts +382 -0
- package/dist/schemas/part.js +13 -0
- package/dist/schemas/tutorial.d.ts +378 -0
- package/dist/schemas/tutorial.js +14 -0
- package/dist/utils/interpolation.d.ts +1 -0
- package/dist/utils/interpolation.js +6 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @tutorialkit/types
|
|
2
|
+
|
|
3
|
+
Collection of schemas and type definitions used by a TutorialKit project.
|
|
4
|
+
|
|
5
|
+
In particular, this contains the schema for TutorialKit's main content format: parts, chapters, and lessons.
|
|
6
|
+
|
|
7
|
+
## License
|
|
8
|
+
|
|
9
|
+
MIT
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2024–present [StackBlitz][stackblitz]
|
|
12
|
+
|
|
13
|
+
[stackblitz]: https://stackblitz.com/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const DEFAULT_LOCALIZATION: {
|
|
2
|
+
partTemplate: string;
|
|
3
|
+
noPreviewNorStepsText: string;
|
|
4
|
+
startWebContainerText: string;
|
|
5
|
+
editPageText: string;
|
|
6
|
+
webcontainerLinkText: string;
|
|
7
|
+
filesTitleText: string;
|
|
8
|
+
fileTreeCreateFileText: string;
|
|
9
|
+
fileTreeCreateFolderText: string;
|
|
10
|
+
fileTreeActionNotAllowedText: string;
|
|
11
|
+
fileTreeFileExistsAlreadyText: string;
|
|
12
|
+
fileTreeAllowedPatternsText: string;
|
|
13
|
+
confirmationText: string;
|
|
14
|
+
prepareEnvironmentTitleText: string;
|
|
15
|
+
defaultPreviewTitleText: string;
|
|
16
|
+
reloadPreviewTitle: string;
|
|
17
|
+
toggleTerminalButtonText: string;
|
|
18
|
+
solveButtonText: string;
|
|
19
|
+
resetButtonText: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const DEFAULT_LOCALIZATION = {
|
|
2
|
+
partTemplate: 'Part ${index}: ${title}',
|
|
3
|
+
noPreviewNorStepsText: 'No preview to run nor steps to show',
|
|
4
|
+
startWebContainerText: 'Run this tutorial',
|
|
5
|
+
editPageText: 'Edit this page',
|
|
6
|
+
webcontainerLinkText: 'Powered by WebContainers',
|
|
7
|
+
filesTitleText: 'Files',
|
|
8
|
+
fileTreeCreateFileText: 'Create file',
|
|
9
|
+
fileTreeCreateFolderText: 'Create folder',
|
|
10
|
+
fileTreeActionNotAllowedText: 'This action is not allowed',
|
|
11
|
+
fileTreeFileExistsAlreadyText: 'File exists on filesystem already',
|
|
12
|
+
fileTreeAllowedPatternsText: 'Created files and folders must match following patterns:',
|
|
13
|
+
confirmationText: 'OK',
|
|
14
|
+
prepareEnvironmentTitleText: 'Preparing Environment',
|
|
15
|
+
defaultPreviewTitleText: 'Preview',
|
|
16
|
+
reloadPreviewTitle: 'Reload Preview',
|
|
17
|
+
toggleTerminalButtonText: 'Toggle Terminal',
|
|
18
|
+
solveButtonText: 'Solve',
|
|
19
|
+
resetButtonText: 'Reset',
|
|
20
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { I18nSchema } from '../schemas/i18n.js';
|
|
2
|
+
import type { ChapterSchema, CustomSchema, LessonSchema, PartSchema } from '../schemas/index.js';
|
|
3
|
+
import type { MetaTagsSchema } from '../schemas/metatags.js';
|
|
4
|
+
export type * from './nav.js';
|
|
5
|
+
export type FileDescriptor = {
|
|
6
|
+
path: string;
|
|
7
|
+
type: 'file' | 'folder';
|
|
8
|
+
};
|
|
9
|
+
export type Files = Record<string, string | Uint8Array>;
|
|
10
|
+
export type FilesystemError = 'FILE_EXISTS' | 'FOLDER_EXISTS';
|
|
11
|
+
/**
|
|
12
|
+
* This tuple contains a "ref" which points to a file to fetch with the `LessonFilesFetcher` and
|
|
13
|
+
* the list of file paths included by that ref.
|
|
14
|
+
*/
|
|
15
|
+
export type FilesRefList = [ref: string, files: string[]];
|
|
16
|
+
export interface LessonLink {
|
|
17
|
+
href: string;
|
|
18
|
+
title: string;
|
|
19
|
+
}
|
|
20
|
+
export interface Part {
|
|
21
|
+
id: string;
|
|
22
|
+
order: number;
|
|
23
|
+
slug: string;
|
|
24
|
+
data: PartSchema;
|
|
25
|
+
chapters: Record<Chapter['id'], Chapter>;
|
|
26
|
+
}
|
|
27
|
+
export interface Chapter {
|
|
28
|
+
id: string;
|
|
29
|
+
order: number;
|
|
30
|
+
slug: string;
|
|
31
|
+
data: ChapterSchema;
|
|
32
|
+
}
|
|
33
|
+
export interface Lesson<T = unknown> {
|
|
34
|
+
id: string;
|
|
35
|
+
order: number;
|
|
36
|
+
data: LessonSchema;
|
|
37
|
+
part?: {
|
|
38
|
+
id: Part['id'];
|
|
39
|
+
title: string;
|
|
40
|
+
};
|
|
41
|
+
chapter?: {
|
|
42
|
+
id: Chapter['id'];
|
|
43
|
+
title: string;
|
|
44
|
+
};
|
|
45
|
+
slug: string;
|
|
46
|
+
filepath: string;
|
|
47
|
+
editPageLink?: string;
|
|
48
|
+
files: FilesRefList;
|
|
49
|
+
solution: FilesRefList;
|
|
50
|
+
next?: LessonLink;
|
|
51
|
+
prev?: LessonLink;
|
|
52
|
+
Markdown: T;
|
|
53
|
+
}
|
|
54
|
+
export type I18n = Required<NonNullable<I18nSchema>>;
|
|
55
|
+
export type MetaTagsConfig = MetaTagsSchema;
|
|
56
|
+
export type CustomConfig = CustomSchema;
|
|
57
|
+
export interface Tutorial {
|
|
58
|
+
logoLink?: string;
|
|
59
|
+
parts: Record<Part['id'], Part>;
|
|
60
|
+
lessons: Lesson[];
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function folderPathToFilesRef(pathToFolder: string): string;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const chapterSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
3
|
+
mainCommand: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>, z.ZodObject<{
|
|
4
|
+
command: z.ZodString;
|
|
5
|
+
title: z.ZodString;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
title: string;
|
|
8
|
+
command: string;
|
|
9
|
+
}, {
|
|
10
|
+
title: string;
|
|
11
|
+
command: string;
|
|
12
|
+
}>]>>;
|
|
13
|
+
prepareCommands: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodTuple<[z.ZodString, z.ZodString], null>, z.ZodObject<{
|
|
14
|
+
command: z.ZodString;
|
|
15
|
+
title: z.ZodString;
|
|
16
|
+
}, "strict", z.ZodTypeAny, {
|
|
17
|
+
title: string;
|
|
18
|
+
command: string;
|
|
19
|
+
}, {
|
|
20
|
+
title: string;
|
|
21
|
+
command: string;
|
|
22
|
+
}>]>, "many">>;
|
|
23
|
+
}, {
|
|
24
|
+
meta: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
image: z.ZodOptional<z.ZodString>;
|
|
26
|
+
description: z.ZodOptional<z.ZodString>;
|
|
27
|
+
title: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
image?: string | undefined;
|
|
30
|
+
description?: string | undefined;
|
|
31
|
+
title?: string | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
image?: string | undefined;
|
|
34
|
+
description?: string | undefined;
|
|
35
|
+
title?: string | undefined;
|
|
36
|
+
}>>;
|
|
37
|
+
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
38
|
+
previews: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodTuple<[z.ZodNumber, z.ZodString], null>, z.ZodTuple<[z.ZodNumber, z.ZodString, z.ZodString], null>, z.ZodObject<{
|
|
39
|
+
port: z.ZodNumber;
|
|
40
|
+
title: z.ZodString;
|
|
41
|
+
pathname: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, "strict", z.ZodTypeAny, {
|
|
43
|
+
title: string;
|
|
44
|
+
port: number;
|
|
45
|
+
pathname?: string | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
title: string;
|
|
48
|
+
port: number;
|
|
49
|
+
pathname?: string | undefined;
|
|
50
|
+
}>]>, "many">]>>;
|
|
51
|
+
autoReload: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
filesystem: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
watch: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
watch?: boolean | string[] | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
watch?: boolean | string[] | undefined;
|
|
58
|
+
}>>;
|
|
59
|
+
template: z.ZodOptional<z.ZodString>;
|
|
60
|
+
terminal: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
61
|
+
open: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
panels: z.ZodUnion<[z.ZodLiteral<"output">, z.ZodLiteral<"terminal">, z.ZodEffects<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"output">, z.ZodLiteral<"terminal">]>, z.ZodTuple<[z.ZodUnion<[z.ZodLiteral<"output">, z.ZodLiteral<"terminal">]>, z.ZodString], null>, z.ZodObject<{
|
|
63
|
+
type: z.ZodUnion<[z.ZodLiteral<"output">, z.ZodLiteral<"terminal">]>;
|
|
64
|
+
id: z.ZodOptional<z.ZodString>;
|
|
65
|
+
title: z.ZodOptional<z.ZodString>;
|
|
66
|
+
allowRedirects: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
allowCommands: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
68
|
+
}, "strict", z.ZodTypeAny, {
|
|
69
|
+
type: "output" | "terminal";
|
|
70
|
+
title?: string | undefined;
|
|
71
|
+
id?: string | undefined;
|
|
72
|
+
allowRedirects?: boolean | undefined;
|
|
73
|
+
allowCommands?: string[] | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
type: "output" | "terminal";
|
|
76
|
+
title?: string | undefined;
|
|
77
|
+
id?: string | undefined;
|
|
78
|
+
allowRedirects?: boolean | undefined;
|
|
79
|
+
allowCommands?: string[] | undefined;
|
|
80
|
+
}>]>, "many">, ("output" | "terminal" | ["output" | "terminal", string] | {
|
|
81
|
+
type: "output" | "terminal";
|
|
82
|
+
title?: string | undefined;
|
|
83
|
+
id?: string | undefined;
|
|
84
|
+
allowRedirects?: boolean | undefined;
|
|
85
|
+
allowCommands?: string[] | undefined;
|
|
86
|
+
})[], ("output" | "terminal" | ["output" | "terminal", string] | {
|
|
87
|
+
type: "output" | "terminal";
|
|
88
|
+
title?: string | undefined;
|
|
89
|
+
id?: string | undefined;
|
|
90
|
+
allowRedirects?: boolean | undefined;
|
|
91
|
+
allowCommands?: string[] | undefined;
|
|
92
|
+
})[]>]>;
|
|
93
|
+
activePanel: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
allowRedirects: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
+
allowCommands: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
96
|
+
}, "strict", z.ZodTypeAny, {
|
|
97
|
+
panels: "output" | "terminal" | ("output" | "terminal" | ["output" | "terminal", string] | {
|
|
98
|
+
type: "output" | "terminal";
|
|
99
|
+
title?: string | undefined;
|
|
100
|
+
id?: string | undefined;
|
|
101
|
+
allowRedirects?: boolean | undefined;
|
|
102
|
+
allowCommands?: string[] | undefined;
|
|
103
|
+
})[];
|
|
104
|
+
open?: boolean | undefined;
|
|
105
|
+
allowRedirects?: boolean | undefined;
|
|
106
|
+
allowCommands?: string[] | undefined;
|
|
107
|
+
activePanel?: number | undefined;
|
|
108
|
+
}, {
|
|
109
|
+
panels: "output" | "terminal" | ("output" | "terminal" | ["output" | "terminal", string] | {
|
|
110
|
+
type: "output" | "terminal";
|
|
111
|
+
title?: string | undefined;
|
|
112
|
+
id?: string | undefined;
|
|
113
|
+
allowRedirects?: boolean | undefined;
|
|
114
|
+
allowCommands?: string[] | undefined;
|
|
115
|
+
})[];
|
|
116
|
+
open?: boolean | undefined;
|
|
117
|
+
allowRedirects?: boolean | undefined;
|
|
118
|
+
allowCommands?: string[] | undefined;
|
|
119
|
+
activePanel?: number | undefined;
|
|
120
|
+
}>]>>;
|
|
121
|
+
focus: z.ZodOptional<z.ZodString>;
|
|
122
|
+
editor: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodBoolean>, z.ZodObject<{
|
|
123
|
+
fileTree: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
124
|
+
allowEdits: z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
125
|
+
}, "strict", z.ZodTypeAny, {
|
|
126
|
+
allowEdits: string | boolean | string[];
|
|
127
|
+
}, {
|
|
128
|
+
allowEdits: string | boolean | string[];
|
|
129
|
+
}>]>>;
|
|
130
|
+
}, "strict", z.ZodTypeAny, {
|
|
131
|
+
fileTree?: boolean | {
|
|
132
|
+
allowEdits: string | boolean | string[];
|
|
133
|
+
} | undefined;
|
|
134
|
+
}, {
|
|
135
|
+
fileTree?: boolean | {
|
|
136
|
+
allowEdits: string | boolean | string[];
|
|
137
|
+
} | undefined;
|
|
138
|
+
}>]>>;
|
|
139
|
+
i18n: z.ZodOptional<z.ZodObject<{
|
|
140
|
+
partTemplate: z.ZodOptional<z.ZodString>;
|
|
141
|
+
editPageText: z.ZodOptional<z.ZodString>;
|
|
142
|
+
webcontainerLinkText: z.ZodOptional<z.ZodString>;
|
|
143
|
+
startWebContainerText: z.ZodOptional<z.ZodString>;
|
|
144
|
+
noPreviewNorStepsText: z.ZodOptional<z.ZodString>;
|
|
145
|
+
filesTitleText: z.ZodOptional<z.ZodString>;
|
|
146
|
+
fileTreeCreateFileText: z.ZodOptional<z.ZodString>;
|
|
147
|
+
fileTreeCreateFolderText: z.ZodOptional<z.ZodString>;
|
|
148
|
+
fileTreeActionNotAllowedText: z.ZodOptional<z.ZodString>;
|
|
149
|
+
fileTreeFileExistsAlreadyText: z.ZodOptional<z.ZodString>;
|
|
150
|
+
fileTreeAllowedPatternsText: z.ZodOptional<z.ZodString>;
|
|
151
|
+
confirmationText: z.ZodOptional<z.ZodString>;
|
|
152
|
+
prepareEnvironmentTitleText: z.ZodOptional<z.ZodString>;
|
|
153
|
+
defaultPreviewTitleText: z.ZodOptional<z.ZodString>;
|
|
154
|
+
reloadPreviewTitle: z.ZodOptional<z.ZodString>;
|
|
155
|
+
toggleTerminalButtonText: z.ZodOptional<z.ZodString>;
|
|
156
|
+
solveButtonText: z.ZodOptional<z.ZodString>;
|
|
157
|
+
resetButtonText: z.ZodOptional<z.ZodString>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
partTemplate?: string | undefined;
|
|
160
|
+
editPageText?: string | undefined;
|
|
161
|
+
webcontainerLinkText?: string | undefined;
|
|
162
|
+
startWebContainerText?: string | undefined;
|
|
163
|
+
noPreviewNorStepsText?: string | undefined;
|
|
164
|
+
filesTitleText?: string | undefined;
|
|
165
|
+
fileTreeCreateFileText?: string | undefined;
|
|
166
|
+
fileTreeCreateFolderText?: string | undefined;
|
|
167
|
+
fileTreeActionNotAllowedText?: string | undefined;
|
|
168
|
+
fileTreeFileExistsAlreadyText?: string | undefined;
|
|
169
|
+
fileTreeAllowedPatternsText?: string | undefined;
|
|
170
|
+
confirmationText?: string | undefined;
|
|
171
|
+
prepareEnvironmentTitleText?: string | undefined;
|
|
172
|
+
defaultPreviewTitleText?: string | undefined;
|
|
173
|
+
reloadPreviewTitle?: string | undefined;
|
|
174
|
+
toggleTerminalButtonText?: string | undefined;
|
|
175
|
+
solveButtonText?: string | undefined;
|
|
176
|
+
resetButtonText?: string | undefined;
|
|
177
|
+
}, {
|
|
178
|
+
partTemplate?: string | undefined;
|
|
179
|
+
editPageText?: string | undefined;
|
|
180
|
+
webcontainerLinkText?: string | undefined;
|
|
181
|
+
startWebContainerText?: string | undefined;
|
|
182
|
+
noPreviewNorStepsText?: string | undefined;
|
|
183
|
+
filesTitleText?: string | undefined;
|
|
184
|
+
fileTreeCreateFileText?: string | undefined;
|
|
185
|
+
fileTreeCreateFolderText?: string | undefined;
|
|
186
|
+
fileTreeActionNotAllowedText?: string | undefined;
|
|
187
|
+
fileTreeFileExistsAlreadyText?: string | undefined;
|
|
188
|
+
fileTreeAllowedPatternsText?: string | undefined;
|
|
189
|
+
confirmationText?: string | undefined;
|
|
190
|
+
prepareEnvironmentTitleText?: string | undefined;
|
|
191
|
+
defaultPreviewTitleText?: string | undefined;
|
|
192
|
+
reloadPreviewTitle?: string | undefined;
|
|
193
|
+
toggleTerminalButtonText?: string | undefined;
|
|
194
|
+
solveButtonText?: string | undefined;
|
|
195
|
+
resetButtonText?: string | undefined;
|
|
196
|
+
}>>;
|
|
197
|
+
editPageLink: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodBoolean]>>;
|
|
198
|
+
openInStackBlitz: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
199
|
+
projectTitle: z.ZodOptional<z.ZodString>;
|
|
200
|
+
projectDescription: z.ZodOptional<z.ZodString>;
|
|
201
|
+
projectTemplate: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"html">, z.ZodLiteral<"node">, z.ZodLiteral<"angular-cli">, z.ZodLiteral<"create-react-app">, z.ZodLiteral<"javascript">, z.ZodLiteral<"polymer">, z.ZodLiteral<"typescript">, z.ZodLiteral<"vue">]>>;
|
|
202
|
+
}, "strict", z.ZodTypeAny, {
|
|
203
|
+
projectTitle?: string | undefined;
|
|
204
|
+
projectDescription?: string | undefined;
|
|
205
|
+
projectTemplate?: "html" | "node" | "angular-cli" | "create-react-app" | "javascript" | "polymer" | "typescript" | "vue" | undefined;
|
|
206
|
+
}, {
|
|
207
|
+
projectTitle?: string | undefined;
|
|
208
|
+
projectDescription?: string | undefined;
|
|
209
|
+
projectTemplate?: "html" | "node" | "angular-cli" | "create-react-app" | "javascript" | "polymer" | "typescript" | "vue" | undefined;
|
|
210
|
+
}>]>>;
|
|
211
|
+
downloadAsZip: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
212
|
+
filename: z.ZodString;
|
|
213
|
+
}, "strict", z.ZodTypeAny, {
|
|
214
|
+
filename: string;
|
|
215
|
+
}, {
|
|
216
|
+
filename: string;
|
|
217
|
+
}>]>>;
|
|
218
|
+
}>, {
|
|
219
|
+
title: z.ZodString;
|
|
220
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
221
|
+
}>, {
|
|
222
|
+
type: z.ZodLiteral<"chapter">;
|
|
223
|
+
lessons: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
224
|
+
}>, "strip", z.ZodTypeAny, {
|
|
225
|
+
type: "chapter";
|
|
226
|
+
title: string;
|
|
227
|
+
custom?: Record<string, any> | undefined;
|
|
228
|
+
mainCommand?: string | [string, string] | {
|
|
229
|
+
title: string;
|
|
230
|
+
command: string;
|
|
231
|
+
} | undefined;
|
|
232
|
+
prepareCommands?: (string | [string, string] | {
|
|
233
|
+
title: string;
|
|
234
|
+
command: string;
|
|
235
|
+
})[] | undefined;
|
|
236
|
+
terminal?: boolean | {
|
|
237
|
+
panels: "output" | "terminal" | ("output" | "terminal" | ["output" | "terminal", string] | {
|
|
238
|
+
type: "output" | "terminal";
|
|
239
|
+
title?: string | undefined;
|
|
240
|
+
id?: string | undefined;
|
|
241
|
+
allowRedirects?: boolean | undefined;
|
|
242
|
+
allowCommands?: string[] | undefined;
|
|
243
|
+
})[];
|
|
244
|
+
open?: boolean | undefined;
|
|
245
|
+
allowRedirects?: boolean | undefined;
|
|
246
|
+
allowCommands?: string[] | undefined;
|
|
247
|
+
activePanel?: number | undefined;
|
|
248
|
+
} | undefined;
|
|
249
|
+
meta?: {
|
|
250
|
+
image?: string | undefined;
|
|
251
|
+
description?: string | undefined;
|
|
252
|
+
title?: string | undefined;
|
|
253
|
+
} | undefined;
|
|
254
|
+
previews?: boolean | (string | number | [number, string] | [number, string, string] | {
|
|
255
|
+
title: string;
|
|
256
|
+
port: number;
|
|
257
|
+
pathname?: string | undefined;
|
|
258
|
+
})[] | undefined;
|
|
259
|
+
autoReload?: boolean | undefined;
|
|
260
|
+
filesystem?: {
|
|
261
|
+
watch?: boolean | string[] | undefined;
|
|
262
|
+
} | undefined;
|
|
263
|
+
template?: string | undefined;
|
|
264
|
+
focus?: string | undefined;
|
|
265
|
+
editor?: boolean | {
|
|
266
|
+
fileTree?: boolean | {
|
|
267
|
+
allowEdits: string | boolean | string[];
|
|
268
|
+
} | undefined;
|
|
269
|
+
} | undefined;
|
|
270
|
+
i18n?: {
|
|
271
|
+
partTemplate?: string | undefined;
|
|
272
|
+
editPageText?: string | undefined;
|
|
273
|
+
webcontainerLinkText?: string | undefined;
|
|
274
|
+
startWebContainerText?: string | undefined;
|
|
275
|
+
noPreviewNorStepsText?: string | undefined;
|
|
276
|
+
filesTitleText?: string | undefined;
|
|
277
|
+
fileTreeCreateFileText?: string | undefined;
|
|
278
|
+
fileTreeCreateFolderText?: string | undefined;
|
|
279
|
+
fileTreeActionNotAllowedText?: string | undefined;
|
|
280
|
+
fileTreeFileExistsAlreadyText?: string | undefined;
|
|
281
|
+
fileTreeAllowedPatternsText?: string | undefined;
|
|
282
|
+
confirmationText?: string | undefined;
|
|
283
|
+
prepareEnvironmentTitleText?: string | undefined;
|
|
284
|
+
defaultPreviewTitleText?: string | undefined;
|
|
285
|
+
reloadPreviewTitle?: string | undefined;
|
|
286
|
+
toggleTerminalButtonText?: string | undefined;
|
|
287
|
+
solveButtonText?: string | undefined;
|
|
288
|
+
resetButtonText?: string | undefined;
|
|
289
|
+
} | undefined;
|
|
290
|
+
editPageLink?: string | boolean | undefined;
|
|
291
|
+
openInStackBlitz?: boolean | {
|
|
292
|
+
projectTitle?: string | undefined;
|
|
293
|
+
projectDescription?: string | undefined;
|
|
294
|
+
projectTemplate?: "html" | "node" | "angular-cli" | "create-react-app" | "javascript" | "polymer" | "typescript" | "vue" | undefined;
|
|
295
|
+
} | undefined;
|
|
296
|
+
downloadAsZip?: boolean | {
|
|
297
|
+
filename: string;
|
|
298
|
+
} | undefined;
|
|
299
|
+
slug?: string | undefined;
|
|
300
|
+
lessons?: string[] | undefined;
|
|
301
|
+
}, {
|
|
302
|
+
type: "chapter";
|
|
303
|
+
title: string;
|
|
304
|
+
custom?: Record<string, any> | undefined;
|
|
305
|
+
mainCommand?: string | [string, string] | {
|
|
306
|
+
title: string;
|
|
307
|
+
command: string;
|
|
308
|
+
} | undefined;
|
|
309
|
+
prepareCommands?: (string | [string, string] | {
|
|
310
|
+
title: string;
|
|
311
|
+
command: string;
|
|
312
|
+
})[] | undefined;
|
|
313
|
+
terminal?: boolean | {
|
|
314
|
+
panels: "output" | "terminal" | ("output" | "terminal" | ["output" | "terminal", string] | {
|
|
315
|
+
type: "output" | "terminal";
|
|
316
|
+
title?: string | undefined;
|
|
317
|
+
id?: string | undefined;
|
|
318
|
+
allowRedirects?: boolean | undefined;
|
|
319
|
+
allowCommands?: string[] | undefined;
|
|
320
|
+
})[];
|
|
321
|
+
open?: boolean | undefined;
|
|
322
|
+
allowRedirects?: boolean | undefined;
|
|
323
|
+
allowCommands?: string[] | undefined;
|
|
324
|
+
activePanel?: number | undefined;
|
|
325
|
+
} | undefined;
|
|
326
|
+
meta?: {
|
|
327
|
+
image?: string | undefined;
|
|
328
|
+
description?: string | undefined;
|
|
329
|
+
title?: string | undefined;
|
|
330
|
+
} | undefined;
|
|
331
|
+
previews?: boolean | (string | number | [number, string] | [number, string, string] | {
|
|
332
|
+
title: string;
|
|
333
|
+
port: number;
|
|
334
|
+
pathname?: string | undefined;
|
|
335
|
+
})[] | undefined;
|
|
336
|
+
autoReload?: boolean | undefined;
|
|
337
|
+
filesystem?: {
|
|
338
|
+
watch?: boolean | string[] | undefined;
|
|
339
|
+
} | undefined;
|
|
340
|
+
template?: string | undefined;
|
|
341
|
+
focus?: string | undefined;
|
|
342
|
+
editor?: boolean | {
|
|
343
|
+
fileTree?: boolean | {
|
|
344
|
+
allowEdits: string | boolean | string[];
|
|
345
|
+
} | undefined;
|
|
346
|
+
} | undefined;
|
|
347
|
+
i18n?: {
|
|
348
|
+
partTemplate?: string | undefined;
|
|
349
|
+
editPageText?: string | undefined;
|
|
350
|
+
webcontainerLinkText?: string | undefined;
|
|
351
|
+
startWebContainerText?: string | undefined;
|
|
352
|
+
noPreviewNorStepsText?: string | undefined;
|
|
353
|
+
filesTitleText?: string | undefined;
|
|
354
|
+
fileTreeCreateFileText?: string | undefined;
|
|
355
|
+
fileTreeCreateFolderText?: string | undefined;
|
|
356
|
+
fileTreeActionNotAllowedText?: string | undefined;
|
|
357
|
+
fileTreeFileExistsAlreadyText?: string | undefined;
|
|
358
|
+
fileTreeAllowedPatternsText?: string | undefined;
|
|
359
|
+
confirmationText?: string | undefined;
|
|
360
|
+
prepareEnvironmentTitleText?: string | undefined;
|
|
361
|
+
defaultPreviewTitleText?: string | undefined;
|
|
362
|
+
reloadPreviewTitle?: string | undefined;
|
|
363
|
+
toggleTerminalButtonText?: string | undefined;
|
|
364
|
+
solveButtonText?: string | undefined;
|
|
365
|
+
resetButtonText?: string | undefined;
|
|
366
|
+
} | undefined;
|
|
367
|
+
editPageLink?: string | boolean | undefined;
|
|
368
|
+
openInStackBlitz?: boolean | {
|
|
369
|
+
projectTitle?: string | undefined;
|
|
370
|
+
projectDescription?: string | undefined;
|
|
371
|
+
projectTemplate?: "html" | "node" | "angular-cli" | "create-react-app" | "javascript" | "polymer" | "typescript" | "vue" | undefined;
|
|
372
|
+
} | undefined;
|
|
373
|
+
downloadAsZip?: boolean | {
|
|
374
|
+
filename: string;
|
|
375
|
+
} | undefined;
|
|
376
|
+
slug?: string | undefined;
|
|
377
|
+
lessons?: string[] | undefined;
|
|
378
|
+
}>;
|
|
379
|
+
export type ChapterSchema = z.infer<typeof chapterSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { baseSchema } from './common.js';
|
|
3
|
+
export const chapterSchema = baseSchema.extend({
|
|
4
|
+
type: z.literal('chapter'),
|
|
5
|
+
lessons: z
|
|
6
|
+
.array(z.string())
|
|
7
|
+
.optional()
|
|
8
|
+
.describe('The list of lessons in this chapter. The order of the array defines the order of the lessons. If not specified a folder-based numbering system is used instead.'),
|
|
9
|
+
});
|