MostlyAdequate / mostly-adequate-guide

Mostly adequate guide to FP (in javascript)
Other
23.43k stars 1.87k forks source link

in browser exercises??? #608

Open ChuckJonas opened 3 years ago

ChuckJonas commented 3 years ago

In chapter 5 (curry), you first encounter exercises. The section states:

Throughout the book, you might encounter an 'Exercises' section like this one. Exercises can be done directly in-browser provided you're reading from gitbook (recommended).

Maybe I'm missing something, but I don't see any way to do these in browser. It mentions an "embedded editor" but I'm not seeing one...

Wondering if this is an outdated / no longer supported feature of gitbook?

seyfer commented 3 years ago

I think the last build which is hosted on https://mostly-adequate.gitbook.io/ is broken. In each chapter there is only 1st page available, the rest are blank.

ping @DrBoolean

JoshTRN commented 3 years ago

I also don't know what I'm missing. I also tried running this locally and though I see all the functions in the support index.js, I can't run that locally. Not sure if I should just hack together an html page so I can do it in the console. ¯_(ツ)_/¯

KtorZ commented 3 years ago

@ChuckJonas Wondering if this is an outdated / no longer supported feature of gitbook?

Yes indeed, in-browser exercises seem to no longer work since the update to the new gitbook platform. That's a pity. This was using a plugin which may no longer be supported. The section will need to be rephrased until a new way to embed in-browser exercises is found.

@seyfer @JoshSchreuder In each chapter there is only 1st page available, the rest are blank.

The whole chapter is actually available on the first page but for some reason, Gitbook is creating new blank pages for anchors of the chapter. This is perhaps a configuration setting which has to be done differently with the new Gitbook we recently switched over to. Thanks for reporting, I'll give it a look.

sebbalex commented 3 years ago

also in CH08 last exercise is missing a piece, the real question though :rofl:

JoshTRN commented 3 years ago

@KtorZ isn't there a way to just preload all the functions by sourcing the JS in the HTML? That would make it so you could just do all the exercises in the console.

KtorZ commented 3 years ago

If anything, It is possible to do the exercise in the terminal with node.js.

Fellach commented 3 years ago

@KtorZ, not really actually. There is a problem with dependencies versions. You will get unable to resolve dependency tree while installing exercises deps. I've bumped their versions to the latest and finally I'm able to play with them

 "devDependencies": {
    "cli": "^1.0.1",
    "eslint": "7.26.0",
    "eslint-config-airbnb": "18.2.1",
    "eslint-plugin-import": "2.23.2",
    "eslint-plugin-jsx-a11y": "6.4.1",
    "eslint-plugin-react": "7.23.2",
    "live-server": "1.2.1",
    "mocha": "8.4.0"
 }
hariseldon78 commented 3 years ago

Even after updating the versions and installing the tests are not working correctly, they always fail even when correct...

Edit: if i set node version to 10.22.1 they work.

sevillaarvin commented 2 years ago

Even after updating the versions and installing the tests are not working correctly, they always fail even when correct...

Edit: if i set node version to 10.22.1 they work.

Thanks! I downgraded from 18.3.0 to 8.17.0 and it worked.