@@ -5,6 +5,7 @@ import Context from '../services/context/context'
|
5 | 5 | import { send } from '../commands'
|
6 | 6 | import { WORKSPACE_ROOT, TUTORIAL_URL } from '../environment'
|
7 | 7 | import fetch from 'node-fetch'
|
| 8 | +import logger from '../services/logger' |
8 | 9 |
|
9 | 10 | const onStartup = async (context: Context): Promise<void> => {
|
10 | 11 | try {
|
@@ -36,10 +37,12 @@ const onStartup = async (context: Context): Promise<void> => {
|
36 | 37 | // NEW: no stored tutorial, must start new tutorial
|
37 | 38 | if (!tutorial || !tutorial.version) {
|
38 | 39 | if (TUTORIAL_URL) {
|
| 40 | +logger(`Using tutorial url from env: ${TUTORIAL_URL}`) |
39 | 41 | // if a tutorial URL is added, launch on startup
|
40 | 42 | try {
|
41 | 43 | const tutorialRes = await fetch(TUTORIAL_URL)
|
42 |
| -const tutorial = await tutorialRes.json() |
| 44 | +const tutorial: TT.Tutorial = await tutorialRes.json() |
| 45 | +logger(`Tutorial: ${tutorial?.summary?.title} (${tutorial?.version})`) |
43 | 46 | send({ type: 'START_TUTORIAL_FROM_URL', payload: { tutorial } })
|
44 | 47 | return
|
45 | 48 | } catch (e: any) {
|
@@ -54,6 +57,7 @@ const onStartup = async (context: Context): Promise<void> => {
|
54 | 57 |
|
55 | 58 | // CONTINUE_FROM_PROGRESS
|
56 | 59 | const { position } = await context.onContinue(tutorial)
|
| 60 | +logger(`Continuing tutorial from progress: level ${position?.levelId} step ${position?.stepId}`) |
57 | 61 | // communicate to client the tutorial & stepProgress state
|
58 | 62 | send({ type: 'LOAD_STORED_TUTORIAL', payload: { env, tutorial, position } })
|
59 | 63 | } catch (e: any) {
|
|
0 commit comments