Skip to content

Commit bf3b2f4

Browse files
committed
refactor: syncChanges -> watch
1 parent 2a6b5d1 commit bf3b2f4

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

docs/tutorialkit.dev/src/content/docs/reference/configuration.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ type Command = string
221221
##### `filesystem`
222222
Configures how changes such as files being modified or added in WebContainer should be reflected in the editor when they weren't caused by the user directly. By default, the editor will not reflect these changes.
223223

224-
An example use case is when a user runs a command that modifies a file. For instance when a `package.json` is modified by doing an `npm install <xyz>`. If `syncChanges` is set to `true`, the file will be updated in the editor. If set to `false`, the file will not be updated.
224+
An example use case is when a user runs a command that modifies a file. For instance when a `package.json` is modified by doing an `npm install <xyz>`. If `watch` is set to `true`, the file will be updated in the editor. If set to `false`, the file will not be updated.
225225

226226
This property is by default set to `false` as it can impact performance. If you are creating a lesson where the user is expected to modify files directly, you may want to keep this to `false`.
227227

@@ -231,7 +231,7 @@ The `FileSystem` type has the following shape:
231231

232232
```ts
233233
type FileSystem = {
234-
syncChanges: boolean
234+
watch: boolean
235235
}
236236
237237
```
@@ -240,10 +240,10 @@ Example values:
240240

241241
```yaml
242242
filesystem:
243-
syncChanges: true # Filesystem changes are reflected in the editor
243+
watch: true # Filesystem changes are reflected in the editor
244244
245245
filesystem:
246-
syncChanges: false # Or if it's omitted, the default value is false
246+
watch: false # Or if it's omitted, the default value is false
247247
```
248248

249249

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
type: chapter
3-
title: filesystem.syncChanges
3+
title: filesystem.watch
44
filesystem:
5-
syncChanges: true
5+
watch: true
66
---

packages/runtime/src/store/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export class TutorialStore {
150150
return;
151151
}
152152

153-
this._runner.setSyncChangesFromWebContainer(lesson.data.filesystem?.syncChanges ?? false);
153+
this._runner.setWatchFromWebContainer(lesson.data.filesystem?.watch ?? false);
154154

155155
this._lessonTask = newTask(
156156
async (signal) => {

packages/runtime/src/store/tutorial-runner.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class TutorialRunner {
6565

6666
private _ignoreFileEvents = new MultiCounter();
6767
private _watcher: IFSWatcher | undefined;
68-
private _syncContentFromWebContainer = false;
68+
private _watchContentFromWebContainer = false;
6969
private _readyToWatch = false;
7070

7171
private _packageJsonDirty = false;
@@ -82,12 +82,12 @@ export class TutorialRunner {
8282
private _stepController: StepsController,
8383
) {}
8484

85-
setSyncChangesFromWebContainer(value: boolean) {
86-
this._syncContentFromWebContainer = value;
85+
setWatchFromWebContainer(value: boolean) {
86+
this._watchContentFromWebContainer = value;
8787

88-
if (this._readyToWatch && this._syncContentFromWebContainer) {
88+
if (this._readyToWatch && this._watchContentFromWebContainer) {
8989
this._webcontainer.then((webcontainer) => this._setupWatcher(webcontainer));
90-
} else if (!this._syncContentFromWebContainer) {
90+
} else if (!this._watchContentFromWebContainer) {
9191
this._stopWatcher();
9292
}
9393
}
@@ -565,7 +565,7 @@ export class TutorialRunner {
565565
this._readyToWatch = true;
566566

567567
// if the watcher is alreay setup or we don't sync content we exit
568-
if (this._watcher || !this._syncContentFromWebContainer) {
568+
if (this._watcher || !this._watchContentFromWebContainer) {
569569
return;
570570
}
571571

packages/template/src/content/tutorial/1-basics/meta.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
type: part
33
title: Basics
44
filesystem:
5-
syncChanges: true
5+
watch: true
66
---

packages/types/src/schemas/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const previewSchema = z.union([
5656
export type PreviewSchema = z.infer<typeof previewSchema>;
5757

5858
export const fileSystemSchema = z.object({
59-
syncChanges: z
59+
watch: z
6060
.boolean()
6161
.optional()
6262
.describe('When set to true, when a file is changed in WebContainer, it is updated in the editor as well.'),

0 commit comments

Comments
 (0)