Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow loading babel-standalone from CircleCI to enable easy testing of PRs #1284

Merged
merged 3 commits into from
Aug 12, 2017

Conversation

Daniel15
Copy link
Member

@Daniel15 Daniel15 commented Jul 31, 2017

This PR adds a new "circleci_build" parameter to the Babel v7 REPL page. When provided, this is treated as a CircleCI build number and babel-standalone is loaded from the CircleCI build artifacts rather than from unpkg. The idea is that we can have a bot that runs as a CircleCI webhook and automatically comments on all Babel PRs with a link to the REPL to allow easy testing of changes.

The new parameter is passed like this:

/repl/?circleci_build=123

The lazyLoadScript function added in this PR is a generalised version of the hasBabiliLoaded function in the current repl.js.

Depends on babel/babel#6029 ("Move babel-standalone into main Babel repo"). We can't test this with real Babel PRs until the other PR lands.

cc @hzoo

@Daniel15 Daniel15 requested a review from hzoo July 31, 2017 01:02
@xtuc
Copy link
Member

xtuc commented Jul 31, 2017

Awesome, it looks good! Thanks @Daniel15

@xtuc xtuc requested a review from existentialism July 31, 2017 11:15
Copy link
Member

@existentialism existentialism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Member

@yavorsky yavorsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Daniel15
Copy link
Member Author

Note to self: Now that we're on Netlify, I can make these URLs a bit nicer (like /repl/preview/123/ instead of /repl/?circleci_build=123) since Netlify support rewrite rules. I'll do that before merging.

@hzoo
Copy link
Member

hzoo commented Aug 10, 2017

@Daniel15 we can still merge this now right? if so feel free to

@Daniel15
Copy link
Member Author

I didn't get a chance to finish this tonight, so I'll take a look over the weekend. I have "Daniel15" hard-coded in the CircleCI API URL for testing purposes. I need it to "babel" before merging. I'll also add a querystring parameter to provide a CircleCI username for testing purposes so I can do something like ?circleci_org=Daniel15 to test with my own separate builds.

@babel-bot
Copy link
Contributor

babel-bot commented Aug 12, 2017

Deploy preview ready!

Built with commit 6c7e0a5

https://deploy-preview-1284--babel.netlify.com

@Daniel15
Copy link
Member Author

Daniel15 commented Aug 12, 2017

^ Looked like a transient error with Netlify. Retried the deploy and it worked fine.

Confirmed working fine:
https://deploy-preview-1284--babel.netlify.com/repl/build/5/#?circleci_repo=Daniel15/babel

(in theory a URL like https://deploy-preview-1284--babel.netlify.com/repl/build/5/ would work to load a Babel build, but we need to merge babel/babel#6029 first)

I added a bonus feature - Ability to load older Babel versions:
https://deploy-preview-1284--babel.netlify.com/repl/version/6.22.1/
https://deploy-preview-1284--babel.netlify.com/repl/version/6.24.2/
https://deploy-preview-1284--babel.netlify.com/repl/version/7.0.0-alpha.15/

@Daniel15 Daniel15 merged commit 619ca74 into babel:master Aug 12, 2017
@Daniel15 Daniel15 deleted the repl-circle branch August 12, 2017 04:57
@hzoo
Copy link
Member

hzoo commented Aug 12, 2017

Whoo!!!!!!!!! 🎉, maybe we should think about the UI to let people know about the build #'s? Or I guess it can just be for ourselves. Oh yeah I guess we can use babel-bot to do it (or https://github.com/danger/danger-js if thats possible too)

I was thinking about the version # - would be nice to add the PR link to the version

http://babeljs.io/repl - normal url
http://babeljs.io/repl/build/4572 - # is the corresponding Circle CI build for a PR
http://babeljs.io/repl/version/6.22.1 - any previous version of babel-standalone on npm (can check with the dropdown on unpkg

@Daniel15
Copy link
Member Author

Daniel15 commented Aug 12, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants