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

Implement: ES6 modules #50

Merged
merged 3 commits into from
Feb 4, 2017
Merged

Implement: ES6 modules #50

merged 3 commits into from
Feb 4, 2017

Conversation

andygout
Copy link
Owner

@andygout andygout commented Feb 4, 2017

Development app will run (using $ npm start) server/app-dev.js, transpiling at runtime using babel-register.

Tests ($ npm test) will transpile server code into a dist directory (via 'pretest' command) and test that code.

TO DO: At production stage the app will run the dist directory code (to improve performance as will not have to continually transpile). This will require step to create dist directory and for Procfile to point at that.

New dependencies:

References:

Run tests transpiling at runtime (not from dist directory):

  • Amend package.json (removing pretest command) so as to require spec/server/setup file:
    "test": "find spec -name '*.spec.js' | xargs mocha --require spec/server/setup -R spec"

  • Add spec/server/setup.js:
    require('../../server/setup');

  • Add server/setup.js:

require('babel-register')({
	plugins: [
		require.resolve('babel-plugin-add-module-exports'),
		require.resolve('babel-plugin-transform-es2015-modules-commonjs')
	]
});
  • Convert all spec files to use ES6 modules syntax.

@andygout andygout changed the title Implement: ES6 modules syntax Implement: ES6 modules Feb 4, 2017
@andygout andygout merged commit 7e65034 into master Feb 4, 2017
@andygout andygout deleted the es6-modules branch February 4, 2017 10:54
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

1 participant