Skip to content

Commit 122bd53

Browse files
authored
Log/tutorial version (#559)
* log tutorial and continue position Signed-off-by: shmck <shawn.j.mckay@gmail.com> * prepare v0.18.4 release Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parent 9d433af commit 122bd53

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coderoad",
3-
"version": "0.18.3",
3+
"version": "0.18.4",
44
"description": "Play interactive coding tutorials in your editor",
55
"keywords": [
66
"tutorial",

src/actions/onStartup.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Context from '../services/context/context'
55
import { send } from '../commands'
66
import { WORKSPACE_ROOT, TUTORIAL_URL } from '../environment'
77
import fetch from 'node-fetch'
8+
import logger from '../services/logger'
89

910
const onStartup = async (context: Context): Promise<void> => {
1011
try {
@@ -36,10 +37,12 @@ const onStartup = async (context: Context): Promise<void> => {
3637
// NEW: no stored tutorial, must start new tutorial
3738
if (!tutorial || !tutorial.version) {
3839
if (TUTORIAL_URL) {
40+
logger(`Using tutorial url from env: ${TUTORIAL_URL}`)
3941
// if a tutorial URL is added, launch on startup
4042
try {
4143
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})`)
4346
send({ type: 'START_TUTORIAL_FROM_URL', payload: { tutorial } })
4447
return
4548
} catch (e: any) {
@@ -54,6 +57,7 @@ const onStartup = async (context: Context): Promise<void> => {
5457

5558
// CONTINUE_FROM_PROGRESS
5659
const { position } = await context.onContinue(tutorial)
60+
logger(`Continuing tutorial from progress: level ${position?.levelId} step ${position?.stepId}`)
5761
// communicate to client the tutorial & stepProgress state
5862
send({ type: 'LOAD_STORED_TUTORIAL', payload: { env, tutorial, position } })
5963
} catch (e: any) {

src/actions/onTutorialConfigContinue.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import logger from '../services/logger'
88
import { setupWebhook } from '../services/hooks/webhooks'
99

1010
const onTutorialConfigContinue = async (action: T.Action, context: Context): Promise<void> => {
11-
logger(`Continuing tutorial from progress: ${JSON.stringify(action.payload)}`)
1211
try {
1312
const tutorialToContinue: TT.Tutorial | null = context.tutorial.get()
13+
logger(`Tutorial: ${tutorialToContinue?.summary?.title} (${tutorialToContinue?.version})`)
1414
if (!tutorialToContinue) {
1515
throw new Error('Invalid tutorial to continue')
1616
}

src/services/hooks/utils/runCommands.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const runCommands = async (commands: string[] = []): Promise<void> => {
1818
logger(`Command output: ${JSON.stringify(result)}`)
1919
} catch (error: any) {
2020
logger(`Command failed: ${error.message}`)
21-
send({ type: 'COMMAND_FAIL', payload: { process: { ...process, status: 'FAIL' } } })
21+
send({ type: '', payload: { process: { ...process, status: 'FAIL' } } })
2222
return
2323
}
2424
send({ type: 'COMMAND_SUCCESS', payload: { process: { ...process, status: 'SUCCESS' } } })

web-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coderoad-app",
3-
"version": "0.18.3",
3+
"version": "0.18.4",
44
"private": true,
55
"scripts": {
66
"analyze": "source-map-explorer 'build/static/js/*.js'",

0 commit comments

Comments
 (0)