cucumber-expressions: Build with Babel #86

merged 1 commit into from Oct 10, 2016


None yet

2 participants



Use Babel to compile ES6 code.


The source is moved from lib to src. Babel compilation will happen as part of a release (prepublish npm task). If an unreleased version of the library is used (via an npm git url), then the babel compilation will happen as a postinstall task. The postinstall for released packages will still run, but it won't run Babel again since it happened during release (the postinstall script checks for the presence of the distfolder).

Motivation and Context

Babel compilation is required so that the code can run on older JavaScript engines such as Node 4.

How Has This Been Tested?

This PR doesn't add anything to test that the compiled code actually works on Node 4. We have confindence that Babel work. It will ultimately be tested by Cucumber.js CI when it starts using this library.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).


  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Closes #85, /cc @charlierudolph

@aslakhellesoy aslakhellesoy cucumber-expressions: Build with Babel
This makes sure the code works on Node v4.
+ exec('npm run build', {cwd: path.join(__dirname, '..')}, function (err) {
+ if (err) throw err;
+ })
charlierudolph Oct 10, 2016 Member

I think this should be removed. The build script requires dev dependencies and this will run on production installs as well. Since you have the prepublish script setup, I don't understand why this would be need

aslakhellesoy Oct 10, 2016 Member

It's needed so you can temporarily depend on an unreleased package. See the PR description. The cucumber-react module uses the same technique so that cucumber-html can depend on it.

aslakhellesoy Oct 10, 2016 Member

Note the guard checking for the presence of dist. The npn run build command will not run when the package is published (it would have been done in prepublish)

If you know a better technique that allows code to depend on unreleases ES6 modules I'd love to know.

@aslakhellesoy aslakhellesoy merged commit 92036e9 into master Oct 10, 2016

5 checks passed

continuous-integration/gitbook/epub GitBook build "epub" succeeded
continuous-integration/gitbook/json GitBook build "json" succeeded
continuous-integration/gitbook/mobi GitBook build "mobi" succeeded
continuous-integration/gitbook/pdf GitBook build "pdf" succeeded
continuous-integration/gitbook/website GitBook build "website" succeeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment