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

[cli] Use proxy entrypoint for CLI in order to give proper errors on node < 8 #1118

Merged
merged 1 commit into from
Dec 19, 2018

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Dec 18, 2018

Please check if this makes sense.

Previously, bin/sanity was the prepackaged CLI and that was the target for our sanity bin when installed from npm. The problem with this is that syntax errors (such as async/await is for node 6) would just immediately crash before we got the chance to run any code.

This PR changes bin/sanity to be a "proxy" of sorts, where we check the node version first, then if that matches, tries to require bin/entry.js (which is the unpackaged entry point for the webpack bundle). This allows us to run the CLI in development mode without re-packing it every time.

If entry.js does not exist (it is ignored in .npmignore), we instead require the prepackaged sanity.js (this is what will happen in "production").

Thoughts?

@rexxars rexxars requested a review from bjoerge December 18, 2018 16:44
Copy link
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

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

Looks great! 👏

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

Successfully merging this pull request may close these issues.

None yet

2 participants