Skip to content

0.12 support#74

Merged
tomdale merged 1 commit intomasterfrom
0.12-support
Jul 28, 2016
Merged

0.12 support#74
tomdale merged 1 commit intomasterfrom
0.12-support

Conversation

@tomdale
Copy link
Copy Markdown
Contributor

@tomdale tomdale commented Jul 19, 2016

This PR adds back support for Node 0.12. It works by shipping a transpiled version of the source code to npm, and when a user installs it in the Node 0.12 environment, switches to that version.

The major constraints we had were:

  1. We wanted to use new syntax features in ES2015, particularly arrow functions, which really help clean up heavily async code.
  2. We still wanted to support Node 0.12.
  3. We didn't want to slow down development by requiring a transpilation step after every code change, like to run the tests, for example.

This PR makes the following changes:

  1. Source is moved into the src/ directory.
  2. Source should only use ES2015 syntax available in Node 4 or later, although if newer syntax is used, it will still fall back to the transpiled output.
  3. The broccoli-module-alchemist plugin is used to transpile source into CommonJS + ES5 and placed into the dist/ directory.
  4. broccoli-module-alchemist-install is used to switch to the right version at package install time.
  5. To run the tests in older versions of Node, Babel integration is added to Mocha. This was mostly for convenience, and to avoid the transpilation step during test runs.
  6. Inside the tests, the broccoli-module-alchemist version of require() is used to require modules from the package; this will grab the file from either src/ or dist/cjs/ as appropriate at runtime, allowing the tests to pass on Node 0.12.

@danmcclain
Copy link
Copy Markdown
Member

LGTM 👍

@tomdale tomdale merged commit 3dbc026 into master Jul 28, 2016
@tomdale tomdale deleted the 0.12-support branch July 28, 2016 18:17
@nathanhammond
Copy link
Copy Markdown

nathanhammond commented Jul 29, 2016

Note that Ember CLI is dropping support for 0.12 on December 31 this year. This change can be rolled back on January 1, 2017.

@tomdale
Copy link
Copy Markdown
Contributor Author

tomdale commented Jul 31, 2016

@nathanhammond Sounds like the best Christmas present ever. ;)

@nathanhammond
Copy link
Copy Markdown

@tomdale I'm literally counting down the days.

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.

3 participants