ramda / repl

The Ramda REPL
34 stars 15 forks source link

Added support for ES2015 generator in repl #50

Closed zehua closed 7 years ago

zehua commented 7 years ago

Allow generator syntax to be used in the repl, e.g.

function* abc() {
    yield 1;
    yield 2;
}

abc().next()

Based on https://stackoverflow.com/questions/33527653/babel-6-regeneratorruntime-is-not-defined.

Not sure if I generated the npm-shrinkwrap.json and dist/bundle.js files correctly.

@craigdallimore @buzzdecafe

buzzdecafe commented 7 years ago

Thanks -- I am getting a test failure in the assertion above yours. Appears to be unrelated, that asserion is failing in master branch as well 😦

zehua commented 7 years ago

@buzzdecafe I ran into similar issue when setting delay to 10 and click to 20 in the new test, too. It's intermittent. Sometimes, the debounced compile method is not called at all. I suspect it's a bug in sinon that might have been fixed in a more recent version. The travis build is good though. It might also have to do with node version, though I did try node 5, as specified in the travis yml.

buzzdecafe commented 7 years ago

Ah, thanks for the info. I'll try and take a look tonight, i don't wanna let that hold up this pr.

buzzdecafe commented 7 years ago

when i run the example it still gives me the error: "regeneratorRuntime is not defined". I tried rebuilding the dist bundle, but no luck yet.

zehua commented 7 years ago

hmm, maybe try a hard refresh on the browser?

It works for me when testing locally (via npm run server) either with the dist/bundle.js from the PR or rebuilding using npm run minify. My node version is v5.10.1.

image

buzzdecafe commented 7 years ago

yeah i did try clearing cache, and tried in a different browser. I'll give it another go over the weekend.

buzzdecafe commented 7 years ago

got it working today. happy to merge this PR, then I gotta remember how to deploy it to the docs site. 🤷‍

also got the test to pass by setting delay to 5, whatever that means 😦

buzzdecafe commented 7 years ago

:cow2:

thanks

zehua commented 7 years ago

Thanks!

Re deployment, based on https://github.com/ramda/ramda.github.io/blob/master/repl/index.html#L56 it looks like we don't have to do anything if rawgit is able to auto refresh the cdn cache. However, according to rawgit faq using master the way we use it would not work because the cdn cache would never be invalidated. I am not sure how updates to bundle.js used to work in the past. By right, we should be using commit hash or tags for the bundle.js file.

I also noticed that the version of bundle.js file generated from this PR looks different from the old one, in that it is minified more (fewer lines) and does not contain the sourcemap line. I got it via running npm run minify. EDIT looks like most older versions are minified except the last one from this PR. I assume minification is the right thing to do. :)

craigdallimore commented 7 years ago

Nice one! 😻