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

✨ Add Babel boilerplate #346

Closed
wants to merge 14 commits into from
Closed

Conversation

marvinroger
Copy link
Contributor

@marvinroger marvinroger commented Apr 12, 2017

Run npm run build to generate ES5 code in the dist folder. This is this folder that will need to be published to NPM.

@marvinroger
Copy link
Contributor Author

Not ready to merge yet. Some tests still fail, I think it's because of the way JSON is handled.

@marvinroger
Copy link
Contributor Author

Well, I am stuck. JSON.parse and JSON.stringify reacts weirdly.

@marvinroger
Copy link
Contributor Author

Okay, the problem happens here:

data = JSON.stringify(data);

On the non-Babel compiled version, data = JSON.stringify(data); actually stringify arguments[1], whereas it does not on the compiled version. I don't know what's the issue, though, probably scoping or something.

@marvinroger
Copy link
Contributor Author

Fixed! 😪

Some var were missing, some mocks contained a bug (PeerRegistry returning a string instead of an object like the actual PeerRegistry does), and there were some lucky arguments manipulation.

Anyway, it's working now. Here's how it works:

  • There's a new TARGET_NODE_VERSION env variable in the Travis file. This variable contains the node version that is compatible with the codebase without transpilation.
    • If the TARGET_NODE_VERSION == the current tested node version, then we test the code without the transpilation
    • For every version (including the TARGET_NODE_VERSION as the transpiled version is the one published to NPM anyway), test the code against the transpilation

This ensures that we can develop and test on modern Node.js versions (>= TARGET_NODE_VERSION) without transpilation, and it also ensures that the built version (published to NPM) is compatible with all versions down to 0.10. And the circle is complete. 😄

@kevinswiber
Copy link
Member

Hey @marvinroger, this has been merged to an es2015 branch: https://github.com/zettajs/zetta/tree/es2015.

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.

2 participants